This is a very very simple database software I am creating.
Code:#include <string>
#include <list>
class BUBBELdb {
public:
std::string query; // our query string
int ParseQuery( std::string query )
{
(*this).query = query;
std:: list< std::string > keywords;
/**
I was going to make a totally different header file for these keywords ( using #define ), but what the heck.
*/
// --- List keyword types
keywords.push_back("GET"); // To grab columns from tables
keywords.push_back("FROM"); // To grab tables
keywords.push_back("JOIN"); // To Join other tables
keywords.push_back("WHERE"); // To find if a certain column contains a certain value
keywords.push_back("SET"); // To set columns to certain values
keywords.push_back("UNION"); // To cluster our GET clauses
// --- end List keyword types
for ( int i = keywords.front(); i<keywords.back();/* .end() doesn't work either. */ i++ )
{
if ( keywords[i].find(keywords[i].c_str(), NULL ) )
{
return 1;
}
}
return 0;
}
Errors:
Most of this seems to be complaining about operators, so should I operator overload it?Code:1>------ Build started: Project: database, Configuration: Debug Win32 ------
1>Compiling...
1>main.cpp
1>main.h(41) : error C2440: 'initializing' : cannot convert from 'std::basic_string<_Elem,_Traits,_Ax>' to 'int'
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1> No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
1>main.h(41) : error C2784: 'bool std::operator <(const std::list<_Ty,_Ax> &,const std::list<_Ty,_Ax> &)' : could not deduce template argument for 'const std::list<_Ty,_Ax> &' from 'int'
1> c:\program files\microsoft visual studio 9.0\vc\include\list(1310) : see declaration of 'std::operator <'
1>main.h(41) : error C2784: 'bool std::operator <(const std::basic_string<_Elem,_Traits,_Alloc> &,const _Elem *)' : could not deduce template argument for 'const std::basic_string<_Elem,_Traits,_Alloc> &' from 'int'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(150) : see declaration of 'std::operator <'
1>main.h(41) : error C2784: 'bool std::operator <(const _Elem *,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'const _Elem *' from 'int'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(140) : see declaration of 'std::operator <'
1>main.h(41) : error C2784: 'bool std::operator <(const std::basic_string<_Elem,_Traits,_Alloc> &,const std::basic_string<_Elem,_Traits,_Alloc> &)' : could not deduce template argument for 'const std::basic_string<_Elem,_Traits,_Alloc> &' from 'int'
1> c:\program files\microsoft visual studio 9.0\vc\include\string(130) : see declaration of 'std::operator <'
1>main.h(41) : error C2784: 'bool std::operator <(const std::reverse_iterator<_RanIt> &,const std::reverse_iterator<_RanIt2> &)' : could not deduce template argument for 'const std::reverse_iterator<_RanIt> &' from 'int'
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(2236) : see declaration of 'std::operator <'
1>main.h(41) : error C2784: 'bool std::operator <(const std::_Revranit<_RanIt,_Base> &,const std::_Revranit<_RanIt2,_Base2> &)' : could not deduce template argument for 'const std::_Revranit<_RanIt,_Base> &' from 'int'
1> c:\program files\microsoft visual studio 9.0\vc\include\xutility(2046) : see declaration of 'std::operator <'
1>main.h(41) : error C2784: 'bool std::operator <(const std::pair<_Ty1,_Ty2> &,const std::pair<_Ty1,_Ty2> &)' : could not deduce template argument for 'const std::pair<_Ty1,_Ty2> &' from 'int'
1> c:\program files\microsoft visual studio 9.0\vc\include\utility(84) : see declaration of 'std::operator <'
1>main.h(41) : error C2677: binary '<' : no global operator found which takes type 'std::basic_string<_Elem,_Traits,_Ax>' (or there is no acceptable conversion)
1> with
1> [
1> _Elem=char,
1> _Traits=std::char_traits<char>,
1> _Ax=std::allocator<char>
1> ]
1>main.h(44) : error C2676: binary '[' : 'std::list<_Ty>' does not define this operator or a conversion to a type acceptable to the predefined operator
1> with
1> [
1> _Ty=std::string
1> ]
1>main.h(44) : error C2228: left of '.find' must have class/struct/union
1>main.h(44) : error C2676: binary '[' : 'std::list<_Ty>' does not define this operator or a conversion to a type acceptable to the predefined operator
1> with
1> [
1> _Ty=std::string
1> ]
1>main.h(44) : error C2228: left of '.c_str' must have class/struct/union
1>Build log was saved at "file://Debug\BuildLog.htm"
1>database - 13 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========