| 1 |
/* |
| 2 |
* This file is part of the apvlv package |
| 3 |
* |
| 4 |
* Copyright (C) 2008 Alf. |
| 5 |
* |
| 6 |
* Contact: Alf <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software; you can redistribute it and/or |
| 9 |
* modify it under the terms of the GNU General Public License |
| 10 |
* as published by the Free Software Foundation; either version 2.0 of |
| 11 |
* the License, or (at your option) any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, but |
| 14 |
* WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 |
* General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public |
| 19 |
* License along with this program; if not, write to the Free Software |
| 20 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
| 21 |
* |
| 22 |
*/ |
| 23 |
/* @CPPFILE ApvlvEditor.cc |
| 24 |
* |
| 25 |
* Author: Alf <[email protected]> |
| 26 |
*/ |
| 27 |
|
| 28 |
#include <filesystem> |
| 29 |
#include <fstream> |
| 30 |
|
| 31 |
#include "ApvlvNote.h" |
| 32 |
|
| 33 |
namespace apvlv |
| 34 |
{ |
| 35 |
std::string NotesDir = "/tmp"; |
| 36 |
} |
| 37 |
|
| 38 |
using namespace std; |
| 39 |
using namespace apvlv; |
| 40 |
int |
| 41 |
main (int argc, const char *argv[]) |
| 42 |
{ |
| 43 |
auto note = Note{ nullptr }; |
| 44 |
note.setScore (8.0); |
| 45 |
note.addTag ("abc"); |
| 46 |
note.addTag ("def"); |
| 47 |
note.addTag ("hijklmn"); |
| 48 |
auto comment1 = Comment{}; |
| 49 |
comment1.commentText = "lksdflkasdlfkaj"; |
| 50 |
comment1.quoteText |
| 51 |
= "lksjdflkajdsklfjkaldklsdlkfasldkjf\nlksdjfkla\nsdflkasd\n"; |
| 52 |
comment1.begin = Location{ 0, 1.0, 2.0, 3 }; |
| 53 |
comment1.end = Location{ 0, 2.0, 3.0, 4 }; |
| 54 |
note.addComment (comment1); |
| 55 |
auto comment2 = Comment{}; |
| 56 |
comment2.commentText = "bbbbbbbbbbbbbbbbbbbbbbb"; |
| 57 |
comment2.quoteText = "bbbbbbbbbbbbbbbbbbbb\nlksdjfkla\nsdflkasd\n"; |
| 58 |
comment2.begin = Location{ 1, 1.0, 2.0, 5 }; |
| 59 |
comment2.end = Location{ 1, 2.0, 3.0, 8 }; |
| 60 |
note.addComment (comment2); |
| 61 |
note.addReference ("abcdehijklmn1"); |
| 62 |
note.addReference ("abcdehijklmn2"); |
| 63 |
note.addReference ("abcdehijklmn3"); |
| 64 |
note.addLink ("link1sldkfajlksdjfaldsk1"); |
| 65 |
note.addLink ("link1sldkfajlksdjfaldsk2"); |
| 66 |
note.addLink ("link1sldkfajlksdjfaldsk3"); |
| 67 |
auto fos = ofstream{ "/tmp/testNote1.md" }; |
| 68 |
note.dumpStream (fos); |
| 69 |
fos.close (); |
| 70 |
auto fis = ifstream{ "/tmp/testNote1.md" }; |
| 71 |
auto note1 = Note{ nullptr }; |
| 72 |
note1.loadStream (fis); |
| 73 |
auto fos2 = ofstream{ "/tmp/testNote2.md" }; |
| 74 |
note1.dumpStream (fos2); |
| 75 |
fos2.close (); |
| 76 |
|
| 77 |
return 0; |
| 78 |
} |