#include <otbXMLMetadataSupplier.h>
|
std::string | GetFirstMetadataValue (std::string const &paths, bool &hasValue) const |
|
std::string | GetMetadataValue (std::string const &path, bool &hasValue, int band=1) const override |
|
XMLMetadataSupplier & | operator= (const XMLMetadataSupplier &)=delete |
|
| XMLMetadataSupplier (const std::string &) |
|
| XMLMetadataSupplier (const XMLMetadataSupplier &)=delete |
|
template<> |
bool | GetAs (bool const &defaultValue, std::string const &path, int band) const |
|
template<typename T > |
T | GetAs (std::string const &path, int band=-1) const |
|
template<typename T > |
T | GetAs (T const &defaultValue, std::string const &path, int band=-1) const |
|
template<typename T > |
std::vector< T > | GetAsVector (std::string const &path, char sep=' ', int size=-1, int band=-1) const |
|
virtual std::vector< std::string > | GetResourceFiles () const |
|
bool | HasValue (std::string const &path, int band=-1) const |
|
virtual | ~MetadataSupplierInterface ()=default |
|
std::string | m_FileName |
|
char ** | m_MetadataDic = nullptr |
|
template<typename T > |
T | GetFirstAs (std::string const &path) const |
|
std::string | GetResourceFile (std::string const &s="") const override |
|
int | GetNbBands () const override |
|
unsigned int | GetNumberOf (std::string const &path) const override |
|
unsigned int | GetAttributId (std::string const &path, std::string const &value) const override |
|
std::string | PrintSelf () const |
|
| ~XMLMetadataSupplier ()=default |
|
virtual char ** | ReadXMLToList (CPLXMLNode *psNode, char **papszList, const char *pszName="") |
|
std::vector< std::string > | FetchPartialNameValueMultiple (char **papszStrList, const char *pszName) const |
|
std::vector< std::string > | FetchPartialNameValueMultiple (const std::vector< std::string > &StringVector, const std::string &Name) const |
|
std::vector< std::string > | GetAllStartWith (char **papszStrList, const char *pszName) const |
|
|
const std::array< std::string, 3 > | FALSES = {"0", "false", "False"} |
|
const std::array< std::string, 3 > | TRUES = {"1", "true", "True"} |
|
Class to access metadata information in a XML file.
Definition at line 41 of file otbXMLMetadataSupplier.h.
◆ XMLMetadataSupplier() [1/2]
otb::XMLMetadataSupplier::XMLMetadataSupplier |
( |
const std::string & |
| ) |
|
◆ XMLMetadataSupplier() [2/2]
◆ ~XMLMetadataSupplier()
otb::XMLMetadataSupplier::~XMLMetadataSupplier |
( |
| ) |
|
|
default |
◆ FetchPartialNameValueMultiple() [1/2]
std::vector<std::string> otb::XMLMetadataSupplier::FetchPartialNameValueMultiple |
( |
char ** |
papszStrList, |
|
|
const char * |
pszName |
|
) |
| const |
|
protected |
In a StringList of “Name=Value” pairs, look for the values associated with a name containing the specified string.
- Parameters
-
papszStrList | A StringList that will be searched |
pszName | A string that will be looked for in the keys |
- Returns
- A StringList containing only the pairs from papszStrList whose key contain pszName
◆ FetchPartialNameValueMultiple() [2/2]
std::vector<std::string> otb::XMLMetadataSupplier::FetchPartialNameValueMultiple |
( |
const std::vector< std::string > & |
StringVector, |
|
|
const std::string & |
Name |
|
) |
| const |
|
protected |
In a StringList of “Name=Value” pairs, look for the values associated with a name containing the specified string.
- Parameters
-
StringVector | A std::vector of std::string that will be searched |
Name | A std::string that will be looked for in the keys |
- Returns
- A std::vector of std::string containing only the pairs from StringVector whose key contain Name
◆ GetAllStartWith()
std::vector<std::string> otb::XMLMetadataSupplier::GetAllStartWith |
( |
char ** |
papszStrList, |
|
|
const char * |
pszName |
|
) |
| const |
|
protected |
In a StringList of “Name=Value” pairs, look for the keys equal to the specified string.
- Parameters
-
papszStrList | A StringList that will be searched |
pszName | A string that will be looked for at the beginning of the keys |
- Returns
- A StringList containing only the pairs from papszStrList whose key start with pszName
◆ GetAttributId()
unsigned int otb::XMLMetadataSupplier::GetAttributId |
( |
std::string const & |
path, |
|
|
std::string const & |
value |
|
) |
| const |
|
overridevirtual |
◆ GetFirstAs()
template<typename T >
T otb::XMLMetadataSupplier::GetFirstAs |
( |
std::string const & |
path | ) |
const |
|
inline |
Get the metadata value corresponding to a given path converted to the given type.
This method can look for a value in a list, using the _# jocker. For example, looking for "value" in a dictionary like this : foo_1.bar=42 foo_1.doo=99 foo_2.value=8 One can specify this path : foo_#.value, the method will then return 8.
- Parameters
-
path | The path to look for. |
- Returns
- The value corresponding to path. @raises otb::Error if path not found
Definition at line 83 of file otbXMLMetadataSupplier.h.
References otbGenericExceptionMacro.
◆ GetFirstMetadataValue()
std::string otb::XMLMetadataSupplier::GetFirstMetadataValue |
( |
std::string const & |
paths, |
|
|
bool & |
hasValue |
|
) |
| const |
Get the first metadata value corresponding to a given path.
- Parameters
-
path | The path to look for |
hasValue | True if path is found |
- Returns
- The value corresponding to path. Empty string if not found.
◆ GetMetadataValue()
std::string otb::XMLMetadataSupplier::GetMetadataValue |
( |
std::string const & |
path, |
|
|
bool & |
hasValue, |
|
|
int |
band = 1 |
|
) |
| const |
|
overridevirtual |
Get the metadata value corresponding to a given path.
- Parameters
-
path | The path to look for |
hasValue | True if path is found |
band | not used |
- Returns
- The value corresponding to path. Empty string if not found.
Implements otb::MetadataSupplierInterface.
◆ GetNbBands()
int otb::XMLMetadataSupplier::GetNbBands |
( |
| ) |
const |
|
overridevirtual |
◆ GetNumberOf()
unsigned int otb::XMLMetadataSupplier::GetNumberOf |
( |
std::string const & |
path | ) |
const |
|
overridevirtual |
◆ GetResourceFile()
std::string otb::XMLMetadataSupplier::GetResourceFile |
( |
std::string const & |
s = "" | ) |
const |
|
overridevirtual |
◆ operator=()
◆ PrintSelf()
std::string otb::XMLMetadataSupplier::PrintSelf |
( |
| ) |
const |
Writes the content of the XML file into a string.
- Returns
- A std::string
◆ ReadXMLToList()
virtual char** otb::XMLMetadataSupplier::ReadXMLToList |
( |
CPLXMLNode * |
psNode, |
|
|
char ** |
papszList, |
|
|
const char * |
pszName = "" |
|
) |
| |
|
protectedvirtual |
ReadXMLToList Transform xml to list of NULL terminated name=value strings.
- Parameters
-
psNode | A xml node to process |
papszList | A list to fill with name=value strings |
pszName | A name of parent node. For root xml node should be empty. If name is not empty, the sibling nodes will not proceed |
- Returns
- An input list filled with values
This method originates from a work by GDAL in the class GDALMDReaderBase.
◆ m_FileName
std::string otb::XMLMetadataSupplier::m_FileName |
|
private |
◆ m_MetadataDic
char** otb::XMLMetadataSupplier::m_MetadataDic = nullptr |
|
private |
The documentation for this class was generated from the following file: