src/Core/Editors/ChunkImporter.h

00001 /***************************************************************************
00002  *   Copyright (C) 2008 by Sverre Rabbelier                                *
00003  *   sverre@rabbelier.nl                                                   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 3 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #pragma once
00022 
00023 #include "SavableHeaders.h"
00024 #include "SavableTypes.h"
00025 
00026 #include <stack>
00027 
00028 class ChunkImporter;
00029 typedef SmartPtr<ChunkImporter> ChunkImporterPtr;
00030         
00031 class ChunkImporter 
00032 {
00033         class MyDetail;
00034         typedef SmartPtr<MyDetail> MyDetailPtr;
00035         typedef std::vector<MyDetailPtr> MyDetailVector; // not called 'Details' to prevent confusion with db::Details
00036         private:
00037                 class MyDetail
00038                 {
00039                         public:
00040                                 MyDetail() { }
00041                                 ~MyDetail() { }
00042                                 
00043                                 void append(const std::string& line) { m_description.push_back(line); }
00044                                 void addDetail(MyDetailPtr detail) { m_details.push_back(detail); }
00045                                 
00046                                 const std::vector<std::string>& getDescription() { return m_description; }
00047                                 const MyDetailVector& getDetails() { return m_details; }
00048                                 
00049                                 std::string toString();
00050                                 void apply(mud::DetailPtr detail);
00051                                 
00052                         private:
00053                                 std::vector<std::string> m_description;
00054                                 MyDetailVector m_details;
00055                 };
00056                 
00057         public:
00058                 ChunkImporter(const std::string& input);
00059                 
00060                 ~ChunkImporter();
00061                 
00062                 void Apply(mud::ChunkPtr chunk);
00063                 const std::string& getResult();
00064 
00065         private:
00066                 ChunkImporter(const ChunkImporter& rhs);
00067                 ChunkImporter& operator=(const ChunkImporter& rhs);
00068                 
00069                 void Parse();
00070                 
00071                 // mud::ChunkPtr m_chunk;
00072                 std::string m_input;
00073                 
00074                 std::vector<std::string> m_description;
00075                 
00076                 MyDetailPtr m_result;
00077                 std::string m_resultstring;
00078 };

Generated for UnsignedByte by  doxygen 1.5.3
SourceForge.net Logo