void ArgumentParser::parse(const std::string& _identifier, bool& b, bool starting, const std::string& string) { assert( _identifier.size() == 2 ); assert( _identifier[0] == '-' ); if( isPresent( _identifier ) ) { report( " is present" ); b = !starting; } else { b = starting; } std::string identifier( ' ' + _identifier ); int prefixSpacing = MESSAGE_OFFSET - ( int )identifier.size(); std::string prefix( MAX( prefixSpacing, 0 ), ' ' ); std::string regularPrefix( MESSAGE_OFFSET, ' ' ); std::stringstream secondStream( string + '\n' ); std::string result = format( secondStream.str(), prefix, regularPrefix, SCREEN_WIDTH ); std::stringstream thirdStream; thirdStream << result << regularPrefix << "value = " << std::boolalpha << b << "\n"; arguments << identifier << thirdStream.str() << "\n"; }
bool TestXMLProperties::CompareFiles(const std::wstring &first, const std::wstring &second) { std::ifstream firstStream(first.c_str()); firstStream.seekg(0, std::ios::end); std::ifstream::pos_type firstSize = firstStream.tellg(); std::ifstream secondStream(second.c_str()); secondStream.seekg(0, std::ios::end); std::ifstream::pos_type secondSize = secondStream.tellg(); if(firstSize != secondSize) return false; std::string firstBuffer((unsigned long)firstSize, 0); std::string secondBuffer((unsigned long)secondSize, 0); firstStream.seekg(0); secondStream.seekg(0); firstStream.read(&firstBuffer[0], firstSize); secondStream.read(&secondBuffer[0], secondSize); if(firstBuffer == secondBuffer) return true; return false; }