Caffa  1.1.0
C++ Application Framework for Embedded Systems with introspection
cafDocument.h
1 // ##################################################################################################
2 //
3 // Caffa
4 // Copyright (C) 2011-2013 Ceetron AS
5 // Copyright (C) 2013-2022 Ceetron Solutions AS
6 // Copyright (C) Changes 2022- Kontur AS
7 //
8 // GNU Lesser General Public License Usage
9 // This library is free software; you can redistribute it and/or modify
10 // it under the terms of the GNU Lesser General Public License as published by
11 // the Free Software Foundation; either version 2.1 of the License, or
12 // (at your option) any later version.
13 //
14 // This library is distributed in the hope that it will be useful, but WITHOUT ANY
15 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 // FITNESS FOR A PARTICULAR PURPOSE.
17 //
18 // See the GNU Lesser General Public License at <<http://www.gnu.org/licenses/lgpl-2.1.html>>
19 // for more details.
20 //
21 // ##################################################################################################
22 #pragma once
23 #include "cafField.h"
24 #include "cafObject.h"
25 #include "cafStringTools.h"
26 
27 #include <string>
28 
29 namespace caffa
30 {
31 //==================================================================================================
34 //==================================================================================================
35 class Document : public Object
36 {
37  CAFFA_HEADER_INIT_WITH_DOC( "The Document class is a top level object acting as a "
38  "\"Project\" or container",
39  Document,
40  Object );
41 
42 public:
43  Document( const std::string& id = std::string( classKeywordStatic() ) );
44  ~Document() noexcept override;
45 
46  std::string id() const;
47  std::string fileName() const;
48 
49  void setId( const std::string& id );
50  void setFileName( const std::string& fileName );
51 
52  bool readFromJsonFile();
53  bool writeToJsonFile() const;
54 
55 private:
56  Field<std::string> m_id;
57  Field<std::string> m_fileName;
58 };
59 
60 } // End of namespace caffa
Definition: cafDocument.h:36
Definition: object.py:7
Main Caffa namespace.
Definition: __init__.py:1