[sword-svn] r2646 - in trunk: include tests utilities

scribe at crosswire.org scribe at crosswire.org
Sat Jul 23 10:39:20 MST 2011


Author: scribe
Date: 2011-07-23 10:39:20 -0700 (Sat, 23 Jul 2011)
New Revision: 2646

Modified:
   trunk/include/defs.h
   trunk/include/swkey.h
   trunk/tests/indextest.cpp
   trunk/tests/keytest.cpp
   trunk/utilities/cipherraw.cpp
Log:
Added deprecated logic to defs and started to use in engine


Modified: trunk/include/defs.h
===================================================================
--- trunk/include/defs.h	2011-07-22 11:03:45 UTC (rev 2645)
+++ trunk/include/defs.h	2011-07-23 17:39:20 UTC (rev 2646)
@@ -48,6 +48,9 @@
 #    define SWDLLEXPORT_CTORFN
 #  endif
 
+# define SWDEPRECATED __declspec(deprecated("** WARNING: deprecated method **"))
+
+
 #elif defined(__SWPM__)
 
 #  ifdef SWMAKINGDLL
@@ -64,6 +67,9 @@
 #    define SWDLLEXPORT_CTORFN
 #  endif
 
+# define SWDEPRECATED 
+
+
 #elif defined(__GNUWIN32__)
 
 #  ifdef SWMAKINGDLL
@@ -80,6 +86,9 @@
 #    define SWDLLEXPORT_CTORFN
 #  endif
 
+# define SWDEPRECATED __declspec(deprecated("** WARNING: deprecated method **"))
+
+
 #elif defined(__BORLANDC__)
 #  ifdef SWMAKINGDLL
 #    define SWDLLEXPORT _export
@@ -95,12 +104,24 @@
 #    define SWDLLEXPORT_CTORFN
 #  endif
 
+#  define SWDEPRECATED
+
+
+#elif defined(__GNUC__)
+#  define SWDLLEXPORT
+#  define SWDLLEXPORT_DATA(type) type
+#  define SWDLLEXPORT_CTORFN
+#  define SWDEPRECATED  __attribute__((__deprecated__))
+
+
 #else
 #  define SWDLLEXPORT
 #  define SWDLLEXPORT_DATA(type) type
 #  define SWDLLEXPORT_CTORFN
+#  define SWDEPRECATED
 #endif
 
+
 // For ostream, istream ofstream
 #if defined(__BORLANDC__) && defined( _RTLDLL )
 #  define SWDLLIMPORT __import
@@ -108,6 +129,8 @@
 #  define SWDLLIMPORT
 #endif
 
+
+
 enum {DIRECTION_LTR = 0, DIRECTION_RTL, DIRECTION_BIDI};
 enum {FMT_UNKNOWN = 0, FMT_PLAIN, FMT_THML, FMT_GBF, FMT_HTML, FMT_HTMLHREF, FMT_RTF, FMT_OSIS, FMT_WEBIF, FMT_TEI, FMT_XHTML};
 enum {ENC_UNKNOWN = 0, ENC_LATIN1, ENC_UTF8, ENC_UTF16, ENC_RTF, ENC_HTML};

Modified: trunk/include/swkey.h
===================================================================
--- trunk/include/swkey.h	2011-07-22 11:03:45 UTC (rev 2645)
+++ trunk/include/swkey.h	2011-07-23 17:39:20 UTC (rev 2646)
@@ -205,7 +205,7 @@
 
 	/** deprecated, use isTraversible
 	 */
-	char Traversable() { return (isTraversable()) ? 1:0; }
+	SWDEPRECATED char Traversable() { return (isTraversable()) ? 1:0; }
 
 	/** Whether or not this key can be ++ -- incremented
 	 */
@@ -217,12 +217,12 @@
 	/** Use this function to get an index position within a module.
 	 */
 	virtual long getIndex() const { return index; }
-	long Index() const { return getIndex(); }	// deprecated, use getIndex()
+	SWDEPRECATED long Index() const { return getIndex(); }	// deprecated, use getIndex()
 
 	/** See documentation for @ref Index()
 	 */
 	virtual void setIndex(long iindex) { index = iindex; }
