Ginga  0.13.6.2086-83aa
The iTV middleware.
Document.h
1 /* Copyright (C) 2006-2018 PUC-Rio/Laboratorio TeleMidia
2 
3 This file is part of Ginga (Ginga-NCL).
4 
5 Ginga is free software: you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 2 of the License, or
8 (at your option) any later version.
9 
10 Ginga is distributed in the hope that it will be useful, but WITHOUT
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
13 License for more details.
14 
15 You should have received a copy of the GNU General Public License
16 along with Ginga. If not, see <https://www.gnu.org/licenses/>. */
17 
18 #ifndef DOCUMENT_H
19 #define DOCUMENT_H
20 
21 #include "Object.h"
22 
23 GINGA_NAMESPACE_BEGIN
24 
25 class Context;
26 class Media;
27 class Switch;
28 
34 class Document
35 {
36 public:
37  Document ();
38  virtual ~Document ();
39 
40  const set<Object *> *getObjects ();
41  Object *getObjectById (const string &);
42  Object *getObjectByIdOrAlias (const string &);
43  bool addObject (Object *);
44 
45  Context *getRoot ();
47  const set<Media *> *getMedias ();
48  const set<Context *> *getContexts ();
49  const set<Switch *> *getSwitches ();
50 
51  int evalAction (Event *, Event::Transition, const string &value = "");
52  int evalAction (Action);
53  bool evalPredicate (Predicate *);
54  bool evalPropertyRef (const string &, string *);
55 
56  bool getData (const string &, void **);
57  bool setData (const string &, void *, UserDataCleanFunc fn = nullptr);
58 
59 private:
60  set<Object *> _objects;
61  map<string, Object *> _objectsById;
64  set<Media *> _medias;
65  set<Context *> _contexts;
66  set<Switch *> _switches;
68 };
69 
70 GINGA_NAMESPACE_END
71 
72 #endif // DOCUMENT_H
Definition: Object.h:29
set< Media * > _medias
Media objects.
Definition: Document.h:64
MediaSettings * getSettings()
Gets document&#39;s settings object.
Definition: Document.cpp:171
map< string, Object * > _objectsById
Objects indexed by id.
Definition: Document.h:61
virtual ~Document()
Destroys document.
Definition: Document.cpp:56
Definition: Context.h:26
set< Switch * > _switches
Switch objects.
Definition: Document.h:66
Context * _root
Root context (body).
Definition: Document.h:62
set< Context * > _contexts
Context objects.
Definition: Document.h:65
Definition: Switch.h:26
Definition: aux-ginga.h:192
Context * getRoot()
Gets document&#39;s root object.
Definition: Document.cpp:160
Definition: MediaSettings.h:25
bool addObject(Object *)
Adds object to document.
Definition: Document.cpp:112
Action.
Definition: Event.h:124
Transition
Event state transitions.
Definition: Event.h:72
Definition: Media.h:26
NCL document.
Definition: Document.h:34
MediaSettings * _settings
Settings object.
Definition: Document.h:63
Event state machine.
Definition: Event.h:31
Document()
Creates a new document.
Definition: Document.cpp:38
Definition: Predicate.h:25
int evalAction(Event *, Event::Transition, const string &value="")
Evaluates action over document.
Definition: Document.cpp:199
Object * getObjectById(const string &)
Gets document object by id.
Definition: Document.cpp:77
UserData _udata
Attached user data.
Definition: Document.h:67
Object * getObjectByIdOrAlias(const string &)
Gets document object by id or alias.
Definition: Document.cpp:91
const set< Object * > * getObjects()
Gets document objects.
Definition: Document.cpp:66
set< Object * > _objects
Objects.
Definition: Document.h:60