Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:55:12

0001 #ifndef DAVIX_DEPRECATED
0002 #define DAVIX_DEPRECATED
0003 
0004 #include <vector>
0005 #include <string>
0006 #include <utils/davix_types.hpp>
0007 #include <utils/davix_uri.hpp>
0008 
0009 #ifndef __DAVIX_INSIDE__
0010 #error "Only davix.h or davix.hpp should be included."
0011 #endif
0012 
0013 /**
0014   @file deprecated.hpp
0015   @author Devresse Adrien
0016 
0017   @brief Deprecated class / functions of Davix for ABI/ API compatibility
0018 
0019    Each call to one of these function kill a kitten.
0020    Please love kittens and don't use them
0021  */
0022 
0023 #ifndef DOXYGEN_SHOULD_SKIP_THIS
0024 
0025 
0026 
0027 namespace Davix {
0028 
0029 struct HttpCacheTokenInternal;
0030 
0031 
0032 class DAVIX_EXPORT HttpCacheToken
0033 {
0034 public:
0035 
0036     HttpCacheToken();
0037 
0038     HttpCacheToken(const HttpCacheToken & orig);
0039 
0040     virtual ~HttpCacheToken();
0041 
0042     HttpCacheToken & operator=(const HttpCacheToken &);
0043 
0044     const Uri & getrequestUri() const;
0045 
0046 
0047     const Uri & getCachedRedirection() const;
0048 private:
0049     HttpCacheTokenInternal* d_ptr;
0050 
0051     friend struct HttpCacheTokenAccessor;
0052 };
0053 
0054 
0055 class DAVIX_EXPORT FileInfoInterface{
0056 public:
0057     virtual ~FileInfoInterface(){}
0058 
0059     virtual const std::type_info & getType() =0;
0060 
0061     virtual FileInfoInterface* getClone() = 0;
0062 };
0063 
0064 
0065 template <class T>
0066 class DAVIX_EXPORT FileInfo : public FileInfoInterface{
0067 public:
0068     virtual ~FileInfo(){}
0069 
0070     virtual const std::type_info & getType(){
0071         return typeid(*static_cast<T*>(this));
0072     }
0073 
0074     virtual FileInfoInterface* getClone(){
0075         return new T(*static_cast<T*>(this));
0076     }
0077 };
0078 
0079 
0080 
0081 class DAVIX_EXPORT FileInfoSize :
0082         public FileInfo<FileInfoSize>{
0083 public:
0084     FileInfoSize() : size(0){}
0085     FileInfoSize(dav_size_t s) : size(s){}
0086     FileInfoSize(const FileInfoSize & orig) : size(orig.size) {}
0087     virtual ~FileInfoSize(){}
0088     dav_size_t size;
0089 };
0090 
0091 
0092 class DAVIX_EXPORT FileInfoHash :
0093     public FileInfo<FileInfoHash>{
0094 public:
0095     FileInfoHash(const FileInfoHash & orig) : hash(orig.hash), hash_type(orig.hash_type) {}
0096     virtual ~FileInfoHash(){}
0097     std::string hash;
0098     std::string hash_type;
0099 };
0100 
0101 
0102 class DAVIX_EXPORT FileInfoName :
0103     public FileInfo<FileInfoName>{
0104 public:
0105     FileInfoName(const FileInfoName & orig) : name(orig.name){}
0106     virtual ~FileInfoName(){}
0107     std::string name;
0108 };
0109 
0110 
0111 
0112 class DAVIX_EXPORT FileInfoProtocolType :
0113     public FileInfo<FileInfoProtocolType>{
0114 public:
0115     FileInfoProtocolType() : protocol(){}
0116     FileInfoProtocolType(const FileInfoProtocolType & orig) : protocol(orig.protocol){}
0117     FileInfoProtocolType(const std::string & s) : protocol(s){}
0118     virtual ~FileInfoProtocolType(){}
0119     std::string protocol;
0120 };
0121 
0122 
0123 
0124 
0125 typedef std::vector<FileInfoInterface*> Properties;
0126 
0127 
0128 class DAVIX_EXPORT Replica {
0129 public:
0130     Replica() :
0131         uri(),
0132         props(){}
0133     Replica(const Replica & orig) :
0134         uri(orig.uri),
0135         props() {
0136         props.reserve(orig.props.size());
0137         for(Properties::iterator it = props.begin(); it < props.end(); ++it){
0138             props.push_back((*it)->getClone());
0139         }
0140     }
0141 
0142     virtual ~Replica(){
0143         for(Properties::iterator it = props.begin(); it < props.end(); ++it)
0144             delete *it;
0145     }
0146 
0147     Uri uri;
0148     Properties props;
0149 };
0150 
0151 typedef std::deque<Replica> ReplicaVec;
0152 
0153 
0154 
0155 struct HookIntern;
0156 
0157 ///
0158 /// \brief The HookTraits class
0159 ///
0160 ///  Base class for Daivx Hook functions
0161 ///
0162 struct HookTraits{
0163     HookTraits();
0164     virtual ~HookTraits();
0165 
0166     virtual const std::type_info & getType() =0;
0167 
0168     // internal
0169     HookIntern* d_ptr;
0170 };
0171 
0172 
0173 template <class T>
0174 struct Hook: HookTraits{
0175     virtual const std::type_info & getType(){
0176         return typeid(*static_cast<T>(this));
0177     }
0178 };
0179 
0180 class HttpRequest;
0181 
0182 typedef void (*CallbackHeader)(HttpRequest &, const std::string &, std::string &);
0183 
0184 
0185 struct HookSendHeader : public Hook<HookSendHeader>{
0186     CallbackHeader hook;
0187 };
0188 
0189 
0190 struct HookReceiveHeader : public Hook<HookReceiveHeader>{
0191     CallbackHeader hook;
0192 };
0193 
0194 
0195 typedef void (*CallbackRequestExec)(HttpRequest &);
0196 
0197 
0198 
0199 struct HookRequestPreExec : public Hook<HookRequestPreExec>{
0200     CallbackRequestExec hook;
0201 };
0202 
0203 
0204 struct HookRequestPostExec : public Hook<HookRequestPostExec>{
0205     CallbackRequestExec hook;
0206 };
0207 
0208 } // namespace Davix
0209 
0210 
0211 #endif
0212 
0213 #endif