Devel Lib
JsonFieldName.h
1 #pragma once
2 
3 #include <string_view>
4 #include <type_traits>
5 
8 namespace Devel::Serializing {
50  public:
53  explicit CJsonFieldName(const char *i_pName) : m_pName(i_pName) {}
54 
57  explicit CJsonFieldName(const std::string_view i_stName) : m_pName(i_stName.data()) {}
58 
61  CJsonFieldName(const CJsonFieldName &i_oOther) = default;
62 
65  CJsonFieldName(CJsonFieldName &&i_oOther) noexcept: m_pName(i_oOther.m_pName) {}
66 
68  ~CJsonFieldName() = default;
69 
74  m_pName = i_oOther.m_pName;
75  return *this;
76  }
77 
82  m_pName = i_oOther.m_pName;
83  return *this;
84  }
85 
88  [[nodiscard]] const char *name() const { return m_pName; }
89 
90  private:
93  const char *m_pName;
94  };
95 }
A class representing a JSON field name.
Definition: JsonFieldName.h:49
CJsonFieldName(const std::string_view i_stName)
Constructs a CJsonFieldName object with a std::string_view.
Definition: JsonFieldName.h:57
CJsonFieldName(CJsonFieldName &&i_oOther) noexcept
Move constructor for CJsonFieldName.
Definition: JsonFieldName.h:65
~CJsonFieldName()=default
Destructor for CJsonFieldName.
CJsonFieldName & operator=(const CJsonFieldName &i_oOther)
Copy assignment operator for CJsonFieldName.
Definition: JsonFieldName.h:73
const char * name() const
Retrieves the underlying name string.
Definition: JsonFieldName.h:88
CJsonFieldName & operator=(CJsonFieldName &&i_oOther)
Move assignment operator for CJsonFieldName.
Definition: JsonFieldName.h:81
CJsonFieldName(const char *i_pName)
Constructs a CJsonFieldName object with a C-style string.
Definition: JsonFieldName.h:53
CJsonFieldName(const CJsonFieldName &i_oOther)=default
Copy constructor for CJsonFieldName.
The namespace encapsulating serializing related functionality in the Devel framework.