Improve dtd for ADML services
[anna.git] / example / core / regularExpression / main.cpp
1 // ANNA - Anna is Not Nothingness Anymore                                                         //
2 //                                                                                                //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo                         //
4 //                                                                                                //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite                           //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7
8
9 // Standard
10 #include <iostream>
11
12 // STL
13 #include <string>
14
15 #include <anna/core/functions.hpp>
16 #include <anna/core/core.hpp>
17 #include <anna/core/RuntimeException.hpp>
18 #include <anna/core/util/RegularExpression.hpp>
19
20
21 using namespace anna;
22
23
24 void _exit(const std::string & msg) {
25    std::cout << std::endl << msg << std::endl;
26    exit(-1);
27 }
28
29
30 int main(int argc, char** argv) {
31    Logger::setLevel(Logger::Information);
32 //   Logger::setLevel(Logger::Debug);
33    Logger::initialize("RegularExpression", new TraceWriter("file.trace", 2048000));
34    {
35       anna::RegularExpression myExp;
36       anna::RegularExpression myExpB("65");
37       myExp.setPattern("656");
38       std::string value1, value2;
39       std::cout << "Input value1:" ;
40       std::cin >> value1;
41       std::cout << "Input value2:" ;
42       std::cin >> value2;
43
44       if (myExp.isLike(value1))  std::cout << "The input value1 match the regular expresion" << std::endl;
45
46       if (myExp.isLike(value2))  std::cout << "The input value2 match the regular expresion" << std::endl;
47
48       if (myExpB < myExp)  std::cout << "myExpB < myExp" << std::endl;
49    }
50 }
51