Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Copyright (c) 2012, Daniel Bocksteger
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following condition is met:
- * Redistributions of source code must retain the above copyright
- notice and the following disclaimer.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- #include <iostream>
- #include "StringOperations.hpp"
- #include "XMLWriter.hpp"
- using namespace std;
- int main(void) {
- string receivers_string, reason, message;
- cout << "Bitte geben sie die Empfaenger mit ',' getrennt ein: ";
- getline(cin, receivers_string);
- cout << "\nBitte geben sie einen Betreff ein: ";
- getline(cin, reason);
- cout << "\nBitte geben sie ihr Nachricht ein: ";
- getline(cin, message);
- StringVector list = split(receivers_string, ',', true);
- // Build the xml-structure
- XMLWriter writer;
- writer.createTag("sms"); // open root-tag 'sms'
- writer.addComment("Contacts");
- writer.createTag("contacts"); // creates tag 'contacts'
- int i = 0;
- for(StringVector::iterator it = list.begin(); it < list.end(); it++) //Iterates through all findings
- {
- writer.addValue("receiver", *it);
- }
- writer.closeTag(); // closes tag 'contacts'
- writer.addComment("Reason");
- writer.createTag("reason-tag"); // creates tag 'reason'
- writer.addValue("reason-element", reason);
- writer.closeTag(); // closes tag 'reason'
- writer.addComment("Message");
- writer.createTag("message-tag"); // opens tag 'message'
- writer.addValue("message-element", message);
- writer.closeTag(); // closes tag 'message'
- writer.closeTag(); // closes tag 'sms'
- //------- Dump XML to the Console ------------
- cout << "----- xml begin -----\n";
- cout << writer.toString();
- cout << "------ xml end ------\n";
- writer.saveAsFile("C:\\Users\\Daniel\\Documents\\sms-designs\\design.xml"); // ----- HIER BUGGTS !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- // Menu
- int selection;
- cout << "-----------------------\n";
- cout << "- Menu -\n";
- cout << "- Datei speichern - 1 -\n";
- cout << "- Neuer Entwurf - 2 -\n";
- cout << "- Beenden - 3 -\n";
- cout << "-----------------------\n";
- cout << "- Ihre Wahl: ";
- cin >> selection;
- switch(selection) {
- case 1:
- cout << "Menuepunkt 1 !";
- break;
- case 2:
- cout << "Menuepunkt 2 !";
- break;
- case 3:
- exit(1);
- break;
- default:
- cout << "Falsche Eingabe !";
- }
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment