mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-11 13:17:00 -04:00
Cleaned up Set::Styling/Card::Styling by spliting that functionality into a 'DelayedIndexMaps' class;
Added 'right' and 'bottom' properties to style as an alternative way of specifying width/height; Added content_width, content_height and content_lines properties that give feedback on text rendering; Always show warnings when showing errors and vice-versa, this prevents script errors from appearing before the reader/parse error that caused them; Finally some preliminairy work on export templates git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@428 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
// ----------------------------------------------------------------------------- : Includes
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <util/string.hpp>
|
||||
|
||||
// ----------------------------------------------------------------------------- : IndexMap
|
||||
|
||||
@@ -117,5 +119,34 @@ class IndexMap : private vector<Value> {
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : DelayedIndexMaps
|
||||
|
||||
// The data for a specific name.
|
||||
/* Invariant: read_data is initialized <=> unread_data.empty()
|
||||
*/
|
||||
template <typename Key, typename Value>
|
||||
struct DelayedIndexMapsData : public IntrusivePtrBase<DelayedIndexMapsData> {
|
||||
String unread_data;
|
||||
IndexMap<Key,Value> read_data;
|
||||
};
|
||||
|
||||
/// A map<String,IndexMap> where the reading of the index map depends on the name.
|
||||
/** The reading is delayed until the data to initialize the map with is known.
|
||||
* The only way to access data is using get()
|
||||
*/
|
||||
template <typename Key, typename Value>
|
||||
class DelayedIndexMaps {
|
||||
public:
|
||||
/// Get the data for a specific name. Initialize the map with init_with (if it is not alread initialized)
|
||||
IndexMap<Key,Value>& get(const String& name, const vector<Key>& init_with);
|
||||
private:
|
||||
map<String, intrusive_ptr<DelayedIndexMapsData<Key,Value> > > data;
|
||||
friend class Reader;
|
||||
friend class Writer;
|
||||
friend class GetDefaultMember;
|
||||
friend class GetMember;
|
||||
};
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------- : EOF
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user