WORM 0.2
A C++ DAL/ORM code generation framework

src/orm/wormcodetemplate.cpp

Go to the documentation of this file.
00001 /*
00002     WORM - a DAL/ORM code generation framework
00003     Copyright (C) 2011  Erik Winn <sidewalksoftware@gmail.com>
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, see <http://www.gnu.org/licenses/>.
00017 */
00018 
00019 
00020 #include "wormcodetemplate.h"
00021 
00022 namespace WSql {
00023     
00024 WormCodeTemplate::WormCodeTemplate()
00025 {
00026     _type=Unknown;
00027 }
00028 
00029 WormCodeTemplate::WormCodeTemplate( const WormCodeTemplate& other )
00030 {
00031     _type=other._type;
00032     _content=other._content;
00033     _uri=other._uri;
00034 }
00035 
00036 WormCodeTemplate::~WormCodeTemplate()
00037 {
00038 
00039 }
00040 
00041 WormCodeTemplate& WormCodeTemplate::operator=( const WormCodeTemplate & other )
00042 {
00043     _type=other._type;
00044     _content=other._content;
00045     _uri=other._uri;
00046     return *this;
00047 }
00048 
00049 bool WormCodeTemplate::operator==( const WormCodeTemplate& other ) const
00050 {
00051     return(_type == other._type
00052         && _content.compare(other._content) == 0
00053         && _uri.compare(other._uri) == 0
00054     );
00055 }
00063 void WormCodeTemplate::setUri( const std::string& uri )
00064 {
00065     if(uri.empty())
00066         return;
00067     _uri=uri;
00068     std::string tmp;
00069     size_t pos = uri.rfind('/'); 
00070     if(std::string::npos == pos)
00071     {
00072         pos = uri.rfind('\\');
00073         if(std::string::npos == pos)
00074             tmp = uri;
00075     }
00076     else
00077         tmp = uri.substr(pos+1);
00078     
00079     if(tmp.compare("class_declaration.tpl") == 0)
00080         _type=ClassDeclaration;
00081     else if(tmp.compare("class_declaration_base.tpl") == 0)
00082         _type=ClassDeclarationBase;
00083     else if(tmp.compare("class_definition.tpl") == 0)
00084         _type=ClassDefinition;
00085     else if(tmp.compare("class_definition_base.tpl") == 0)
00086         _type=ClassDefinitionBase;
00087     else if(tmp.compare("edit_view_declaration.tpl") == 0)
00088         _type=EditViewDeclaration;
00089     else if(tmp.compare("edit_view_declaration_base.tpl") == 0)
00090         _type=EditViewDeclarationBase;
00091     else if(tmp.compare("edit_view_definition.tpl") == 0)
00092         _type=EditViewDefinition;
00093     else if(tmp.compare("edit_view_definition_base.tpl") == 0)
00094         _type=EditViewDefinitionBase;
00095     else if(tmp.compare("list_view_declaration.tpl") == 0)
00096         _type=ListViewDeclaration;
00097     else if(tmp.compare("list_view_declaration_base.tpl") == 0)
00098         _type=ListViewDeclarationBase;
00099     else if(tmp.compare("list_view_definition.tpl") == 0)
00100         _type=ListViewDefinition;
00101     else if(tmp.compare("list_view_definition_base.tpl") == 0)
00102         _type=ListViewDefinitionBase;
00103     else 
00104         _type=Unknown;
00105 }
00106 
00107 } //namespace WSql
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines