From d9f07ec4c27ba8a8fc837f49a99ea7f65feb933b Mon Sep 17 00:00:00 2001 From: kohait Date: Fri, 24 Dec 2010 13:11:48 +0000 Subject: [PATCH] bazaar: Gen: Value for Instancer, Tree: small fixes, Detach fix git-svn-id: svn://ultimatepp.org/upp/trunk@2927 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/Gen/Gen.cpp | 4 ++-- bazaar/Gen/Gen.h | 4 ++-- bazaar/Tree/Tree.h | 34 +++++++++++++++++----------------- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/bazaar/Gen/Gen.cpp b/bazaar/Gen/Gen.cpp index 3fbdcff44..e1e21b902 100644 --- a/bazaar/Gen/Gen.cpp +++ b/bazaar/Gen/Gen.cpp @@ -2,9 +2,9 @@ NAMESPACE_UPP -VectorMap& GetGlobalInstancerMap() +VectorMap& GetGlobalInstancerMap() { - static VectorMap map; + static VectorMap map; return map; } diff --git a/bazaar/Gen/Gen.h b/bazaar/Gen/Gen.h index 685a98088..edef19da4 100644 --- a/bazaar/Gen/Gen.h +++ b/bazaar/Gen/Gen.h @@ -167,7 +167,7 @@ public: }; typedef void*(*GlobalInstancerType)(); -VectorMap& GetGlobalInstancerMap(); +VectorMap& GetGlobalInstancerMap(); //Instancer help class, for maps of Instancers. the static Map should //somewhere be ONCELOCK initialized with the elements @@ -186,7 +186,7 @@ public: static InstancerType GetInstancer() { return &GetInstance; } static GlobalInstancerType GetGlobalInstancer() { return (GlobalInstancerType)&GetInstance; } }; - static VectorMap& Map() { static VectorMap map; return map; } + static VectorMap& Map() { static VectorMap map; return map; } }; //in polymorph environment, type info is needed, i.e. when xmlizing/serializing elements diff --git a/bazaar/Tree/Tree.h b/bazaar/Tree/Tree.h index 575956183..172b101ea 100644 --- a/bazaar/Tree/Tree.h +++ b/bazaar/Tree/Tree.h @@ -10,28 +10,28 @@ class Tree { protected: typedef Array B; - T * parent; - T * root; + T* parent; + T* root; - inline void Link(T & t) { t.root = root; t.parent = (T *)this; } - inline void Unlink(T & t) { t.root = NULL; t.parent = NULL; } + inline void Link(T& t) { t.root = root; t.parent = (T *)this; } + inline void Unlink(T& t) { t.root = NULL; t.parent = NULL; } void Relink() { for(int i = 0; i < B::GetCount(); i++) { T & t = B::operator[](i); Link(t); t.Relink();} } public: - T *GetPtr() { return (T *) this; } - const T *GetPtr() const { return (const T *) this; } - T *GetParent() { return parent; } - const T *GetParent() const { return parent; } - T *GetRoot() { return root; } - const T *GetRoot() const { return root; } - void SetAsRoot() { ASSERT(parent == NULL); root = (T *)this; Relink(); } + T* GetPtr() { return (T*) this; } + const T* GetPtr() const { return (const T *) this; } + T* GetParent() { return parent; } + const T* GetParent() const { return parent; } + T* GetRoot() { return root; } + const T* GetRoot() const { return root; } + void SetAsRoot() { ASSERT(parent == NULL); root = (T*)this; Relink(); } // Array interface - T& Add() { T & t = B::Add(); Link(t); return t; } - void Add(const T& x) { T & t = B::Add(DeepCopyNew(x)); Link(t); }// return t; } - void AddPick(pick_ T& x) { T & t = B::Add(new T(x)); Link(t); }// return t; } + T& Add() { T& t = B::Add(); Link(t); return t; } + void Add(const T& x) { T& t = B::Add(DeepCopyNew(x)); Link(t); }// return t; } + void AddPick(pick_ T& x) { T& t = B::Add(new T(x)); Link(t); }// return t; } T& Add(T *newt) { ASSERT(newt->parent == NULL); T & t = B::Add(newt); Link(t); return t; } using B::operator[]; @@ -47,21 +47,21 @@ public: T& At(int i, const T& x) { if(i >= GetCount()) SetCountR(i + 1, x); return B::Get(i); } using B::Remove; - T& Insert(int i) { T & t = B::Insert(i); Link(t); return t; } + T& Insert(int i) { T& t = B::Insert(i); Link(t); return t; } void InsertPick(int i, pick_ T& x) { Link(x); B::InsertPick(i, x); } using B::GetIndex; using B::Swap; using B::Move; - T *Detach(int i) { T *t = B::Detach(i); Unlink(t); } + T* Detach(int i) { T* t = B::Detach(i); Unlink(*t); return t;} T& Set(int i, T *newt) { ASSERT(newt->parent == NULL); T & t = B::Set(i, newt); Link(t); return t; } void Insert(int i, T *newt) { ASSERT(newt->parent == NULL); B::Insert(i, newt); Link(*newt); } using B::Drop; using B::Top; - T *PopDetach() { T * t = B::PopDetach(); Unlink(*t); return t; } + T* PopDetach() { T* t = B::PopDetach(); Unlink(*t); return t; } using B::Begin; using B::End;