GammaLib  2.1.0.dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
GUrl.hpp
Go to the documentation of this file.
1 /***************************************************************************
2  * GUrl.hpp - Abstract URL base class *
3  * ----------------------------------------------------------------------- *
4  * copyright (C) 2013-2014 by Juergen Knoedlseder *
5  * ----------------------------------------------------------------------- *
6  * *
7  * This program is free software: you can redistribute it and/or modify *
8  * it under the terms of the GNU General Public License as published by *
9  * the Free Software Foundation, either version 3 of the License, or *
10  * (at your option) any later version. *
11  * *
12  * This program is distributed in the hope that it will be useful, *
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15  * GNU General Public License for more details. *
16  * *
17  * You should have received a copy of the GNU General Public License *
18  * along with this program. If not, see <http://www.gnu.org/licenses/>. *
19  * *
20  ***************************************************************************/
21 /**
22  * @file GUrl.hpp
23  * @brief Abstract URL base class interface definition
24  * @author Juergen Knoedlseder
25  */
26 
27 #ifndef GURL_HPP
28 #define GURL_HPP
29 
30 /* __ Includes ___________________________________________________________ */
31 #include <string>
32 #include "GBase.hpp"
33 
34 
35 /***********************************************************************//**
36  * @class GUrl
37  *
38  * @brief Abstract URL base class
39  *
40  * This class defines the abstract interface for all URL classes. The URL
41  * classes implement handling of various URL types through a standard
42  * interface. This allows to develop URL independent code.
43  ***************************************************************************/
44 class GUrl : public GBase {
45 
46 public:
47  // Constructors and destructors
48  GUrl(void);
49  GUrl(const GUrl& url);
50  virtual ~GUrl(void);
51 
52  // Operators
53  GUrl& operator=(const GUrl& url);
54 
55  // Pure virtual methods
56  virtual void clear(void) = 0;
57  virtual GUrl* clone(void) const = 0;
58  virtual std::string classname(void) const = 0;
59  virtual void open(const std::string& url, const std::string& mode) = 0;
60  virtual void close(void) = 0;
61  virtual int read(void* buffer, const int& nbyte) = 0;
62  virtual int write(const void* buffer, const int& nbyte) = 0;
63  virtual int get_char(void) const = 0;
64  virtual void put_char(const int& character) = 0;
65  virtual void scanf(const char* format, ...) = 0;
66  virtual void printf(const char* format, ...) = 0;
67  virtual std::string print(const GChatter& chatter = NORMAL) const = 0;
68 
69 protected:
70  // Protected methods
71  void init_members(void);
72  void copy_members(const GUrl& url);
73  void free_members(void);
74 
75 };
76 
77 #endif /* GURL_HPP */
virtual std::string print(const GChatter &chatter=NORMAL) const =0
Print content of object.
virtual void close(void)=0
virtual void scanf(const char *format,...)=0
Definition of interface for all GammaLib classes.
virtual ~GUrl(void)
Destructor.
Definition: GUrl.cpp:82
GUrl & operator=(const GUrl &url)
Assignment operator.
Definition: GUrl.cpp:104
virtual int read(void *buffer, const int &nbyte)=0
virtual void put_char(const int &character)=0
Abstract URL base class.
Definition: GUrl.hpp:44
virtual int write(const void *buffer, const int &nbyte)=0
Interface class for all GammaLib classes.
Definition: GBase.hpp:52
GChatter
Definition: GTypemaps.hpp:33
void free_members(void)
Delete class members.
Definition: GUrl.cpp:163
GUrl(void)
Void constructor.
Definition: GUrl.cpp:51
virtual void printf(const char *format,...)=0
void copy_members(const GUrl &url)
Copy class members.
Definition: GUrl.cpp:153
virtual void clear(void)=0
Clear object.
virtual int get_char(void) const =0
virtual void open(const std::string &url, const std::string &mode)=0
virtual GUrl * clone(void) const =0
Clones object.
virtual std::string classname(void) const =0
Return class name.
void init_members(void)
Initialise class members.
Definition: GUrl.cpp:141