Devel Lib
Devel::Serializing::CJsonFieldName Class Reference

A class representing a JSON field name. More...

#include <JsonFieldName.h>

Public Member Functions

 CJsonFieldName (const char *i_pName)
 Constructs a CJsonFieldName object with a C-style string. More...
 
 CJsonFieldName (const std::string_view i_stName)
 Constructs a CJsonFieldName object with a std::string_view. More...
 
 CJsonFieldName (const CJsonFieldName &i_oOther)=default
 Copy constructor for CJsonFieldName. More...
 
 CJsonFieldName (CJsonFieldName &&i_oOther) noexcept
 Move constructor for CJsonFieldName. More...
 
 ~CJsonFieldName ()=default
 Destructor for CJsonFieldName.
 
CJsonFieldNameoperator= (const CJsonFieldName &i_oOther)
 Copy assignment operator for CJsonFieldName. More...
 
CJsonFieldNameoperator= (CJsonFieldName &&i_oOther)
 Move assignment operator for CJsonFieldName. More...
 
const char * name () const
 Retrieves the underlying name string. More...
 

Detailed Description

A class representing a JSON field name.

This class encapsulates a JSON field name and provides access to the underlying name string.

Example

This class represents a JSON field name and provides access to the underlying name string.

Here is an example of how to use the CJsonFieldName class:

#include "CJsonFieldName.h"
#include <iostream>
using namespace Devel::Serializing;
int main() {
// Create a CJsonFieldName object with a C-style string
CJsonFieldName fieldName("age");
// Access the underlying name string
const char* name = fieldName.name();
// Print the field name
std::cout << "Field name: " << name << std::endl;
// Create a CJsonFieldName object with a std::string_view
std::string_view viewName = "name";
CJsonFieldName fieldName2(viewName);
// Access the underlying name string
const char* name2 = fieldName2.name();
// Print the field name
std::cout << "Field name 2: " << name2 << std::endl;
return 0;
}
const char * name() const
Retrieves the underlying name string.
Definition: JsonFieldName.h:88
CJsonFieldName(const char *i_pName)
Constructs a CJsonFieldName object with a C-style string.
Definition: JsonFieldName.h:53
The namespace encapsulating serializing related functionality in the Devel framework.

Constructor & Destructor Documentation

◆ CJsonFieldName() [1/4]

Devel::Serializing::CJsonFieldName::CJsonFieldName ( const char *  i_pName)
inlineexplicit

Constructs a CJsonFieldName object with a C-style string.

Parameters
i_pNameThe C-style string representing the field name.

◆ CJsonFieldName() [2/4]

Devel::Serializing::CJsonFieldName::CJsonFieldName ( const std::string_view  i_stName)
inlineexplicit

Constructs a CJsonFieldName object with a std::string_view.

Parameters
i_stNameThe std::string_view representing the field name.

◆ CJsonFieldName() [3/4]

Devel::Serializing::CJsonFieldName::CJsonFieldName ( const CJsonFieldName i_oOther)
default

Copy constructor for CJsonFieldName.

Parameters
i_oOtherThe CJsonFieldName object to be copied.

◆ CJsonFieldName() [4/4]

Devel::Serializing::CJsonFieldName::CJsonFieldName ( CJsonFieldName &&  i_oOther)
inlinenoexcept

Move constructor for CJsonFieldName.

Parameters
i_oOtherThe CJsonFieldName object to be moved.

Member Function Documentation

◆ name()

const char* Devel::Serializing::CJsonFieldName::name ( ) const
inline

Retrieves the underlying name string.

Returns
A pointer to the underlying name string.

◆ operator=() [1/2]

CJsonFieldName& Devel::Serializing::CJsonFieldName::operator= ( CJsonFieldName &&  i_oOther)
inline

Move assignment operator for CJsonFieldName.

Parameters
i_oOtherThe CJsonFieldName object to be moved.
Returns
A reference to the moved CJsonFieldName object.

◆ operator=() [2/2]

CJsonFieldName& Devel::Serializing::CJsonFieldName::operator= ( const CJsonFieldName i_oOther)
inline

Copy assignment operator for CJsonFieldName.

Parameters
i_oOtherThe CJsonFieldName object to be assigned.
Returns
A reference to the assigned CJsonFieldName object.

The documentation for this class was generated from the following file: