The SWORD Project  1.9.0.svnversion
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
addcomment.cpp
Go to the documentation of this file.
1 /******************************************************************************
2  *
3  * addcomment.cpp -
4  *
5  * $Id: addcomment.cpp 3063 2014-03-04 13:04:11Z chrislit $
6  *
7  * Copyright 1998-2013 CrossWire Bible Society (http://www.crosswire.org)
8  * CrossWire Bible Society
9  * P. O. Box 2528
10  * Tempe, AZ 85280-2528
11  *
12  * This program is free software; you can redistribute it and/or modify it
13  * under the terms of the GNU General Public License as published by the
14  * Free Software Foundation version 2.
15  *
16  * This program is distributed in the hope that it will be useful, but
17  * WITHOUT ANY WARRANTY; without even the implied warranty of
18  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  * General Public License for more details.
20  *
21  */
22 
23 #include <stdio.h>
24 #include <iostream>
25 #include <versekey.h>
26 #include <rawtext.h>
27 #include <zcom.h>
28 #include <rawcom.h>
29 #include <rawfiles.h>
30 #include <stdlib.h>
31 
32 int main(int argc, char **argv)
33 {
34  int loop;
35  int max;
36  RawFiles personal("modules/comments/rawfiles/personal/", "MINE", "Personal Comments");
37  VerseKey mykey;
38 
39  if (argc < 3) {
40  fprintf(stderr, "usage: %s <\"comment\"> <\"verse\"> [count] [disable AutoNormalization]\n", argv[0]);
41  exit(-1);
42  }
43 
44  if (argc > 4)
45  mykey.AutoNormalize(0); // Turn off autonormalize if 3 args to allow for intros
46  // This is kludgy but at lease you can try it
47  // with something like: sword "Matthew 1:0" 1 1
48 
49  mykey = argv[2];
50  mykey.Persist(1);
51  personal.setKey(mykey);
52 
53  max = (argc < 4) ? 1 : atoi(argv[3]);
54 
55  for (loop = 0; loop < max; loop++) {
56  personal << argv[1];
57  mykey++;
58  }
59  std::cout << "Added Comment" << std::endl;
60  return 0;
61 }
virtual char setKey(const SWKey *ikey)
Definition: swmodule.cpp:298
int main(int argc, char **argv)
Definition: addcomment.cpp:32
SWDEPRECATED char AutoNormalize(char iautonorm)
Definition: versekey.h:375
SWDEPRECATED char Persist() const
Definition: swkey.h:148