Advanced Strategic Command
clipboard.h
Go to the documentation of this file.
1 
5 /*
6  This file is part of Advanced Strategic Command; http://www.asc-hq.de
7  Copyright (C) 1994-2010 Martin Bickel and Marc Schellenberger
8 
9  This program is free software; you can redistribute it and/or modify
10  it under the terms of the GNU General Public License as published by
11  the Free Software Foundation; either version 2 of the License, or
12  (at your option) any later version.
13 
14  This program is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  GNU General Public License for more details.
18 
19  You should have received a copy of the GNU General Public License
20  along with this program; see the file COPYING. If not, write to the
21  Free Software Foundation, Inc., 59 Temple Place, Suite 330,
22  Boston, MA 02111-1307 USA
23 */
24 
25 #ifndef clipboardH
26  #define clipboardH
27 
28  #include <map>
29 
30  #include "loki/Singleton.h"
31  #include "basestrm.h"
32  #include "vehicletype.h"
33  #include "buildingtype.h"
34  #include "typen.h"
35  #include "textfile_evaluation.h"
36 
38  map<ASCString,ASCString> properties;
39 
41  enum Type { ClipVehicle, ClipBuilding };
42  int objectNum;
43 
44  friend struct Loki::CreateUsingNew<ClipBoardBase>;
45  ClipBoardBase();
46  ~ClipBoardBase() {};
47 
48  void setProperties( const ContainerBase* unit );
49 
50  public:
51  void clear();
52  void addUnit ( const Vehicle* unit );
53  void addBuilding ( const Building* bld );
54  Vehicle* pasteUnit();
55  Vehicle* pasteUnit( tnstream& stream);
56  void place ( const MapCoordinate& pos );
57 
58  void writeProperties( PropertyContainer& pc ) const;
60 
61  void write( tnstream& stream );
62  void read( tnstream& stream );
63 };
64 
65 typedef Loki::SingletonHolder< ClipBoardBase > ClipBoard;
66 
67 extern const char* clipboardFileExtension;
68 extern const char* oldClipboardFileExtension;
69 
70 
71 #endif
72 
An in-memory storage of streamed data.
Definition: basestrm.h:172
void write(tnstream &stream)
Definition: clipboard.cpp:191
void read(tnstream &stream)
Definition: clipboard.cpp:198
Functions to evaluate the parsed *.asctxt files.
The interface for all kinds of IO stream.
void addBuilding(const Building *bld)
Definition: clipboard.cpp:91
void place(const MapCoordinate &pos)
Definition: clipboard.cpp:126
Loki::SingletonHolder< ClipBoardBase > ClipBoard
Definition: clipboard.h:65
void addUnit(const Vehicle *unit)
Definition: clipboard.cpp:81
Coordinate on the twodimensional map.
Definition: typen.h:202
void readProperties(PropertyContainer &pc)
Definition: clipboard.cpp:213
The interface for the buildingtype class.
The interface for the various streams that ASC offers, like file and memory streams.
void clear()
Definition: clipboard.cpp:46
const char * oldClipboardFileExtension
Definition: clipboard.cpp:37
const char * clipboardFileExtension
Definition: clipboard.cpp:36
Vehicle * pasteUnit()
Definition: clipboard.cpp:112
The parent class of Vehicle and Building; The name Container originates from Battle Isle...
Definition: containerbase.h:40
An actual building on the map, which references a BuildingType Buildings have an owner,.
Definition: buildings.h:38
void writeProperties(PropertyContainer &pc) const
Definition: clipboard.cpp:205