#pragma once class IncludedFilesRelation { std::vector filePaths; std::vector lineFileNumbers; // XMLシリアライズ用 private: friend class boost::serialization::access; template void serialize(Archive& ar, const unsigned int version) { ar & BOOST_SERIALIZATION_NVP( filePaths ); ar & BOOST_SERIALIZATION_NVP( lineFileNumbers ); } public: IncludedFilesRelation() { } ~IncludedFilesRelation() { } const int GetFileNumber( int lineNumber ) const { return lineFileNumbers[lineNumber]; } const std::string &GetFilePath( int lineNumber ) const { return filePaths[GetFileNumber( lineNumber )]; } const std::string &GetFilePathFromFileNumber( int fileNumber ) const { return filePaths[fileNumber]; } int GetFileCounts() const { return (int)filePaths.size(); } int AddFile( const std::string &filePath ) { filePaths.push_back( filePath ); return (int)filePaths.size()-1; } void AddLine( int fileNumber ) { lineFileNumbers.push_back( fileNumber ); } int GetLineCounts() const { return (int)lineFileNumbers.size(); } }; class Text{ protected: char *buffer; int length; public: Text(){ buffer = (char *)calloc( 1, 1 ); length = 0; } Text( const Text &text ) : length( text.length ) { buffer = (char *)malloc( length + 1 ); memcpy( buffer, text.buffer, length ); buffer[length] = 0; } ~Text(){ free( buffer ); } void Clear() { length = 0; } void Add( const std::string &str ) { buffer = (char *)realloc( buffer, length + str.size() + 1 ); lstrcpy( buffer + length, str.c_str() ); length += (int)str.size(); } void Add( const std::vector &str ) { buffer = (char *)realloc( buffer, length + str.size() + 1 ); lstrcpy( buffer + length, &str[0] ); length += (int)str.size(); } bool ReadFile( const std::string &filePath ); static void Text::SlideString(char *buffer, int slide){ char *temp; temp=(char *)malloc(lstrlen(buffer)+1); lstrcpy(temp,buffer); lstrcpy(buffer+slide,temp); free(temp); } }; class BasicSource : public Text { static const std::string generateDirectiveName; IncludedFilesRelation includedFilesRelation; // XMLシリアライズ用 private: friend class boost::serialization::access; BOOST_SERIALIZATION_SPLIT_MEMBER(); template void load(Archive& ar, const unsigned int version) { std::string _buffer; ar & BOOST_SERIALIZATION_NVP( _buffer ); ar & BOOST_SERIALIZATION_NVP( length ); ar & BOOST_SERIALIZATION_NVP( includedFilesRelation ); // 読み込み後の処理 Realloc( length ); for( int i=0; i= 'a' ) ? ( _buffer[i*3] - 'a' + 0x0a ) : ( _buffer[i*3] - '0' ) ) * 0x10; ULONG_PTR l2 = ( _buffer[i*3+1] >= 'a' ) ? ( _buffer[i*3+1] - 'a' + 0x0a ) : ( _buffer[i*3+1] - '0' ); ULONG_PTR l = l1 + l2; buffer[i] = static_cast(l); } buffer[length] = 0; } template void save(Archive& ar, const unsigned int version) const { // 保存準備 char *tempCode = (char *)calloc( (length+1) * 3, 1 ); for( int i=0; iGetLength() ) { Jenga::Throw( "BasicSource bad access" ); } return buffer[2+index]; } std::string cannotIncludePath; int cannotIncludeSourcePos; }; class BasicSources : public std::vector , public Jenga::Common::BoostSerializationSupport { // XMLシリアライズ用 private: virtual const char *RootTagName() const { return "basicSources"; } friend class boost::serialization::access; template void serialize(Archive& ar, const unsigned int version) { ar & boost::serialization::make_nvp("vector_BasicSource", boost::serialization::base_object>(*this)); } }; class SourceCodePosition { std::string objectModuleName; int pos; // XMLシリアライズ用 private: friend class boost::serialization::access; template void serialize(Archive& ar, const unsigned int version) { trace_for_serialize( "serializing - IncludedFilesRelation" ); ar & BOOST_SERIALIZATION_NVP( objectModuleName ); ar & BOOST_SERIALIZATION_NVP( pos ); } public: SourceCodePosition( const std::string &objectModuleName, int pos ) : objectModuleName( objectModuleName ) , pos( pos ) { } SourceCodePosition() : pos( -1 ) { } const std::string &GetObjectModuleName() const { return objectModuleName; } int GetPos() const { return pos; } };