-	long Index(long iindex) { setIndex(iindex); return getIndex(); }	// deprecated, use setIndex(...)
+	SWDEPRECATED long Index(long iindex) { setIndex(iindex); return getIndex(); }	// deprecated, use setIndex(...)
 
 	SWKEY_OPERATORS
 

Modified: trunk/tests/indextest.cpp
===================================================================
--- trunk/tests/indextest.cpp	2011-07-22 11:03:45 UTC (rev 2645)
+++ trunk/tests/indextest.cpp	2011-07-23 17:39:20 UTC (rev 2646)
@@ -33,7 +33,7 @@
 		vk.Persist(1);
 		bbe->setKey(vk);
 		for (; !bbe->Error(); (*bbe)++ ) {
-			std::cout << vk.Index() << std::endl; 
+			std::cout << vk.getIndex() << std::endl; 
 		}
 	}
 	return 0;

Modified: trunk/tests/keytest.cpp
===================================================================
--- trunk/tests/keytest.cpp	2011-07-22 11:03:45 UTC (rev 2645)
+++ trunk/tests/keytest.cpp	2011-07-23 17:39:20 UTC (rev 2646)
@@ -53,9 +53,9 @@
 	max = (argc < 4) ? 10 : atoi(argv[3]);
 
 	for (loop = 0; loop < max; loop++) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")";
-		bla.Index(index+1);
+		bla.setIndex(index+1);
 		std::cout << "-> " << (const char *)bla << "\n";
 	}
 
@@ -66,9 +66,9 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop; loop--) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")";
-		bla.Index(index-1);
+		bla.setIndex(index-1);
 		std::cout << "-> " << (const char *)bla << "\n";
 	}
 
@@ -82,7 +82,7 @@
 	else	bla = argv[2];
 
 	for (loop = 0; loop < max && !bla.Error(); loop++,bla++) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -96,7 +96,7 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop && !bla.Error(); loop--, bla--) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -107,7 +107,7 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop; loop--, bla--) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -118,7 +118,7 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop; loop--, bla++) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -129,7 +129,7 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop; loop--, bla++) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -144,7 +144,7 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop; loop--, bla--) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -155,7 +155,7 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop; loop--, bla--) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -166,7 +166,7 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop; loop--, bla++) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -177,7 +177,7 @@
 	else	bla = argv[2];
 
 	for (loop = max; loop; loop--, bla++) {
-		index = bla.Index();
+		index = bla.getIndex();
 		std::cout << (const char *)bla << "(" << index << ")\n";
 	}
 
@@ -198,12 +198,12 @@
 	bla.Testament(1);
 	bla = BOTTOM;
 	std::cout << bla.TestamentIndex() << "\n";
-	std::cout << bla.Index() << "\n";
+	std::cout << bla.getIndex() << "\n";
 	std::cout << bla << "\n";
 	bla.Testament(2);
 	bla = BOTTOM;
 	std::cout << bla.TestamentIndex() << "\n";
-	std::cout << bla.Index() << "\n";
+	std::cout << bla.getIndex() << "\n";
 	std::cout << bla << "\n";
 	return 0;
 }

Modified: trunk/utilities/cipherraw.cpp
===================================================================
--- trunk/utilities/cipherraw.cpp	2011-07-22 11:03:45 UTC (rev 2645)
+++ trunk/utilities/cipherraw.cpp	2011-07-23 17:39:20 UTC (rev 2646)
@@ -81,8 +81,8 @@
 
 	key.AutoNormalize(0);
 	key.Headings(1);
-	for (key.Index(0); (!key.Error()); key++) {
-		rawdrv->findOffset(key.Testament(), key.Index(), &offset, &size);
+	for (key.setIndex(0); (!key.Error()); key++) {
+		rawdrv->findOffset(key.Testament(), key.getIndex(), &offset, &size);
 		printf("%s: OLD offset: %ld; size: %d\n", (const char *)key, offset, size);
 
 		if ((offset == loffset) && (size == lsize)) {




More information about the sword-cvs mailing list