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

src/sql/wsqlreferencedkey.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 "wsqlreferencedkey.h"
00021 #include "wsqldatatype.h"
00022 namespace WSql{
00033 WSqlReferencedKey::WSqlReferencedKey( const WSql::WSqlForeignKey& fk )
00034 {
00035     _referingKey=fk;
00036 }
00037     
00038 WSqlReferencedKey::WSqlReferencedKey( const WSqlReferencedKey& other )
00039 {
00040     _referingKey=other._referingKey;
00041 }
00042 
00043 WSqlReferencedKey::~WSqlReferencedKey()
00044 {
00045 }
00046 
00047 WSqlReferencedKey& WSqlReferencedKey::operator=( const WSqlReferencedKey & other )
00048 {
00049     _referingKey=other._referingKey;
00050     return *this;
00051 }
00052 
00053 bool WSqlReferencedKey::operator==( const WSqlReferencedKey& other ) const
00054 {
00055     return _referingKey == other._referingKey;
00056 }
00057 
00058 std::string WSqlReferencedKey::referingClassName() const
00059 {
00060     return WSqlDataType::tableNameToClass(_referingKey.tableName());
00061 }
00062 std::string WSqlReferencedKey::referingClassNamePlural() const
00063 {
00064     return WSqlDataType::toPlural(referingClassName());
00065 }
00066 void WSqlReferencedKey::dump() const
00067 {
00068     std::cerr << "**************  Referenced Key: **************" << std::endl;
00069     std::cerr << "columnName()" << columnName() << std::endl;
00070     std::cerr << "tableName()" << tableName() << std::endl;
00071     std::cerr << "schemaName()" << schemaName() << std::endl;
00072     std::cerr << "referingKeyName()" << referingKeyName() << std::endl;
00073     std::cerr << "referingColumnName()" << referingColumnName() << std::endl;
00074     std::cerr << "referingTableName()" << referingTableName() << std::endl;
00075     std::cerr << "referingSchemaName()" << referingSchemaName() << std::endl;
00076     std::cerr << "referingClassName()" << referingClassName() << std::endl;
00077     std::cerr << "referingClassNamePlural()" << referingClassNamePlural() << std::endl;    
00078     std::cerr << "*****************************************" << std::endl;
00079     
00080 }
00081 
00082 }//namespace WSql
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Defines