F´ Flight Software - C/C++ Documentation  devel
A framework for building embedded system applications to NASA flight quality standards.
FileNameString.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // @file FileNameString.hpp
3 // @author F Prime
4 // @brief A string sized to store a file name
5 // ======================================================================
6 
7 #ifndef FW_FILE_NAME_STRING_HPP
8 #define FW_FILE_NAME_STRING_HPP
9 
10 #include <FpConfig.hpp>
11 
12 #include "Fw/Cfg/SerIds.hpp"
13 #include "Fw/Types/StringBase.hpp"
15 
16 namespace Fw {
17 
18 class FileNameString final : public StringBase {
19  public:
20  enum {
24  };
25 
26  FileNameString() : StringBase() { *this = ""; }
27 
28  explicit FileNameString(const FileNameString& src) : StringBase() { *this = src; }
29 
30  explicit FileNameString(const StringBase& src) : StringBase() { *this = src; }
31 
32  explicit FileNameString(const char* src) : StringBase() { *this = src; }
33 
35 
37  (void)StringBase::operator=(src);
38  return *this;
39  }
40 
42  (void)StringBase::operator=(src);
43  return *this;
44  }
45 
46  FileNameString& operator=(const char* src) {
47  (void)StringBase::operator=(src);
48  return *this;
49  }
50 
51  const char* toChar() const { return this->m_buf; }
52 
53  StringBase::SizeType getCapacity() const { return sizeof this->m_buf; }
54 
55  private:
56  char m_buf[BUFFER_SIZE(STRING_SIZE)];
57 };
58 } // namespace Fw
59 
60 #endif
C++-compatible configuration header for fprime configuration.
@ FileNameStringSize
Definitions for ISF type serial IDs.
Declares F Prime string base class.
FileNameString & operator=(const char *src)
FileNameString(const char *src)
FileNameString(const FileNameString &src)
const char * toChar() const
FileNameString & operator=(const StringBase &src)
FileNameString(const StringBase &src)
FileNameString & operator=(const FileNameString &src)
StringBase::SizeType getCapacity() const
return size of buffer
NATIVE_UINT_TYPE SizeType
Definition: StringBase.hpp:26
static constexpr SizeType STATIC_SERIALIZED_SIZE(SizeType maxLength)
Definition: StringBase.hpp:35
static constexpr SizeType BUFFER_SIZE(SizeType maxLength)
Get the size of a null-terminated string buffer.
Definition: StringBase.hpp:41
@ FW_TYPEID_FILE_NAME_STRING
FileName string Buffer type id.
Definition: SerIds.hpp:61