PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PComplexData.h
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: src/base/PComplexData.h
4// Purpose: Contains definition for the complex data type, held by the Variant Class
5// Author: Shane T. Mueller, Ph.D.
6// Copyright: (c) 2003-2026 Shane T. Mueller <smueller@obereed.net>
7// License: GPL 2
8//
9//
10//
11// This file is part of the PEBL project.
12//
13// PEBL is free software; you can redistribute it and/or modify
14// it under the terms of the GNU General Public License as published by
15// the Free Software Foundation; either version 2 of the License, or
16// (at your option) any later version.
17//
18// PEBL is distributed in the hope that it will be useful,
19// but WITHOUT ANY WARRANTY; without even the implied warranty of
20// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21// GNU General Public License for more details.
22//
23// You should have received a copy of the GNU General Public License
24// along with PEBL; if not, write to the Free Software
25// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27#ifndef __PCOMPLEXDATA_H__
28#define __PCOMPLEXDATA_H__
29
30//#include "PEBLObject.h"
31
32#include "PList.h"
33
34#include "../objects/PColor.h"
35
36#ifdef PEBL_VALIDATOR
37#include "../platforms/validator/PlatformEnvironment.h"
38#include "../platforms/validator/PlatformWindow.h"
39#include "../platforms/validator/PlatformImageBox.h"
40#include "../platforms/validator/PlatformAudioOut.h"
41#include "../platforms/validator/PlatformNetwork.h"
42#include "../platforms/validator/PlatformJoystick.h"
43#else
44#include "../platforms/sdl/PlatformEnvironment.h"
45#include "../platforms/sdl/PlatformWindow.h"
46#include "../platforms/sdl/PlatformImageBox.h"
47//#include "../platforms/sdl/PlatformFont.h"
48//#include "../platforms/sdl/PlatformLabel.h"
49//#include "../platforms/sdl/PlatformTextBox.h"
50//#include "../platforms/sdl/PlatformKeyboard.h"
51//#include "../platforms/sdl/PlatformDrawObject.h"
52//#include "../platforms/sdl/PlatformCanvas.h"
53//#include "../platforms/sdl/PlatformMovie.h"
54#include "../platforms/sdl/PlatformAudioOut.h"
55#include "../platforms/sdl/PlatformNetwork.h"
56#include "../platforms/sdl/PlatformJoystick.h"
57#endif
58#include "../devices/PStream.h"
59#include "../utility/rc_ptrs.h"
60#include "../devices/PParallelPort.h"
61#include "../devices/PComPort.h"
62
63#include <iostream>
64
65
66
73
76
77
78
86
88{
89public:
90
91
92 //Constructors
95
96 // PComplexData(counted_ptr<PlatformEnvironment>);
97// PComplexData(counted_ptr<PlatformWindow>);
98// PComplexData(counted_ptr<PColor>);
99// PComplexData(counted_ptr<PlatformFont>);
100// PComplexData(counted_ptr<PlatformLabel>);
101// PComplexData(counted_ptr<PlatformTextBox> );
102// PComplexData(counted_ptr<PlatformImageBox>);
103// PComplexData(counted_ptr<PlatformKeyboard>);
104// PComplexData(counted_ptr<PStream>);
105// PComplexData(counted_ptr<PlatformAudioOut>);
106// PComplexData(counted_ptr<PlatformDrawObject>);
107
108
110 PComplexData(const PComplexData & pcd);
111
112 PComplexData(const PComplexData * pcd);
113
114
117
118
119 //Overload of the << operator
120 friend std::ostream & operator <<(std::ostream & out, const PComplexData & pcd );
121
122
123
124
125 //'Get' Methods.
126
127 ComplexDataType GetType() const;
128 std::string GetTypeName() const;
129
130
131
132 //The following are convenience accessors; do not
133 //destroy or mangle the returned object.
134
135 PList * GetList() const;
136// counted_ptr<PlatformEnvironment> GetEnvironment() const;
137// counted_ptr<PlatformWindow> GetWindow() const;
138// counted_ptr<PColor> GetColor() const;
139// counted_ptr<PlatformFont> GetFont() const;
140// counted_ptr<PlatformLabel> GetLabel() const;
141// counted_ptr<PlatformTextBox> GetTextBox() const;
142// counted_ptr<PlatformImageBox> GetImageBox() const;
143// counted_ptr<PlatformKeyboard> GetKeyboard() const;
144// counted_ptr<PlatformDrawObject> GetDrawObject() const;
145// counted_ptr<PStream> GetFileStream() const;
146// counted_ptr<PlatformAudioOut> GetAudioOut() const;
147
150
151 //This is no longer under control of the counted pointer system.
152 PlatformWidget * GetWidget() const; //Returns pointer to a widget, whatever it is.
153
154
155 //'IsX' methods
156 bool IsList() const;
157 bool IsEnvironment()const;
158 bool IsWidget() const;
159 bool IsWindow() const;
160 bool IsColor() const;
161 bool IsFont() const;
162 bool IsTextObject() const;
163 bool IsLabel() const;
164 bool IsTextBox() const;
165 bool IsImageBox() const;
166 bool IsKeyboard() const;
167 bool IsFileStream() const;
168 bool IsAudioOut() const;
169 bool IsNetworkConnection() const;
170 bool IsDrawObject() const;
171 bool IsThickLine() const;
172 bool IsDrawCircle() const;
173 bool IsDrawSquare() const;
174 bool IsDrawRectangle() const;
175 bool IsCanvas() const;
176 bool IsJoystick() const;
177 bool IsParallelPort() const;
178 bool IsComPort() const;
179 bool IsMovie() const;
180 bool IsCustomObject()const;
181
182
183
184 void SetProperty(std::string, Variant v);
185 Variant GetProperty(std::string prop) const;
186 bool PropertyExists(std::string prop)const;
187
188protected:
189 //Inheritable function for use by << operator.
190 std::ostream & SendToStream(std::ostream& out) const;
191
192
193private:
194
195 //This isn't very efficient--each of these gets
196 //created whenever a PCD is created (or copied), and each
197 //will get destroyed as well.
198
199 counted_ptr<PEBLObjectBase> mPEBLObject;
200
201// counted_ptr<PList> mList;
202// counted_ptr<PlatformEnvironment> mEnvironment;
203// counted_ptr<PlatformWindow> mWindow;
204// counted_ptr<PColor> mColor;
205// counted_ptr<PlatformFont> mFont;
206// counted_ptr<PlatformLabel> mLabel;
207// counted_ptr<PlatformTextBox> mTextBox;
208// counted_ptr<PlatformImageBox> mImageBox;
209// counted_ptr<PlatformKeyboard> mKeyboard;
210// counted_ptr<PStream> mFileStream;
211// counted_ptr<PlatformAudioOut> mAudioOut;
212
213// counted_ptr<PlatformDrawObject> mDrawObject;
214};
215
216
217#endif
ComplexDataType
Definition PEBLObject.h:45
Variant GetProperty(std::string prop) const
bool IsImageBox() const
counted_ptr< PEBLObjectBase > GetObject() const
bool IsWidget() const
bool IsColor() const
bool IsTextObject() const
friend std::ostream & operator<<(std::ostream &out, const PComplexData &pcd)
bool IsWindow() const
bool IsAudioOut() const
std::string GetTypeName() const
bool IsDrawObject() const
bool IsEnvironment() const
bool IsParallelPort() const
bool IsMovie() const
PList * GetList() const
bool IsDrawCircle() const
bool IsDrawRectangle() const
bool IsList() const
bool IsDrawSquare() const
PlatformWidget * GetWidget() const
ComplexDataType GetType() const
bool IsLabel() const
bool IsTextBox() const
void SetProperty(std::string, Variant v)
bool IsKeyboard() const
bool IsFileStream() const
bool IsComPort() const
bool PropertyExists(std::string prop) const
bool IsFont() const
counted_ptr< PEBLObjectBase > GetPEBLObject() const
bool IsNetworkConnection() const
bool IsThickLine() const
std::ostream & SendToStream(std::ostream &out) const
bool IsCustomObject() const
~PComplexData()
Destructor. Does not destroy the pointed-to contents.
bool IsJoystick() const
bool IsCanvas() const
Definition PList.h:45