1 /*------------------------------------------------------------------------------
 2 Name:      Query.cpp
 3 Project:   xmlBlaster.org
 4 Copyright: xmlBlaster.org, see xmlBlaster-LICENSE file
 5 Comment:   Holding a query string and a prepared query object. 
 6 ------------------------------------------------------------------------------*/
 7 
 8 /**
 9  * Little container which holds a <filter> query string. 
10  * For better performance you can preparse the query string and
11  * store your query object here as well (see example in GnuRegexFilter).
12  * @see org.xmlBlaster.engine.mime.regex.GnuRegexFilter
13  */
14 
15 # include <util/qos/Query.h>
16 #include <util/Global.h>
17 
18 using namespace std;
19 
20 namespace org { namespace xmlBlaster { namespace util { namespace qos {
21 
22 Query::Query(Global& global, const string& query)
23    : ME("Query"), global_(global)
24 {
25    query_ = query;
26    preparedQuery_ = NULL;
27 }
28 
29 Query::Query(const Query& query)
30    : ME(query.ME), global_(query.global_)
31 {
32    preparedQuery_ = query.preparedQuery_;
33    query_         = query.query_;
34 }
35 
36 Query& Query::operator =(const Query& query)
37 {
38    preparedQuery_ = query.preparedQuery_;
39    query_         = query.query_;
40    return *this;
41 }
42  
43 string Query::getQuery()
44 {
45    return query_;
46 }
47 
48 void Query::setPreparedQuery(void* preparedQuery, size_t /*size*/)
49 {
50    // here a copy should be done ...
51    preparedQuery_ = preparedQuery;
52 }
53 
54 void* Query::getPreparedQuery()
55 {
56    return preparedQuery_;
57 }
58 
59 string Query::toString()
60 {
61    return query_;
62 }
63 
64 }}}} // namespace


syntax highlighted by Code2HTML, v. 0.9.1