GDAL

gdal_majorobject.h
1/******************************************************************************
2 *
3 * Name: gdal_majorobject.h
4 * Project: GDAL Core
5 * Purpose: Declaration of GDALMajorObject class
6 * Author: Frank Warmerdam, warmerdam@pobox.com
7 *
8 ******************************************************************************
9 * Copyright (c) 1998, Frank Warmerdam
10 * Copyright (c) 2007-2014, Even Rouault <even dot rouault at spatialys.com>
11 *
12 * SPDX-License-Identifier: MIT
13 ****************************************************************************/
14
15#ifndef GDALMAJOROBJECT_H_INCLUDED
16#define GDALMAJOROBJECT_H_INCLUDED
17
18#include "cpl_port.h"
19#include "cpl_string.h"
20
21#include "gdal_fwd.h" // for GDALMajorObjectH
22#include "gdal_multidomainmetadata.h"
23
25#define GMO_VALID 0x0001
26#define GMO_IGNORE_UNIMPLEMENTED 0x0002
27#define GMO_SUPPORT_MD 0x0004
28#define GMO_SUPPORT_MDMD 0x0008
29#define GMO_MD_DIRTY 0x0010
30#define GMO_PAM_CLASS 0x0020
31
33
34/* ******************************************************************** */
35/* GDALMajorObject */
36/* */
37/* Base class providing metadata, description and other */
38/* services shared by major objects. */
39/* ******************************************************************** */
40
42 class CPL_DLL GDALMajorObject
43{
44 protected:
46 int nFlags; // GMO_* flags.
47 CPLString sDescription{};
48 GDALMultiDomainMetadata oMDMD{};
49
51
52 char **BuildMetadataDomainList(char **papszList, int bCheckNonEmpty,
53 ...) CPL_NULL_TERMINATED;
54
56 GDALMajorObject(const GDALMajorObject &) = default;
57
59 GDALMajorObject &operator=(const GDALMajorObject &) = default;
60
62 GDALMajorObject(GDALMajorObject &&) = default;
63
65 GDALMajorObject &operator=(GDALMajorObject &&) = default;
66
67 public:
68 GDALMajorObject();
69 virtual ~GDALMajorObject();
70
71 int GetMOFlags() const;
72 void SetMOFlags(int nFlagsIn);
73
74 virtual const char *GetDescription() const;
75 virtual void SetDescription(const char *);
76
77 virtual char **GetMetadataDomainList();
78
79 virtual char **GetMetadata(const char *pszDomain = "");
80 virtual CPLErr SetMetadata(char **papszMetadata,
81 const char *pszDomain = "");
82 virtual const char *GetMetadataItem(const char *pszName,
83 const char *pszDomain = "");
84 virtual CPLErr SetMetadataItem(const char *pszName, const char *pszValue,
85 const char *pszDomain = "");
86
89 static inline GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
90 {
91 return static_cast<GDALMajorObjectH>(poMajorObject);
92 }
93
96 static inline GDALMajorObject *FromHandle(GDALMajorObjectH hMajorObject)
97 {
98 return static_cast<GDALMajorObject *>(hMajorObject);
99 }
100};
101
102#endif
CPLString
Convenient string class based on std::string.
Definition cpl_string.h:320
GDALMajorObject
Object with metadata.
Definition gdal_majorobject.h:43
GDALMajorObject::FromHandle
static GDALMajorObject * FromHandle(GDALMajorObjectH hMajorObject)
Convert a GDALMajorObjectH to a GDALMajorObject*.
Definition gdal_majorobject.h:96
GDALMajorObject::operator=
GDALMajorObject & operator=(const GDALMajorObject &)=default
Copy assignment operator.
GDALMajorObject::GDALMajorObject
GDALMajorObject(const GDALMajorObject &)=default
Copy constructor.
GDALMajorObject::ToHandle
static GDALMajorObjectH ToHandle(GDALMajorObject *poMajorObject)
Convert a GDALMajorObject* to a GDALMajorObjectH.
Definition gdal_majorobject.h:89
GDALMajorObject::operator=
GDALMajorObject & operator=(GDALMajorObject &&)=default
Move assignment operator.
GDALMajorObject::GDALMajorObject
GDALMajorObject(GDALMajorObject &&)=default
Move constructor.
CPLErr
CPLErr
Error category.
Definition cpl_error.h:37
cpl_port.h
Core portability definitions for CPL.
CPL_NULL_TERMINATED
#define CPL_NULL_TERMINATED
Null terminated variadic.
Definition cpl_port.h:832
cpl_string.h
Various convenience functions for working with strings and string lists.
gdal_fwd.h
Forward definitions of GDAL/OGR/OSR C handle types.
GDALMajorObjectH
void * GDALMajorObjectH
Opaque type used for the C bindings of the C++ GDALMajorObject class.
Definition gdal_fwd.h:39