Scopira  20080306
url.h
1 
2 /*
3  * Copyright (c) 2004 National Research Council
4  *
5  * All rights reserved.
6  *
7  * This material is confidential and proprietary information of
8  * National Research Council Canada ("Confidential Information").
9  * This Confidential Information may only be used and reproduced
10  * in accordance with the terms of the license agreement.
11  *
12  */
13 
14 #ifndef __INLUCDED__SCOPIRA_TOOL_URL_H_
15 #define __INLUCDED__SCOPIRA_TOOL_URL_H_
16 
17 #include <string>
18 
19 #include <scopira/tool/export.h>
20 
21 namespace scopira
22 {
23  namespace tool
24  {
25  class url;
26 
27  class itflow_i; //fwd
28  class otflow_i; //fwd
29  class oflow_i; //fwd
30  }
31 }
32 
46 {
47  protected:
49  std::string dm_full;
50 
51  // the various components of the url
52 
54  std::string::size_type dm_proto_begin, dm_proto_end;
56  std::string::size_type dm_host_begin, dm_host_end;
58  int dm_port;
60  std::string::size_type dm_file_begin, dm_file_end;
61 
62  public:
67  SCOPIRA_EXPORT url(void);
77  SCOPIRA_EXPORT url(const std::string &fullurl);
83  SCOPIRA_EXPORT url(const std::string &hostname, int port);
88  SCOPIRA_EXPORT url(const std::string &proto, const std::string &hostname, int port, const std::string &filename);
93  SCOPIRA_EXPORT ~url();
94 
99  SCOPIRA_EXPORT bool load(scopira::tool::itflow_i& in);
104  SCOPIRA_EXPORT void save(scopira::tool::otflow_i& out) const;
105 
110  SCOPIRA_EXPORT void clear_url(void);
111 
117  SCOPIRA_EXPORT bool set_url(const std::string &fullurl);
123  SCOPIRA_EXPORT void set_url(const std::string &hostname, int port);
128  SCOPIRA_EXPORT void set_url(const std::string &proto, const std::string &hostname, int port, const std::string &filename);
129 
134  const std::string & get_url(void) const { return dm_full; }
135 
140  SCOPIRA_EXPORT std::string get_proto(void) const;
145  SCOPIRA_EXPORT std::string get_hostname(void) const;
151  int get_port(void) const { return dm_port; }
156  SCOPIRA_EXPORT std::string get_filename(void) const;
157 };
158 
159 SCOPIRA_EXPORT scopira::tool::oflow_i& operator<<(scopira::tool::oflow_i& o, const scopira::tool::url& u);
160 
161 #endif
162 
int dm_port
port (0 for non explicitly provided)
Definition: url.h:58
bool load(scopira::tool::itflow_i &in)
std::string::size_type dm_host_begin
hostname (may be empty)
Definition: url.h:56
std::string dm_full
the full url
Definition: url.h:49
Definition: archiveflow.h:20
Definition: flow.h:212
void save(scopira::tool::otflow_i &out) const
Definition: flow.h:281
Definition: url.h:45
std::string::size_type dm_file_begin
filename (after the directory path)
Definition: url.h:60
std::string get_filename(void) const
std::string::size_type dm_proto_begin
protocol (never empty)
Definition: url.h:54
int get_port(void) const
Definition: url.h:151
const std::string & get_url(void) const
Definition: url.h:134
std::string get_proto(void) const
void clear_url(void)
std::string get_hostname(void) const
bool set_url(const std::string &fullurl)
Definition: flow.h:159