SourceForge.net Logo

Result.hpp

Go to the documentation of this file.
00001 /*
00002  * Copyright (c) 2001-2006
00003  *     DecisionSoft Limited. All rights reserved.
00004  * Copyright (c) 2004-2006
00005  *     Progress Software Corporation. All rights reserved.
00006  * Copyright (c) 2004-2006
00007  *     Oracle. All rights reserved.
00008  *
00009  * See the file LICENSE for redistribution information.
00010  *
00011  * $Id: Result.hpp,v 1.11 2007/07/10 16:28:58 jpcs Exp $
00012  */
00013 
00014 #ifndef _RESULT_HPP
00015 #define _RESULT_HPP
00016 
00017 #include <string>
00018 #include <xercesc/util/XercesDefs.hpp>
00019 
00020 #include <xqilla/framework/XQillaExport.hpp>
00021 #include <xqilla/items/Item.hpp>
00022 #include <xqilla/runtime/ResultImpl.hpp>
00023 #include <xqilla/runtime/EmptyResult.hpp>
00024 
00025 class Sequence;
00026 class SequenceType;
00027 class DynamicContext;
00028 class StaticType;
00029 
00031 class XQILLA_API Result
00032 {
00033 public:
00034   Result(const Item::Ptr &item);
00035   Result(const Sequence &seq);
00036   Result(ResultImpl *impl);
00037   Result(const Result &o);
00038   Result &operator=(const Result &o);
00039   ~Result();
00040 
00042   ResultImpl *operator->();
00043 
00045   const ResultImpl *operator->() const;
00046 
00048   ResultImpl *get();
00049 
00051   const ResultImpl *get() const;
00052 
00054   bool isNull() const;
00055 
00056   EmptyResult* getEmpty() const;
00057   
00058 private:
00059   ResultImpl *_impl;
00060 
00061   static EmptyResult _empty;
00062 };
00063 
00064 inline bool Result::isNull() const
00065 {
00066   return _impl == 0;
00067 }
00068 
00069 inline ResultImpl *Result::get()
00070 {
00071   if(_impl) return _impl;
00072   return getEmpty();
00073 }
00074 
00075 inline const ResultImpl *Result::get() const
00076 {
00077   if(_impl) return _impl;
00078   return getEmpty();
00079 }
00080 
00081 inline ResultImpl *Result::operator->()
00082 {
00083   return get();
00084 }
00085 
00086 inline const ResultImpl *Result::operator->() const
00087 {
00088   return get();
00089 }
00090 
00091 inline Result &Result::operator=(const Result &o)
00092 {
00093   if(o._impl != _impl) {
00094     if(_impl) _impl->decrementRefCount();
00095     _impl = o._impl;
00096     if(_impl) _impl->incrementRefCount();
00097   }
00098   return *this;
00099 }
00100 
00101 #endif

Generated on Fri Aug 31 14:37:35 2007 for XQilla Simple API by  doxygen 1.5.1