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.10 2006/11/01 16:37:14 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 Sequence &seq);
00035   Result(ResultImpl *impl);
00036   Result(const Result &o);
00037   Result &operator=(const Result &o);
00038   ~Result();
00039 
00041   ResultImpl *operator->();
00042 
00044   const ResultImpl *operator->() const;
00045 
00047   ResultImpl *get();
00048 
00050   const ResultImpl *get() const;
00051 
00053   bool isNull() const;
00054 
00055   EmptyResult* getEmpty() const;
00056   
00057 private:
00058   ResultImpl *_impl;
00059 
00060   static EmptyResult _empty;
00061 };
00062 
00063 inline bool Result::isNull() const
00064 {
00065   return _impl == 0;
00066 }
00067 
00068 inline ResultImpl *Result::get()
00069 {
00070   if(_impl) return _impl;
00071   return getEmpty();
00072 }
00073 
00074 inline const ResultImpl *Result::get() const
00075 {
00076   if(_impl) return _impl;
00077   return getEmpty();
00078 }
00079 
00080 inline ResultImpl *Result::operator->()
00081 {
00082   return get();
00083 }
00084 
00085 inline const ResultImpl *Result::operator->() const
00086 {
00087   return get();
00088 }
00089 
00090 inline Result &Result::operator=(const Result &o)
00091 {
00092   if(o._impl != _impl) {
00093     if(_impl) _impl->decrementRefCount();
00094     _impl = o._impl;
00095     if(_impl) _impl->incrementRefCount();
00096   }
00097   return *this;
00098 }
00099 
00100 #endif

Generated on Mon Feb 12 16:52:06 2007 for XQilla Simple API by  doxygen 1.4.6