/////////////////////////////////////////////////////////////////////// // CodeUtilities.cpp - small, generally useful, helper classes // // ver 1.0 // // Language: C++, Visual Studio 2017 // // Application: Most Projects, CSE687 - Object Oriented Design // // Author: Jim Fawcett, Syracuse University, CST 4-187 // // jfawcett@twcny.rr.com // /////////////////////////////////////////////////////////////////////// #include "CodeUtilities.h" #include "../StringUtilities/StringUtilities.h" #include #include #ifdef TEST_CODEUTILITIES using namespace Utilities; int main() { Box boxedDouble = 3.1415927; std::cout << "\n boxedDouble = " << boxedDouble; boxedDouble = 0.33333; std::cout << "\n boxedDouble = " << boxedDouble; PersistFactory name = std::string("Jim"); name.append(" Fawcett"); std::cout << "\n " << name.toXml("name"); PersistFactory> value = Box(9.87654); std::cout << "\n " << value.toXml("value"); value += 3.14159; std::cout << "\n " << value.toXml("value"); std::cout << "\n\n"; title("test std::string Converter::toString(T)"); std::string conv1 = Converter::toString(3.1415927); std::string conv2 = Converter::toString(73); std::string conv3 = Converter::toString("a_test_string plus more"); std::cout << "\n Converting from values to strings: "; std::cout << conv1 << ", " << conv2 << ", " << conv3; putline(); title("test T Converter::toValue(std::string)"); std::cout << "\n Converting from strings to values: "; std::cout << Converter::toValue(conv1) << ", "; std::cout << Converter::toValue(conv2) << ", "; std::cout << Converter::toValue(conv3); putline(2); return 0; } #endif