MetadataURL.h
Aller à la documentation de ce fichier.
1 /*
2  * Copyright © (2011-2013) Institut national de l'information
3  * géographique et forestière
4  *
5  * Géoportail SAV <contact.geoservices@ign.fr>
6  *
7  * This software is a computer program whose purpose is to publish geographic
8  * data using OGC WMS and WMTS protocol.
9  *
10  * This software is governed by the CeCILL-C license under French law and
11  * abiding by the rules of distribution of free software. You can use,
12  * modify and/ or redistribute the software under the terms of the CeCILL-C
13  * license as circulated by CEA, CNRS and INRIA at the following URL
14  * "http://www.cecill.info".
15  *
16  * As a counterpart to the access to the source code and rights to copy,
17  * modify and redistribute granted by the license, users are provided only
18  * with a limited warranty and the software's author, the holder of the
19  * economic rights, and the successive licensors have only limited
20  * liability.
21  *
22  * In this respect, the user's attention is drawn to the risks associated
23  * with loading, using, modifying and/or developing or reproducing the
24  * software by the user in light of its specific status of free software,
25  * that may mean that it is complicated to manipulate, and that also
26  * therefore means that it is reserved for developers and experienced
27  * professionals having in-depth computer knowledge. Users are therefore
28  * encouraged to load and test the software's suitability as regards their
29  * requirements in conditions enabling the security of their systems and/or
30  * data to be ensured and, more generally, to use and operate it in the
31  * same conditions as regards security.
32  *
33  * The fact that you are presently reading this means that you have had
34  *
35  * knowledge of the CeCILL-C license and that you accept its terms.
36  */
37 
46 class MetadataURL;
47 
48 #ifndef METADATAURL_H
49 #define METADATAURL_H
50 
51 #include <rok4/utils/ResourceLocator.h>
52 
62 class MetadataURL : public ResourceLocator {
63 private:
68  std::string type;
69 
70 public:
79  MetadataURL ( json11::Json doc ) : ResourceLocator () {
80 
81  if (! doc["format"].is_string()) {
82  missingField = "format";
83  return;
84  }
85  format = doc["format"].string_value();
86 
87  if (! doc["url"].is_string()) {
88  missingField = "url";
89  return;
90  }
91  href = doc["url"].string_value();
92 
93  if (! doc["type"].is_string()) {
94  missingField = "type";
95  return;
96  }
97  type = doc["type"].string_value();
98  };
99 
100  std::string getTmsXml() {
101  return "<Metadata type=\"" + type + "\" mime-type=\"" + format + "\" href=\"" + href + "\" />\n";
102  }
103 
114  MetadataURL ( const MetadataURL & origMtdUrl ) : ResourceLocator ( origMtdUrl ) {
115  href = origMtdUrl.href;
116  format = origMtdUrl.format;
117  type = origMtdUrl.type;
118  };
125  MetadataURL& operator= ( MetadataURL const& other ) {
126  if ( this != &other ) {
127  ResourceLocator::operator= ( other );
128  this->type = other.type;
129  }
130  return *this;
131  };
140  bool operator== ( const MetadataURL& other ) const {
141  return ( this->type.compare ( other.type ) == 0
142  && this->getFormat().compare ( other.getFormat() ) == 0
143  && this->getHRef().compare ( other.getHRef() ) == 0 );
144  };
153  bool operator!= ( const MetadataURL& other ) const {
154  return ! ( *this == other );
155  };
156 
165  inline std::string getType() {
166  return type;
167  }
168 
175  virtual ~MetadataURL() {};
176 };
177 
178 #endif // METADATAURL_H
MetadataURL::MetadataURL
MetadataURL(json11::Json doc)
Crée un MetadataURL à partir d'un élément JSON.
Definition: MetadataURL.h:79
MetadataURL::operator=
MetadataURL & operator=(MetadataURL const &other)
Affectation.
Definition: MetadataURL.h:125
MetadataURL::operator!=
bool operator!=(const MetadataURL &other) const
Test d'inégalite de 2 MetadataURLs.
Definition: MetadataURL.h:153
MetadataURL::MetadataURL
MetadataURL(const MetadataURL &origMtdUrl)
Constructeur de copie.
Definition: MetadataURL.h:114
MetadataURL::operator==
bool operator==(const MetadataURL &other) const
Test d'egalite de 2 MetadataURLs.
Definition: MetadataURL.h:140
MetadataURL::getType
std::string getType()
Retourne le type de la méta donnée.
Definition: MetadataURL.h:165
MetadataURL::~MetadataURL
virtual ~MetadataURL()
Destructeur par défaut.
Definition: MetadataURL.h:175
MetadataURL
Gestion des éléments de métadonnées des documents de capacités.
Definition: MetadataURL.h:62