summaryrefslogtreecommitdiff
path: root/Untracked/Doxygen/main.cpp
blob: 92d033c19722ece0f6c304b97bd78e81c2df2d72 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
/**
 * @file main.cpp
 * @brief Entry point
 * @author manzerbredes
 * @version Prototype
 * @date 8 Mars 2015
 *
 * Entry point of the application.
 *
 */



//----- std -----

#include <iostream>
#include <string>

//----- class -----
#include "CryptClass/AESCrypt.hpp"

//----- Prototype -----
void aff(std::string chaine);



    #include <xercesc/parsers/XercesDOMParser.hpp>
    #include <xercesc/dom/DOM.hpp>
    #include <xercesc/framework/MemBufInputSource.hpp>
    #include <xercesc/sax/HandlerBase.hpp>
    #include <xercesc/util/XMLString.hpp>
    #include <xercesc/util/PlatformUtils.hpp>
using namespace xercesc;

/**
 * @fn int main(int argc, char *argv[])
 * @author manzerbredes
 * @brief main function
 * @param argc contain *argv[] length
 * @param *argv[] contain the arguments list
 * @return Return code, an int.
 */
int main(int argc, char *argv[]){

     try {
        XMLPlatformUtils::Initialize();
      }
      catch (const XMLException& toCatch) {
        // Do your failure processing here
        return 1;
      }

    std::string xml="<root>\n\
                        <mo><![CDATA[ zalmkdzkl!:<<!!;<ii>!:!!;:!:;]]>\
                        </mo>\
                    </root>";

    XercesDOMParser *parser = new XercesDOMParser();
    MemBufInputSource myxml_buf((const XMLByte*)xml.c_str(), xml.size(), "dummy",false);
    parser->parse(myxml_buf);

    DOMDocument* xmlDoc = parser->getDocument();
    DOMElement* root=xmlDoc->getDocumentElement();

    DOMNodeList*      children = root->getChildNodes();
    const  XMLSize_t nodeCount = children->getLength();



    for(int i=0;i<nodeCount;i++){
        DOMNode* ne=children->item(i);
        char* valeur = XMLString::transcode(ne->getTextContent());

        std::string nom(valeur);
        std::cout << nom;

    }




  // Do your actual work with Xerces-C++ here.

    //XMLPlatformUtils::Terminate();






    /*HASHCrypt hash= HASHCrypt();

    byte code[16];

    hash.getMD5_128("Phrase de test !", code, sizeof(code));

    for(int i=0; i<16;i++){
        std::cout << code[i];
    }
    */


    /*AESCrypt cryptage= AESCrypt();
    std::string key="loic";
    std::string data(127,'A');

    std::cout << data << std::endl;

    std::string dataE=cryptage.encrypt(key, data);

    std::cout << std::endl <<dataE << std::endl;

    std::string key2="loic";
    std::string dataD=cryptage.decrypt(key2, dataE);
    std::cout << std::endl << dataD << std::endl;
*/

    return 0;

}




//---- Functions -----

void aff(std::string chaine){
        std::cout << chaine;
}