00001 //------------------------------------------------------------------------ 00002 // 00003 // Joe Kniss 00004 // 3-21-03 00005 // ________ ____ ___ 00006 // | \ / | / / 00007 // +---+ \/ |/ / 00008 // +--+| |\ /| < 00009 // | || | \ / | |\ \ 00010 // | | \/ | | \ \ 00011 // \_____| |__| \__\ 00012 // Copyright 2003 00013 // Joe Michael Kniss 00014 // <<< jmk@cs.utah.edu >>> 00015 // "All Your Base are Belong to Us" 00016 //------------------------------------------------------------------------- 00017 00018 //SerializeUtil.h 00019 00020 00021 #ifndef __SERIALIZE_UTILITIES_DOT_H 00022 #define __SERIALIZE_UTILITIES_DOT_H 00023 00024 #include <string> 00025 00026 /////////////////////////////////////////////////////////////////////////// 00027 /// a debug check for unserializing a "named" value 00028 /// example: 00029 /// MyKey: 10 00030 /// theKey = "MyKey:" 00031 /// checkStr = "blah blah blah MyKey:" 00032 /// this function finds MyKey in checkStr so it is good 00033 /// returns 0 if success and 1 if failure. 00034 inline 00035 int unserialKeyCheck(const std::string theKey, 00036 const std::string checkStr, 00037 const char *place) 00038 { 00039 #ifdef _DEBUG 00040 if(( checkStr.find(theKey) ) < 0) 00041 { 00042 std::cerr << place << "::serialKeyCheck(), " << theKey << " not found int string: " << std::endl 00043 << " " << checkStr << std::endl; 00044 return 1; 00045 } 00046 #endif 00047 return 0; 00048 } 00049 00050 00051 00052 #endif 00053 00054