Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/WolfireGames/overgrowth.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Source/Ogda')
-rw-r--r--Source/Ogda/Builders/actionbase.h15
-rw-r--r--Source/Ogda/Builders/builder.cpp35
-rw-r--r--Source/Ogda/Builders/builder.h10
-rw-r--r--Source/Ogda/Builders/builderfactory.cpp46
-rw-r--r--Source/Ogda/Builders/builderfactory.h35
-rw-r--r--Source/Ogda/Builders/copyaction.cpp14
-rw-r--r--Source/Ogda/Builders/copyaction.h12
-rw-r--r--Source/Ogda/Builders/crunchaction.cpp9
-rw-r--r--Source/Ogda/Builders/crunchaction.h12
-rw-r--r--Source/Ogda/Builders/dxt5action.cpp9
-rw-r--r--Source/Ogda/Builders/dxt5action.h12
-rw-r--r--Source/Ogda/Builders/voidaction.cpp3
-rw-r--r--Source/Ogda/Builders/voidaction.h15
-rw-r--r--Source/Ogda/Generators/creatorbase.h11
-rw-r--r--Source/Ogda/Generators/generator.cpp16
-rw-r--r--Source/Ogda/Generators/generator.h10
-rw-r--r--Source/Ogda/Generators/generatorfactory.cpp35
-rw-r--r--Source/Ogda/Generators/generatorfactory.h28
-rw-r--r--Source/Ogda/Generators/levellistcreator.cpp16
-rw-r--r--Source/Ogda/Generators/levellistcreator.h11
-rw-r--r--Source/Ogda/Generators/shortversioncreator.cpp11
-rw-r--r--Source/Ogda/Generators/shortversioncreator.h11
-rw-r--r--Source/Ogda/Generators/versionxmlcreator.cpp70
-rw-r--r--Source/Ogda/Generators/versionxmlcreator.h11
-rw-r--r--Source/Ogda/Generators/voidcreator.cpp5
-rw-r--r--Source/Ogda/Generators/voidcreator.h11
-rw-r--r--Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.cpp66
-rw-r--r--Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.h28
-rw-r--r--Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.cpp52
-rw-r--r--Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.h22
-rw-r--r--Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.cpp48
-rw-r--r--Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.h18
-rw-r--r--Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.cpp532
-rw-r--r--Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/actorseeker.cpp85
-rw-r--r--Source/Ogda/Searchers/Seekers/actorseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.cpp39
-rw-r--r--Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/animationretargetseeker.cpp42
-rw-r--r--Source/Ogda/Searchers/Seekers/animationretargetseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/attackseeker.cpp97
-rw-r--r--Source/Ogda/Searchers/Seekers/attackseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/characterseeker.cpp114
-rw-r--r--Source/Ogda/Searchers/Seekers/characterseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/decalseeker.cpp35
-rw-r--r--Source/Ogda/Searchers/Seekers/decalseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/hotspotseeker.cpp17
-rw-r--r--Source/Ogda/Searchers/Seekers/hotspotseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/itemseeker.cpp162
-rw-r--r--Source/Ogda/Searchers/Seekers/itemseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/jsonseekerbase.cpp19
-rw-r--r--Source/Ogda/Searchers/Seekers/jsonseekerbase.h14
-rw-r--r--Source/Ogda/Searchers/Seekers/levelnormseeker.cpp8
-rw-r--r--Source/Ogda/Searchers/Seekers/levelnormseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/levelseekerbase.cpp12
-rw-r--r--Source/Ogda/Searchers/Seekers/levelseekerbase.h9
-rw-r--r--Source/Ogda/Searchers/Seekers/materialseeker.cpp188
-rw-r--r--Source/Ogda/Searchers/Seekers/materialseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/objcolseeker.cpp17
-rw-r--r--Source/Ogda/Searchers/Seekers/objcolseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/objectseeker.cpp149
-rw-r--r--Source/Ogda/Searchers/Seekers/objectseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/objhullseeker.cpp18
-rw-r--r--Source/Ogda/Searchers/Seekers/objhullseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/particleseeker.cpp91
-rw-r--r--Source/Ogda/Searchers/Seekers/particleseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.cpp10
-rw-r--r--Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/prefabseeker.cpp1555
-rw-r--r--Source/Ogda/Searchers/Seekers/prefabseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/seekerbase.h9
-rw-r--r--Source/Ogda/Searchers/Seekers/skeletonseeker.cpp31
-rw-r--r--Source/Ogda/Searchers/Seekers/skeletonseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/skylevelseeker.cpp12
-rw-r--r--Source/Ogda/Searchers/Seekers/skylevelseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/spawnerlistseeker.cpp49
-rw-r--r--Source/Ogda/Searchers/Seekers/spawnerlistseeker.h14
-rw-r--r--Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.cpp72
-rw-r--r--Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/terrainlevelseeker.cpp108
-rw-r--r--Source/Ogda/Searchers/Seekers/terrainlevelseeker.h10
-rw-r--r--Source/Ogda/Searchers/Seekers/voidseeker.cpp5
-rw-r--r--Source/Ogda/Searchers/Seekers/voidseeker.h12
-rw-r--r--Source/Ogda/Searchers/Seekers/xmlseekerbase.cpp15
-rw-r--r--Source/Ogda/Searchers/Seekers/xmlseekerbase.h13
-rw-r--r--Source/Ogda/Searchers/searcher.cpp56
-rw-r--r--Source/Ogda/Searchers/searcher.h12
-rw-r--r--Source/Ogda/Searchers/searcherfactory.cpp75
-rw-r--r--Source/Ogda/Searchers/searcherfactory.h28
-rw-r--r--Source/Ogda/database_manifest.cpp206
-rw-r--r--Source/Ogda/database_manifest.h12
-rw-r--r--Source/Ogda/databasemanifestresult.cpp15
-rw-r--r--Source/Ogda/databasemanifestresult.h17
-rw-r--r--Source/Ogda/filterbase.h3
-rw-r--r--Source/Ogda/item.cpp186
-rw-r--r--Source/Ogda/item.h38
-rw-r--r--Source/Ogda/jobhandler.cpp505
-rw-r--r--Source/Ogda/jobhandler.h15
-rw-r--r--Source/Ogda/jobhandlerthreadpool.cpp65
-rw-r--r--Source/Ogda/jobhandlerthreadpool.h10
-rw-r--r--Source/Ogda/levelreader.h4
-rw-r--r--Source/Ogda/main.cpp92
-rw-r--r--Source/Ogda/main.h2
-rw-r--r--Source/Ogda/manifest.cpp428
-rw-r--r--Source/Ogda/manifest.h18
-rw-r--r--Source/Ogda/manifestresult.cpp42
-rw-r--r--Source/Ogda/manifestresult.h32
-rw-r--r--Source/Ogda/manifestthreadpool.cpp65
-rw-r--r--Source/Ogda/manifestthreadpool.h10
-rw-r--r--Source/Ogda/ogda_hash.cpp10
-rw-r--r--Source/Ogda/readerbase.h4
111 files changed, 2761 insertions, 3677 deletions
diff --git a/Source/Ogda/Builders/actionbase.h b/Source/Ogda/Builders/actionbase.h
index c900993a..0df0371c 100644
--- a/Source/Ogda/Builders/actionbase.h
+++ b/Source/Ogda/Builders/actionbase.h
@@ -29,12 +29,11 @@
class JobHandler;
class Item;
-class ActionBase
-{
- public:
- virtual ManifestResult Run(const JobHandler& jh, const Item& y) = 0;
- virtual const char* GetName() const = 0;
- virtual const char* GetVersion() const = 0;
- virtual bool RunEvenOnIdenticalSource() const = 0;
- virtual bool StoreResultInDatabase() const = 0;
+class ActionBase {
+ public:
+ virtual ManifestResult Run(const JobHandler& jh, const Item& y) = 0;
+ virtual const char* GetName() const = 0;
+ virtual const char* GetVersion() const = 0;
+ virtual bool RunEvenOnIdenticalSource() const = 0;
+ virtual bool StoreResultInDatabase() const = 0;
};
diff --git a/Source/Ogda/Builders/builder.cpp b/Source/Ogda/Builders/builder.cpp
index 49584ec6..53486820 100644
--- a/Source/Ogda/Builders/builder.cpp
+++ b/Source/Ogda/Builders/builder.cpp
@@ -23,49 +23,38 @@
#include "builder.h"
#include <Utility/strings.h>
-Builder::Builder( ActionBase* action, const std::string& path_ending_, const std::string& type_pattern_re )
-: action(action), path_ending(path_ending_)
-{
- try
- {
- type_pattern->Compile(type_pattern_re.c_str());
- }
- catch( const TRexParseException& pe )
- {
+Builder::Builder(ActionBase* action, const std::string& path_ending_, const std::string& type_pattern_re)
+ : action(action), path_ending(path_ending_) {
+ try {
+ type_pattern->Compile(type_pattern_re.c_str());
+ } catch (const TRexParseException& pe) {
LOGE << "Failed to compile the type_pattern regex " << type_pattern_re << " reason: " << pe.desc << std::endl;
}
}
-bool Builder::IsMatch(const Item& t)
-{
- if( endswith(t.GetPath().c_str(),path_ending.c_str()) && type_pattern->Match(t.type.c_str()) )
+bool Builder::IsMatch(const Item& t) {
+ if (endswith(t.GetPath().c_str(), path_ending.c_str()) && type_pattern->Match(t.type.c_str()))
return true;
else
return false;
}
-ManifestResult Builder::Run(const JobHandler& jh, const Item& t)
-{
+ManifestResult Builder::Run(const JobHandler& jh, const Item& t) {
return action->Run(jh, t);
}
-std::string Builder::GetBuilderName() const
-{
+std::string Builder::GetBuilderName() const {
return std::string(action.GetConst().GetName());
}
-std::string Builder::GetBuilderVersion() const
-{
+std::string Builder::GetBuilderVersion() const {
return std::string(action.GetConst().GetVersion());
}
-bool Builder::RunEvenOnIdenticalSource()
-{
+bool Builder::RunEvenOnIdenticalSource() {
return action->RunEvenOnIdenticalSource();
}
-bool Builder::StoreResultInDatabase()
-{
+bool Builder::StoreResultInDatabase() {
return action->StoreResultInDatabase();
}
-
diff --git a/Source/Ogda/Builders/builder.h b/Source/Ogda/Builders/builder.h
index d384f233..0493a821 100644
--- a/Source/Ogda/Builders/builder.h
+++ b/Source/Ogda/Builders/builder.h
@@ -29,10 +29,9 @@
#include <trex/trex.h>
-class Builder
-{
-public:
- Builder( ActionBase* action, const std::string& path_ending_, const std::string& type_pattern_re );
+class Builder {
+ public:
+ Builder(ActionBase* action, const std::string& path_ending_, const std::string& type_pattern_re);
bool IsMatch(const Item& t);
bool RunEvenOnIdenticalSource();
bool StoreResultInDatabase();
@@ -40,7 +39,8 @@ public:
ManifestResult Run(const JobHandler& jh, const Item& t);
std::string GetBuilderName() const;
std::string GetBuilderVersion() const;
-private:
+
+ private:
std::string path_ending;
ReferenceCounter<TRexpp> type_pattern;
ReferenceCounter<ActionBase> action;
diff --git a/Source/Ogda/Builders/builderfactory.cpp b/Source/Ogda/Builders/builderfactory.cpp
index 2b15d72d..a3eaff1c 100644
--- a/Source/Ogda/Builders/builderfactory.cpp
+++ b/Source/Ogda/Builders/builderfactory.cpp
@@ -28,60 +28,48 @@
#include "dxt5action.h"
#include "crunchaction.h"
-BuilderFactory::BuilderFactory()
-{
- actions.push_back( new ActionFactory<CopyAction>() );
- actions.push_back( new ActionFactory<DXT5Action>() );
- actions.push_back( new ActionFactory<CrunchAction>() );
- actions.push_back( new ActionFactory<VoidAction>() );
+BuilderFactory::BuilderFactory() {
+ actions.push_back(new ActionFactory<CopyAction>());
+ actions.push_back(new ActionFactory<DXT5Action>());
+ actions.push_back(new ActionFactory<CrunchAction>());
+ actions.push_back(new ActionFactory<VoidAction>());
}
-BuilderFactory::~BuilderFactory()
-{
+BuilderFactory::~BuilderFactory() {
std::vector<ActionFactoryBase*>::iterator factoryit;
- for( factoryit = actions.begin(); factoryit != actions.end(); factoryit++ )
- {
+ for (factoryit = actions.begin(); factoryit != actions.end(); factoryit++) {
delete *factoryit;
}
actions.clear();
}
-bool BuilderFactory::HasBuilder( const std::string& builder )
-{
+bool BuilderFactory::HasBuilder(const std::string& builder) {
std::vector<ActionFactoryBase*>::iterator factoryit;
- for( factoryit = actions.begin(); factoryit != actions.end(); factoryit++ )
- {
- if( (*factoryit)->GetActionName() == builder )
- {
+ for (factoryit = actions.begin(); factoryit != actions.end(); factoryit++) {
+ if ((*factoryit)->GetActionName() == builder) {
return true;
}
}
return false;
}
-Builder BuilderFactory::CreateBuilder( const std::string& builder, const std::string& ending, const std::string& type_pattern_re )
-{
+Builder BuilderFactory::CreateBuilder(const std::string& builder, const std::string& ending, const std::string& type_pattern_re) {
std::vector<ActionFactoryBase*>::iterator factoryit;
- for( factoryit = actions.begin(); factoryit != actions.end(); factoryit++ )
- {
- if( (*factoryit)->GetActionName() == builder )
- {
+ for (factoryit = actions.begin(); factoryit != actions.end(); factoryit++) {
+ if ((*factoryit)->GetActionName() == builder) {
return Builder((*factoryit)->NewInstance(), ending, type_pattern_re);
}
}
LOGE << "Unable to find builder matching name " << builder << std::endl;
- return Builder( new VoidAction(), ending, type_pattern_re );
+ return Builder(new VoidAction(), ending, type_pattern_re);
}
-bool BuilderFactory::StoreResultInDatabase( std::string builder )
-{
+bool BuilderFactory::StoreResultInDatabase(std::string builder) {
std::vector<ActionFactoryBase*>::iterator factoryit;
- for( factoryit = actions.begin(); factoryit != actions.end(); factoryit++ )
- {
- if( (*factoryit)->GetActionName() == builder )
- {
+ for (factoryit = actions.begin(); factoryit != actions.end(); factoryit++) {
+ if ((*factoryit)->GetActionName() == builder) {
return (*factoryit)->StoreResultInDatabase();
}
}
diff --git a/Source/Ogda/Builders/builderfactory.h b/Source/Ogda/Builders/builderfactory.h
index 62301b01..47fc0772 100644
--- a/Source/Ogda/Builders/builderfactory.h
+++ b/Source/Ogda/Builders/builderfactory.h
@@ -25,41 +25,36 @@
#include <vector>
-class BuilderFactory
-{
-private:
- class ActionFactoryBase
- {
- public:
+class BuilderFactory {
+ private:
+ class ActionFactoryBase {
+ public:
virtual ActionBase* NewInstance() = 0;
virtual std::string GetActionName() = 0;
virtual bool StoreResultInDatabase() = 0;
};
- template<class Action>
- class ActionFactory : public ActionFactoryBase
- {
- ActionBase* NewInstance() override
- {
+ template <class Action>
+ class ActionFactory : public ActionFactoryBase {
+ ActionBase* NewInstance() override {
return new Action();
}
- std::string GetActionName() override
- {
+ std::string GetActionName() override {
return std::string(Action().GetName());
}
- bool StoreResultInDatabase() override
- {
- return Action().StoreResultInDatabase();
+ bool StoreResultInDatabase() override {
+ return Action().StoreResultInDatabase();
}
};
std::vector<ActionFactoryBase*> actions;
-public:
+
+ public:
BuilderFactory();
~BuilderFactory();
- bool HasBuilder( const std::string& builder );
- Builder CreateBuilder( const std::string& builder, const std::string& ending, const std::string& type_pattern_re );
- bool StoreResultInDatabase( std::string builder );
+ bool HasBuilder(const std::string& builder);
+ Builder CreateBuilder(const std::string& builder, const std::string& ending, const std::string& type_pattern_re);
+ bool StoreResultInDatabase(std::string builder);
};
diff --git a/Source/Ogda/Builders/copyaction.cpp b/Source/Ogda/Builders/copyaction.cpp
index 457dff9f..3d0f28a2 100644
--- a/Source/Ogda/Builders/copyaction.cpp
+++ b/Source/Ogda/Builders/copyaction.cpp
@@ -29,19 +29,17 @@
#include <string>
-ManifestResult CopyAction::Run(const JobHandler& jh, const Item& y)
-{
- LOGD << "Running CopyAction of " << y << std::endl;
+ManifestResult CopyAction::Run(const JobHandler& jh, const Item& y) {
+ LOGD << "Running CopyAction of " << y << std::endl;
std::string from = y.GetAbsPath();
- std::string to = AssemblePath( jh.output_folder, y.GetPath() );
+ std::string to = AssemblePath(jh.output_folder, y.GetPath());
- CreateParentDirs( to );
- int size = copyfile( from, to );
+ CreateParentDirs(to);
+ int size = copyfile(from, to);
LOGD << "Copy size " << size << std::endl;
- if( size <= 0 )
- {
+ if (size <= 0) {
LOGE << "Unable to copy item " << y << std::endl;
}
diff --git a/Source/Ogda/Builders/copyaction.h b/Source/Ogda/Builders/copyaction.h
index 8e585786..ee0e028e 100644
--- a/Source/Ogda/Builders/copyaction.h
+++ b/Source/Ogda/Builders/copyaction.h
@@ -28,10 +28,10 @@ class Item;
class JobHandler;
class CopyAction : public ActionBase {
- public:
- ManifestResult Run(const JobHandler& jh, const Item& y) override;
- inline const char* GetName() const override { return "copy"; }
- inline const char* GetVersion() const override {return "2";}
- inline bool RunEvenOnIdenticalSource() const override { return false; }
- inline bool StoreResultInDatabase() const override { return false; }
+ public:
+ ManifestResult Run(const JobHandler& jh, const Item& y) override;
+ inline const char* GetName() const override { return "copy"; }
+ inline const char* GetVersion() const override { return "2"; }
+ inline bool RunEvenOnIdenticalSource() const override { return false; }
+ inline bool StoreResultInDatabase() const override { return false; }
};
diff --git a/Source/Ogda/Builders/crunchaction.cpp b/Source/Ogda/Builders/crunchaction.cpp
index 9e8cad24..cd600cfc 100644
--- a/Source/Ogda/Builders/crunchaction.cpp
+++ b/Source/Ogda/Builders/crunchaction.cpp
@@ -32,14 +32,13 @@
#include <Internal/filesystem.h>
#include <Internal/datemodified.h>
-ManifestResult CrunchAction::Run(const JobHandler& jh, const Item& item)
-{
+ManifestResult CrunchAction::Run(const JobHandler& jh, const Item& item) {
std::string full_source_path = item.GetAbsPath();
std::string partial_dest_path = item.GetPath() + "_converted.crn";
- std::string full_dest_path = AssemblePath( jh.output_folder, partial_dest_path );
- std::string temp_path = AssemblePath( jh.output_folder, partial_dest_path + ".tmp" );
+ std::string full_dest_path = AssemblePath(jh.output_folder, partial_dest_path);
+ std::string temp_path = AssemblePath(jh.output_folder, partial_dest_path + ".tmp");
- bool suc = ConvertImage( full_source_path, full_dest_path, temp_path, TextureData::Nice );
+ bool suc = ConvertImage(full_source_path, full_dest_path, temp_path, TextureData::Nice);
return ManifestResult(jh, item, partial_dest_path, suc, *this, "dxt5");
}
diff --git a/Source/Ogda/Builders/crunchaction.h b/Source/Ogda/Builders/crunchaction.h
index 7422c868..8a45be83 100644
--- a/Source/Ogda/Builders/crunchaction.h
+++ b/Source/Ogda/Builders/crunchaction.h
@@ -28,10 +28,10 @@ class Item;
class JobHandler;
class CrunchAction : public ActionBase {
- public:
- ManifestResult Run(const JobHandler& jh, const Item& y) override;
- inline const char* GetName() const override { return "crunch"; }
- inline const char* GetVersion() const override {return "1";}
- inline bool RunEvenOnIdenticalSource() const override { return false; }
- inline bool StoreResultInDatabase() const override { return true; }
+ public:
+ ManifestResult Run(const JobHandler& jh, const Item& y) override;
+ inline const char* GetName() const override { return "crunch"; }
+ inline const char* GetVersion() const override { return "1"; }
+ inline bool RunEvenOnIdenticalSource() const override { return false; }
+ inline bool StoreResultInDatabase() const override { return true; }
};
diff --git a/Source/Ogda/Builders/dxt5action.cpp b/Source/Ogda/Builders/dxt5action.cpp
index ba8fd763..45e4d0b2 100644
--- a/Source/Ogda/Builders/dxt5action.cpp
+++ b/Source/Ogda/Builders/dxt5action.cpp
@@ -32,14 +32,13 @@
#include <Internal/filesystem.h>
#include <Internal/datemodified.h>
-ManifestResult DXT5Action::Run(const JobHandler& jh, const Item& item)
-{
+ManifestResult DXT5Action::Run(const JobHandler& jh, const Item& item) {
std::string full_source_path = item.GetAbsPath();
std::string partial_dest_path = item.GetPath() + "_converted.dds";
- std::string full_dest_path = AssemblePath( jh.output_folder, partial_dest_path );
- std::string temp_path = AssemblePath( jh.output_folder, partial_dest_path + ".tmp" );
+ std::string full_dest_path = AssemblePath(jh.output_folder, partial_dest_path);
+ std::string temp_path = AssemblePath(jh.output_folder, partial_dest_path + ".tmp");
- bool suc = ConvertImage( full_source_path, full_dest_path, temp_path, TextureData::Nice );
+ bool suc = ConvertImage(full_source_path, full_dest_path, temp_path, TextureData::Nice);
return ManifestResult(jh, item, partial_dest_path, suc, *this, "dxt5");
}
diff --git a/Source/Ogda/Builders/dxt5action.h b/Source/Ogda/Builders/dxt5action.h
index 06c1d53b..41180898 100644
--- a/Source/Ogda/Builders/dxt5action.h
+++ b/Source/Ogda/Builders/dxt5action.h
@@ -28,10 +28,10 @@ class Item;
class JobHandler;
class DXT5Action : public ActionBase {
- public:
- ManifestResult Run(const JobHandler& jh, const Item& y) override;
- inline const char* GetName() const override { return "dxt5"; }
- inline const char* GetVersion() const override {return "6";}
- inline bool RunEvenOnIdenticalSource() const override { return false; }
- inline bool StoreResultInDatabase() const override { return true; }
+ public:
+ ManifestResult Run(const JobHandler& jh, const Item& y) override;
+ inline const char* GetName() const override { return "dxt5"; }
+ inline const char* GetVersion() const override { return "6"; }
+ inline bool RunEvenOnIdenticalSource() const override { return false; }
+ inline bool StoreResultInDatabase() const override { return true; }
};
diff --git a/Source/Ogda/Builders/voidaction.cpp b/Source/Ogda/Builders/voidaction.cpp
index 2ffac6e5..319b61b4 100644
--- a/Source/Ogda/Builders/voidaction.cpp
+++ b/Source/Ogda/Builders/voidaction.cpp
@@ -25,7 +25,6 @@
#include <Logging/logdata.h>
#include <Ogda/item.h>
-ManifestResult VoidAction::Run(const JobHandler& jh, const Item& y)
-{
+ManifestResult VoidAction::Run(const JobHandler& jh, const Item& y) {
return ManifestResult(jh, y, std::string(""), true, *this, "void");
}
diff --git a/Source/Ogda/Builders/voidaction.h b/Source/Ogda/Builders/voidaction.h
index 7f18daf6..8ab24648 100644
--- a/Source/Ogda/Builders/voidaction.h
+++ b/Source/Ogda/Builders/voidaction.h
@@ -28,12 +28,11 @@
class Item;
class JobHandler;
-class VoidAction : public ActionBase
-{
- public:
- ManifestResult Run(const JobHandler& jh, const Item& y) override;
- inline const char* GetName() const override { return "void"; }
- inline const char* GetVersion() const override {return "2";}
- inline bool RunEvenOnIdenticalSource() const override { return true; }
- inline bool StoreResultInDatabase() const override { return false; }
+class VoidAction : public ActionBase {
+ public:
+ ManifestResult Run(const JobHandler& jh, const Item& y) override;
+ inline const char* GetName() const override { return "void"; }
+ inline const char* GetVersion() const override { return "2"; }
+ inline bool RunEvenOnIdenticalSource() const override { return true; }
+ inline bool StoreResultInDatabase() const override { return false; }
};
diff --git a/Source/Ogda/Generators/creatorbase.h b/Source/Ogda/Generators/creatorbase.h
index d85d3cc7..9b1347b0 100644
--- a/Source/Ogda/Generators/creatorbase.h
+++ b/Source/Ogda/Generators/creatorbase.h
@@ -30,10 +30,9 @@
class JobHandler;
class Item;
-class CreatorBase
-{
- public:
- virtual ManifestResult Run(const JobHandler& jh, const Manifest& manifest ) = 0;
- virtual const char* GetName() const = 0;
- virtual const char* GetVersion() const = 0;
+class CreatorBase {
+ public:
+ virtual ManifestResult Run(const JobHandler& jh, const Manifest& manifest) = 0;
+ virtual const char* GetName() const = 0;
+ virtual const char* GetVersion() const = 0;
};
diff --git a/Source/Ogda/Generators/generator.cpp b/Source/Ogda/Generators/generator.cpp
index ca8d4d57..78743b37 100644
--- a/Source/Ogda/Generators/generator.cpp
+++ b/Source/Ogda/Generators/generator.cpp
@@ -22,22 +22,18 @@
//-----------------------------------------------------------------------------
#include "generator.h"
-Generator::Generator( CreatorBase* creator )
-: creator(creator)
-{
+Generator::Generator(CreatorBase* creator)
+ : creator(creator) {
}
-ManifestResult Generator::Run(const JobHandler& jh, const Manifest& manifest)
-{
- return creator->Run(jh,manifest);
+ManifestResult Generator::Run(const JobHandler& jh, const Manifest& manifest) {
+ return creator->Run(jh, manifest);
}
-std::string Generator::GetGeneratorName() const
-{
+std::string Generator::GetGeneratorName() const {
return std::string(creator.GetConst().GetName());
}
-std::string Generator::GetGeneratorVersion() const
-{
+std::string Generator::GetGeneratorVersion() const {
return std::string(creator.GetConst().GetVersion());
}
diff --git a/Source/Ogda/Generators/generator.h b/Source/Ogda/Generators/generator.h
index e4668499..98ce7076 100644
--- a/Source/Ogda/Generators/generator.h
+++ b/Source/Ogda/Generators/generator.h
@@ -29,13 +29,13 @@
#include <Ogda/manifest.h>
#include <Internal/referencecounter.h>
-class Generator
-{
-public:
- Generator( CreatorBase* creation );
+class Generator {
+ public:
+ Generator(CreatorBase* creation);
ManifestResult Run(const JobHandler& jh, const Manifest& manifest);
std::string GetGeneratorName() const;
std::string GetGeneratorVersion() const;
-private:
+
+ private:
ReferenceCounter<CreatorBase> creator;
};
diff --git a/Source/Ogda/Generators/generatorfactory.cpp b/Source/Ogda/Generators/generatorfactory.cpp
index 0033a077..4ccc601a 100644
--- a/Source/Ogda/Generators/generatorfactory.cpp
+++ b/Source/Ogda/Generators/generatorfactory.cpp
@@ -30,48 +30,39 @@
#include <Logging/logdata.h>
-GeneratorFactory::GeneratorFactory()
-{
- creators.push_back( new CreatorFactory<VersionXMLCreator>() );
- creators.push_back( new CreatorFactory<ShortVersionCreator>() );
- creators.push_back( new CreatorFactory<LevelListCreator>() );
+GeneratorFactory::GeneratorFactory() {
+ creators.push_back(new CreatorFactory<VersionXMLCreator>());
+ creators.push_back(new CreatorFactory<ShortVersionCreator>());
+ creators.push_back(new CreatorFactory<LevelListCreator>());
}
-GeneratorFactory::~GeneratorFactory()
-{
+GeneratorFactory::~GeneratorFactory() {
std::vector<CreatorFactoryBase*>::iterator factoryit;
- for( factoryit = creators.begin(); factoryit != creators.end(); factoryit++ )
- {
+ for (factoryit = creators.begin(); factoryit != creators.end(); factoryit++) {
delete *factoryit;
}
creators.clear();
}
-bool GeneratorFactory::HasGenerator( const std::string& generator )
-{
+bool GeneratorFactory::HasGenerator(const std::string& generator) {
std::vector<CreatorFactoryBase*>::iterator factoryit;
- for( factoryit = creators.begin(); factoryit != creators.end(); factoryit++ )
- {
- if( (*factoryit)->GetCreatorName() == generator )
- {
+ for (factoryit = creators.begin(); factoryit != creators.end(); factoryit++) {
+ if ((*factoryit)->GetCreatorName() == generator) {
return true;
}
}
return false;
}
-Generator GeneratorFactory::CreateGenerator( const std::string& generator )
-{
+Generator GeneratorFactory::CreateGenerator(const std::string& generator) {
std::vector<CreatorFactoryBase*>::iterator factoryit;
- for( factoryit = creators.begin(); factoryit != creators.end(); factoryit++ )
- {
- if( (*factoryit)->GetCreatorName() == generator )
- {
+ for (factoryit = creators.begin(); factoryit != creators.end(); factoryit++) {
+ if ((*factoryit)->GetCreatorName() == generator) {
return Generator((*factoryit)->NewInstance());
}
}
LOGE << "Unable to find generator matching name " << generator << std::endl;
- return Generator( new VoidCreator() );
+ return Generator(new VoidCreator());
}
diff --git a/Source/Ogda/Generators/generatorfactory.h b/Source/Ogda/Generators/generatorfactory.h
index 74204b9d..ec533a7a 100644
--- a/Source/Ogda/Generators/generatorfactory.h
+++ b/Source/Ogda/Generators/generatorfactory.h
@@ -26,34 +26,30 @@
#include <vector>
-class GeneratorFactory
-{
-private:
- class CreatorFactoryBase
- {
- public:
+class GeneratorFactory {
+ private:
+ class CreatorFactoryBase {
+ public:
virtual CreatorBase* NewInstance() = 0;
virtual std::string GetCreatorName() = 0;
};
- template<class Creator>
- class CreatorFactory : public CreatorFactoryBase
- {
- CreatorBase* NewInstance() override
- {
+ template <class Creator>
+ class CreatorFactory : public CreatorFactoryBase {
+ CreatorBase* NewInstance() override {
return new Creator();
}
- std::string GetCreatorName() override
- {
+ std::string GetCreatorName() override {
return std::string(Creator().GetName());
}
};
std::vector<CreatorFactoryBase*> creators;
-public:
+
+ public:
GeneratorFactory();
~GeneratorFactory();
- bool HasGenerator( const std::string& generator );
- Generator CreateGenerator( const std::string& generator );
+ bool HasGenerator(const std::string& generator);
+ Generator CreateGenerator(const std::string& generator);
};
diff --git a/Source/Ogda/Generators/levellistcreator.cpp b/Source/Ogda/Generators/levellistcreator.cpp
index 41fd4f66..a9f40c52 100644
--- a/Source/Ogda/Generators/levellistcreator.cpp
+++ b/Source/Ogda/Generators/levellistcreator.cpp
@@ -31,24 +31,22 @@
#include <Internal/filesystem.h>
#include <Ogda/jobhandler.h>
-ManifestResult LevelListCreator::Run(const JobHandler& jh, const Manifest& manifest)
-{
+ManifestResult LevelListCreator::Run(const JobHandler& jh, const Manifest& manifest) {
std::string destination("level_list");
- std::string full_path = AssemblePath( jh.output_folder, destination );
+ std::string full_path = AssemblePath(jh.output_folder, destination);
- std::ofstream f( full_path.c_str(), std::ios::out | std::ios::binary );
+ std::ofstream f(full_path.c_str(), std::ios::out | std::ios::binary);
LOGI << "Writing level_list: " << full_path << std::endl;
std::vector<ManifestResult>::const_iterator itr = manifest.ResultsBegin();
-
- for( ;itr != manifest.ResultsEnd(); itr++ )
- {
- if( itr->type == "level" )
+
+ for (; itr != manifest.ResultsEnd(); itr++) {
+ if (itr->type == "level")
f << itr->dest << std::endl;
}
-
+
f.close();
return ManifestResult(jh, destination, true, *this, "level_list");
diff --git a/Source/Ogda/Generators/levellistcreator.h b/Source/Ogda/Generators/levellistcreator.h
index 7df4a795..a7bc93b6 100644
--- a/Source/Ogda/Generators/levellistcreator.h
+++ b/Source/Ogda/Generators/levellistcreator.h
@@ -27,10 +27,9 @@
class JobHandler;
-class LevelListCreator : public CreatorBase
-{
- public:
- ManifestResult Run(const JobHandler& jh, const Manifest& manifest) override;
- inline const char* GetName() const override { return "levellist"; }
- inline const char* GetVersion() const override {return "1";}
+class LevelListCreator : public CreatorBase {
+ public:
+ ManifestResult Run(const JobHandler& jh, const Manifest& manifest) override;
+ inline const char* GetName() const override { return "levellist"; }
+ inline const char* GetVersion() const override { return "1"; }
};
diff --git a/Source/Ogda/Generators/shortversioncreator.cpp b/Source/Ogda/Generators/shortversioncreator.cpp
index a4050e77..1189a1d1 100644
--- a/Source/Ogda/Generators/shortversioncreator.cpp
+++ b/Source/Ogda/Generators/shortversioncreator.cpp
@@ -31,19 +31,18 @@
#include <Internal/filesystem.h>
#include <Ogda/jobhandler.h>
-ManifestResult ShortVersionCreator::Run(const JobHandler& jh, const Manifest& manifest)
-{
+ManifestResult ShortVersionCreator::Run(const JobHandler& jh, const Manifest& manifest) {
std::string destination("short_version");
- std::string full_path = AssemblePath( jh.output_folder, destination );
+ std::string full_path = AssemblePath(jh.output_folder, destination);
- std::ofstream f( full_path.c_str(), std::ios::out | std::ios::binary );
+ std::ofstream f(full_path.c_str(), std::ios::out | std::ios::binary);
LOGI << "Writing short_version: " << full_path << std::endl;
f << GetBuildVersion() << std::endl;
-
+
f.close();
- return ManifestResult(jh, destination, true, *this,"short_version");
+ return ManifestResult(jh, destination, true, *this, "short_version");
}
diff --git a/Source/Ogda/Generators/shortversioncreator.h b/Source/Ogda/Generators/shortversioncreator.h
index eea84cde..d94d1d55 100644
--- a/Source/Ogda/Generators/shortversioncreator.h
+++ b/Source/Ogda/Generators/shortversioncreator.h
@@ -27,10 +27,9 @@
class JobHandler;
-class ShortVersionCreator : public CreatorBase
-{
- public:
- ManifestResult Run(const JobHandler& jh, const Manifest& manifest) override;
- inline const char* GetName() const override { return "shortversion"; }
- inline const char* GetVersion() const override {return "1";}
+class ShortVersionCreator : public CreatorBase {
+ public:
+ ManifestResult Run(const JobHandler& jh, const Manifest& manifest) override;
+ inline const char* GetName() const override { return "shortversion"; }
+ inline const char* GetVersion() const override { return "1"; }
};
diff --git a/Source/Ogda/Generators/versionxmlcreator.cpp b/Source/Ogda/Generators/versionxmlcreator.cpp
index 9c9659a1..0745ccac 100644
--- a/Source/Ogda/Generators/versionxmlcreator.cpp
+++ b/Source/Ogda/Generators/versionxmlcreator.cpp
@@ -31,67 +31,65 @@
#include <Logging/logdata.h>
#include <Internal/filesystem.h>
-ManifestResult VersionXMLCreator::Run(const JobHandler& jh, const Manifest& manifest)
-{
+ManifestResult VersionXMLCreator::Run(const JobHandler& jh, const Manifest& manifest) {
std::string destination("version.xml");
TiXmlDocument doc;
- //TiXmlDeclaration * decl = new TiXmlDeclaration( "2.0", "", "" );
- TiXmlElement * root = new TiXmlElement( "release" );
+ // TiXmlDeclaration * decl = new TiXmlDeclaration( "2.0", "", "" );
+ TiXmlElement* root = new TiXmlElement("release");
{
- std::stringstream ss;
+ std::stringstream ss;
- ss << 100000 + GetBuildID();
- TiXmlElement* eVersion = new TiXmlElement( "version" );
- eVersion->LinkEndChild( new TiXmlText( ss.str().c_str() ) );
- root->LinkEndChild(eVersion);
+ ss << 100000 + GetBuildID();
+ TiXmlElement* eVersion = new TiXmlElement("version");
+ eVersion->LinkEndChild(new TiXmlText(ss.str().c_str()));
+ root->LinkEndChild(eVersion);
}
{
- TiXmlElement* eName = new TiXmlElement( "name" );
- eName->LinkEndChild( new TiXmlText( GetBuildVersion() ) );
- root->LinkEndChild(eName);
+ TiXmlElement* eName = new TiXmlElement("name");
+ eName->LinkEndChild(new TiXmlText(GetBuildVersion()));
+ root->LinkEndChild(eName);
}
{
- TiXmlElement* eShortname = new TiXmlElement( "shortname" );
- eShortname->LinkEndChild( new TiXmlText( GetBuildVersion() ) );
- root->LinkEndChild(eShortname);
+ TiXmlElement* eShortname = new TiXmlElement("shortname");
+ eShortname->LinkEndChild(new TiXmlText(GetBuildVersion()));
+ root->LinkEndChild(eShortname);
}
-
+
{
- TiXmlElement* eDate = new TiXmlElement( "date" );
- eDate->LinkEndChild( new TiXmlText( GetBuildTimestamp() ) );
- root->LinkEndChild(eDate);
+ TiXmlElement* eDate = new TiXmlElement("date");
+ eDate->LinkEndChild(new TiXmlText(GetBuildTimestamp()));
+ root->LinkEndChild(eDate);
}
{
- TiXmlElement* eRev = new TiXmlElement( "rev" );
- eRev->LinkEndChild( new TiXmlText( "9999" ) );
- root->LinkEndChild(eRev);
+ TiXmlElement* eRev = new TiXmlElement("rev");
+ eRev->LinkEndChild(new TiXmlText("9999"));
+ root->LinkEndChild(eRev);
}
{
- TiXmlElement* eSvnrev = new TiXmlElement( "svnrev" );
- eSvnrev->LinkEndChild( new TiXmlText( "9999" ) );
- root->LinkEndChild(eSvnrev);
+ TiXmlElement* eSvnrev = new TiXmlElement("svnrev");
+ eSvnrev->LinkEndChild(new TiXmlText("9999"));
+ root->LinkEndChild(eSvnrev);
}
{
- std::stringstream ss;
- ss << GetBuildID();
- std::string sss = ss.str();
- TiXmlElement* e = new TiXmlElement( "build" );
- e->LinkEndChild( new TiXmlText( sss.c_str() ) );
- root->LinkEndChild(e);
+ std::stringstream ss;
+ ss << GetBuildID();
+ std::string sss = ss.str();
+ TiXmlElement* e = new TiXmlElement("build");
+ e->LinkEndChild(new TiXmlText(sss.c_str()));
+ root->LinkEndChild(e);
}
- //doc.LinkEndChild( decl );
- doc.LinkEndChild( root );
- std::string full_name = AssemblePath( jh.output_folder, destination );
- doc.SaveFile( full_name.c_str() );
+ // doc.LinkEndChild( decl );
+ doc.LinkEndChild(root);
+ std::string full_name = AssemblePath(jh.output_folder, destination);
+ doc.SaveFile(full_name.c_str());
return ManifestResult(jh, destination, !doc.Error(), *this, "version");
}
-
diff --git a/Source/Ogda/Generators/versionxmlcreator.h b/Source/Ogda/Generators/versionxmlcreator.h
index 9e38e2a5..df93249d 100644
--- a/Source/Ogda/Generators/versionxmlcreator.h
+++ b/Source/Ogda/Generators/versionxmlcreator.h
@@ -27,10 +27,9 @@
class JobHandler;
-class VersionXMLCreator : public CreatorBase
-{
- public:
- ManifestResult Run(const JobHandler& jh, const Manifest& manifest) override;
- inline const char* GetName() const override { return "versionxml"; }
- inline const char* GetVersion() const override {return "1";}
+class VersionXMLCreator : public CreatorBase {
+ public:
+ ManifestResult Run(const JobHandler& jh, const Manifest& manifest) override;
+ inline const char* GetName() const override { return "versionxml"; }
+ inline const char* GetVersion() const override { return "1"; }
};
diff --git a/Source/Ogda/Generators/voidcreator.cpp b/Source/Ogda/Generators/voidcreator.cpp
index 53c56fec..f9b34a09 100644
--- a/Source/Ogda/Generators/voidcreator.cpp
+++ b/Source/Ogda/Generators/voidcreator.cpp
@@ -22,7 +22,6 @@
//-----------------------------------------------------------------------------
#include "voidcreator.h"
-ManifestResult VoidCreator::Run(const JobHandler& jh, const Manifest& manifest)
-{
- return ManifestResult(jh, std::string(""), false, *this,"void");
+ManifestResult VoidCreator::Run(const JobHandler& jh, const Manifest& manifest) {
+ return ManifestResult(jh, std::string(""), false, *this, "void");
}
diff --git a/Source/Ogda/Generators/voidcreator.h b/Source/Ogda/Generators/voidcreator.h
index 30b833c6..e9e2e6a7 100644
--- a/Source/Ogda/Generators/voidcreator.h
+++ b/Source/Ogda/Generators/voidcreator.h
@@ -27,10 +27,9 @@
class JobHandler;
-class VoidCreator : public CreatorBase
-{
- public:
- ManifestResult Run(const JobHandler& jh, const Manifest& manifest) override;
- inline const char* GetName() const override { return "void"; }
- inline const char* GetVersion() const override {return "1";}
+class VoidCreator : public CreatorBase {
+ public:
+ ManifestResult Run(const JobHandler& jh, const Manifest& manifest) override;
+ inline const char* GetName() const override { return "void"; }
+ inline const char* GetVersion() const override { return "1"; }
};
diff --git a/Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.cpp b/Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.cpp
index cdba6d93..efefe208 100644
--- a/Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.cpp
+++ b/Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.cpp
@@ -33,69 +33,49 @@
#include <tinyxml.h>
void AttributeScanner::Do(
- std::vector<Item>& items,
- const Item& item,
- TiXmlElement *eElem,
- const std::vector<attribpair>& attribs,
- const std::vector<const char*>& attribs_ignore)
-{
- if( eElem )
- {
- TiXmlAttribute *aV = eElem->FirstAttribute();
- while( aV )
- {
+ std::vector<Item>& items,
+ const Item& item,
+ TiXmlElement* eElem,
+ const std::vector<attribpair>& attribs,
+ const std::vector<const char*>& attribs_ignore) {
+ if (eElem) {
+ TiXmlAttribute* aV = eElem->FirstAttribute();
+ while (aV) {
int id = -1;
- if((id = FindStringInArray( attribs, aV->Name() )) >= 0 )
- {
- if( aV->Value() && strlen( aV->Value() ) > 0 )
- {
+ if ((id = FindStringInArray(attribs, aV->Name())) >= 0) {
+ if (aV->Value() && strlen(aV->Value()) > 0) {
items.push_back(Item(item.input_folder, aV->Value(), attribs[id].second, item.source));
- }
- else
- {
+ } else {
LOGD << "Value is empty in " << item << std::endl;
}
- }
- else if( FindStringInArray( attribs_ignore, aV->Name() ) < 0 )
- {
+ } else if (FindStringInArray(attribs_ignore, aV->Name()) < 0) {
LOGE << "Unhandled attrib on row " << aV->Row() << " " << aV->Name() << " in " << item << std::endl;
}
aV = aV->Next();
}
- }
- else
- {
+ } else {
LOGE << "Root element is null for " << item << std::endl;
}
}
void AttributeScanner::DoAllSame(
- std::vector<Item>& items,
- const Item& item,
- TiXmlElement *eElem,
- std::string type )
-{
- if( eElem )
- {
- TiXmlAttribute *aV = eElem->FirstAttribute();
- while( aV )
- {
- if( aV->Value() && strlen( aV->Value() ) > 0 )
- {
+ std::vector<Item>& items,
+ const Item& item,
+ TiXmlElement* eElem,
+ std::string type) {
+ if (eElem) {
+ TiXmlAttribute* aV = eElem->FirstAttribute();
+ while (aV) {
+ if (aV->Value() && strlen(aV->Value()) > 0) {
items.push_back(Item(item.input_folder, aV->Value(), type, item.source));
- }
- else
- {
+ } else {
LOGD << "Value is empty in " << item << std::endl;
}
aV = aV->Next();
}
- }
- else
- {
+ } else {
LOGE << "Root element is null for " << item << std::endl;
}
}
-
diff --git a/Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.h b/Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.h
index 9fbd26c5..086f4aed 100644
--- a/Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.h
+++ b/Source/Ogda/Searchers/Seekers/SeekerTools/attributescanner.h
@@ -31,20 +31,18 @@ class Item;
typedef std::pair<const char*, const char*> attribpair;
-class AttributeScanner
-{
-public:
-static void Do(
- std::vector<Item>& items,
- const Item& item,
- TiXmlElement *eElem,
- const std::vector<attribpair>& attribs,
- const std::vector<const char*>& attribs_ignore);
+class AttributeScanner {
+ public:
+ static void Do(
+ std::vector<Item>& items,
+ const Item& item,
+ TiXmlElement* eElem,
+ const std::vector<attribpair>& attribs,
+ const std::vector<const char*>& attribs_ignore);
-static void DoAllSame(
- std::vector<Item>& items,
- const Item& item,
- TiXmlElement *eElem,
- std::string type );
+ static void DoAllSame(
+ std::vector<Item>& items,
+ const Item& item,
+ TiXmlElement* eElem,
+ std::string type);
};
-
diff --git a/Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.cpp b/Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.cpp
index a30d43f0..75a174b6 100644
--- a/Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.cpp
+++ b/Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.cpp
@@ -34,54 +34,38 @@
#include <tinyxml.h>
void ElementScanner::Do(
- std::vector<Item>& items,
- const Item& item,
- TiXmlNode *eRoot,
- const std::vector<elempair>& elems,
+ std::vector<Item>& items,
+ const Item& item,
+ TiXmlNode* eRoot,
+ const std::vector<elempair>& elems,
const std::vector<const char*>& elems_ignore,
XMLSeekerBase* callback,
- void* userdata
- )
-{
- if( eRoot )
- {
+ void* userdata) {
+ if (eRoot) {
TiXmlElement* eElem = eRoot->FirstChildElement();
- while( eElem )
- {
+ while (eElem) {
const char* name = eElem->Value();
const char* text = eElem->GetText();
- if( name )
- {
+ if (name) {
int id;
- if( (id = FindStringInArray( elems, name )) >= 0 )
- {
- if( strlen( elems[id].second ) > 0 )
- {
- if( text && strlen(text) > 0 )
- {
- items.push_back(Item(item.input_folder, text,elems[id].second,item.source));
- }
- else
- {
+ if ((id = FindStringInArray(elems, name)) >= 0) {
+ if (strlen(elems[id].second) > 0) {
+ if (text && strlen(text) > 0) {
+ items.push_back(Item(item.input_folder, text, elems[id].second, item.source));
+ } else {
LOGW << "String value in " << item << " for element " << elems[id].first << " is empty, row " << eElem->Row() << std::endl;
}
}
- if( callback )
- callback->HandleElementCallback(items,eRoot,eElem,item,userdata);
- }
- else if( (id = FindStringInArray( elems_ignore, name )) >= 0 )
- {
+ if (callback)
+ callback->HandleElementCallback(items, eRoot, eElem, item, userdata);
+ } else if ((id = FindStringInArray(elems_ignore, name)) >= 0) {
LOGD << "Ignored " << elems_ignore[id] << " in " << item << " row " << eElem->Row() << std::endl;
- }
- else
- {
+ } else {
LOGE << "Unahandled subvalue from " << item << " called " << name << " row " << eElem->Row() << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Generic warning" << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.h b/Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.h
index d7144261..d140914d 100644
--- a/Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.h
+++ b/Source/Ogda/Searchers/Seekers/SeekerTools/elementscanner.h
@@ -32,16 +32,14 @@ class XMLSeekerBase;
typedef std::pair<const char*, const char*> elempair;
-class ElementScanner
-{
-public:
-static void Do(
- std::vector<Item>& items,
- const Item& item,
- TiXmlNode *eRoot,
- const std::vector<elempair>& elems,
- const std::vector<const char*>& elems_ignore,
- XMLSeekerBase* callback,
- void* userdata
- );
+class ElementScanner {
+ public:
+ static void Do(
+ std::vector<Item>& items,
+ const Item& item,
+ TiXmlNode* eRoot,
+ const std::vector<elempair>& elems,
+ const std::vector<const char*>& elems_ignore,
+ XMLSeekerBase* callback,
+ void* userdata);
};
diff --git a/Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.cpp b/Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.cpp
index 40c93734..acfbe9cb 100644
--- a/Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.cpp
+++ b/Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.cpp
@@ -34,50 +34,34 @@
#include <tinyxml.h>
void ParameterScanner::Do(
- std::vector<Item>& items,
- const Item& item,
- TiXmlNode *eRoot,
- const std::vector<parampair>& params,
- const std::vector<const char*>& params_ignore
- )
-{
- if( eRoot )
- {
+ std::vector<Item>& items,
+ const Item& item,
+ TiXmlNode* eRoot,
+ const std::vector<parampair>& params,
+ const std::vector<const char*>& params_ignore) {
+ if (eRoot) {
TiXmlElement* eElem = eRoot->FirstChildElement();
- while( eElem )
- {
+ while (eElem) {
const char* name = eElem->Attribute("name");
const char* text = eElem->Attribute("val");
- if( name )
- {
+ if (name) {
int id;
- if( (id = FindStringInArray( params, name )) >= 0 )
- {
- if( strlen( params[id].second ) > 0 )
- {
- if( text && strlen(text) > 0 )
- {
- items.push_back(Item(item.input_folder,text,params[id].second,item.source));
- }
- else
- {
+ if ((id = FindStringInArray(params, name)) >= 0) {
+ if (strlen(params[id].second) > 0) {
+ if (text && strlen(text) > 0) {
+ items.push_back(Item(item.input_folder, text, params[id].second, item.source));
+ } else {
LOGW << "String value in " << item << " for element " << params[id].first << " is empty, row " << eElem->Row() << std::endl;
}
}
- }
- else if( (id = FindStringInArray( params_ignore, name )) >= 0 )
- {
+ } else if ((id = FindStringInArray(params_ignore, name)) >= 0) {
LOGD << "Ignored " << params_ignore[id] << " in " << item << " row " << eElem->Row() << std::endl;
- }
- else
- {
+ } else {
LOGE << "Unahandled subvalue from " << item << " called " << name << " row " << eElem->Row() << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Generic warning" << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.h b/Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.h
index 92f52269..e65065c1 100644
--- a/Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.h
+++ b/Source/Ogda/Searchers/Seekers/SeekerTools/parameterscanner.h
@@ -32,14 +32,12 @@ class XMLSeekerBase;
typedef std::pair<const char*, const char*> parampair;
-class ParameterScanner
-{
-public:
-static void Do(
- std::vector<Item>& items,
- const Item& item,
- TiXmlNode *eRoot,
- const std::vector<parampair>& params,
- const std::vector<const char*>& params_ignore
- );
+class ParameterScanner {
+ public:
+ static void Do(
+ std::vector<Item>& items,
+ const Item& item,
+ TiXmlNode* eRoot,
+ const std::vector<parampair>& params,
+ const std::vector<const char*>& params_ignore);
};
diff --git a/Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.cpp b/Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.cpp
index b2351e8b..d0ea7787 100644
--- a/Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.cpp
@@ -28,111 +28,89 @@
#include <Internal/filesystem.h>
#include <Logging/logdata.h>
-#define ARRLEN(arr) sizeof(arr)/sizeof(arr[0])
+#define ARRLEN(arr) sizeof(arr) / sizeof(arr[0])
-struct Parameter
-{
+struct Parameter {
const char* name;
const char* type;
bool ignored;
- bool into_file;
+ bool into_file;
const char* ignored_value;
-public:
- Parameter(const char* name, const char* type, bool ignored, bool into_file) : name(name), type(type), ignored(ignored), into_file(into_file), ignored_value(NULL) {};
- Parameter(const char* name, const char* type, bool ignored, bool into_file, const char* ignored_value) : name(name), type(type), ignored(ignored), into_file(into_file), ignored_value(ignored_value){ };
+ public:
+ Parameter(const char* name, const char* type, bool ignored, bool into_file) : name(name), type(type), ignored(ignored), into_file(into_file), ignored_value(NULL){};
+ Parameter(const char* name, const char* type, bool ignored, bool into_file, const char* ignored_value) : name(name), type(type), ignored(ignored), into_file(into_file), ignored_value(ignored_value){};
- bool Search(std::vector<Item>& items, const Item& item, TiXmlElement* el )
- {
+ bool Search(std::vector<Item>& items, const Item& item, TiXmlElement* el) {
const char* name_str = el->Attribute("name");
const char* val_str = el->Attribute("val");
- if( name_str )
- {
- if(strcmp(name_str, name) == 0 )
- {
- if( !ignored )
- {
- if( ignored_value == NULL || strcmp(ignored_value,val_str) != 0 )
- {
- if( into_file )
- {
- Item i(item.input_folder, DumpIntoFile( val_str, strlen( val_str ) ), type, item.source);
+ if (name_str) {
+ if (strcmp(name_str, name) == 0) {
+ if (!ignored) {
+ if (ignored_value == NULL || strcmp(ignored_value, val_str) != 0) {
+ if (into_file) {
+ Item i(item.input_folder, DumpIntoFile(val_str, strlen(val_str)), type, item.source);
i.SetOnlySearch(true);
i.SetDeleteOnExit(true);
items.push_back(i);
- }
- else
- {
+ } else {
items.push_back(Item(item.input_folder, val_str, type, item.source));
}
}
}
-
+
return true;
}
- }
- else
- {
- LOGE << "Missing attribute name on row " << el->Row() << " in " << item << std::endl;
+ } else {
+ LOGE << "Missing attribute name on row " << el->Row() << " in " << item << std::endl;
}
return false;
}
};
-struct ActorObject
-{
+struct ActorObject {
const char* name;
const char* type;
bool ignored;
std::vector<Parameter> parameters;
-public:
- ActorObject( const char* name, const char* type, bool ignored, std::vector<Parameter> parameters ) : name(name), type(type), ignored(ignored), parameters( parameters ){};
+ public:
+ ActorObject(const char* name, const char* type, bool ignored, std::vector<Parameter> parameters) : name(name), type(type), ignored(ignored), parameters(parameters){};
- bool Search(std::vector<Item>& items, const Item& item, TiXmlElement* eao)
- {
- if( strcmp(eao->Value(), name) == 0 )
- {
- const char* t = eao->Attribute("type_file");
+ bool Search(std::vector<Item>& items, const Item& item, TiXmlElement* eao) {
+ if (strcmp(eao->Value(), name) == 0) {
+ const char* t = eao->Attribute("type_file");
- if( !t ) {
- t = eao->Attribute("prefab_path");
+ if (!t) {
+ t = eao->Attribute("prefab_path");
}
- if( !ignored )
- {
- if( t )
- {
+ if (!ignored) {
+ if (t) {
items.push_back(Item(item.input_folder, t, type, item.source));
+ } else {
+ LOGE << "Missing attribute type_file/prefab_path on row " << eao->Row() << " in " << item << std::endl;
}
- else
- {
- LOGE << "Missing attribute type_file/prefab_path on row " << eao->Row() << " in " << item << std::endl;
- }
}
- TiXmlElement* p = eao->FirstChildElement( "parameters" );
-
- if( p )
- {
+ TiXmlElement* p = eao->FirstChildElement("parameters");
+
+ if (p) {
TiXmlElement* el = p->FirstChildElement();
- while( el )
- {
+ while (el) {
bool found = false;
- for(auto & parameter : parameters)
- {
+ for (auto& parameter : parameters) {
found |= parameter.Search(
- items,
- item,
+ items,
+ item,
el);
}
- if( !found )
- {
+ if (!found) {
const char* name_str = el->Attribute("name");
- LOGW << "Missing attribute handler for name \"" << name_str << "\" on row " << eao->Row() << " in " << item << std::endl;
+ LOGW << "Missing attribute handler for name \"" << name_str << "\" on row " << eao->Row() << " in " << item << std::endl;
}
el = el->NextSiblingElement();
@@ -140,215 +118,211 @@ public:
}
return true;
- }
- else
- {
+ } else {
return false;
}
}
};
-void ActorObjectLevelSeeker::SearchGroup( std::vector<Item>& items, const Item& item, TiXmlElement* root )
-{
+void ActorObjectLevelSeeker::SearchGroup(std::vector<Item>& items, const Item& item, TiXmlElement* root) {
std::vector<Parameter> global_params;
-
- global_params.push_back( Parameter("Type", "", true, false));
- global_params.push_back( Parameter("Exclamation Character", "", true, false));
- global_params.push_back( Parameter("Hearing Modifier", "", true, false));
- global_params.push_back( Parameter("goal_0_post", "", true, false));
- global_params.push_back( Parameter("goal_1_post", "", true, false));
- global_params.push_back( Parameter("goal_2_post", "", true, false));
-
- global_params.push_back( Parameter("goal_0_pre", "", true, false));
- global_params.push_back( Parameter("goal_1_pre", "", true, false));
- global_params.push_back( Parameter("goal_2_pre", "", true, false));
- global_params.push_back( Parameter("goal_3_pre", "", true, false));
- global_params.push_back( Parameter("goal_4_pre", "", true, false));
- global_params.push_back( Parameter("goal_5_pre", "", true, false));
- global_params.push_back( Parameter("goal_6_pre", "", true, false));
- global_params.push_back( Parameter("goal_7_pre", "", true, false));
- global_params.push_back( Parameter("goal_8_pre", "", true, false));
- global_params.push_back( Parameter("goal_9_pre", "", true, false));
- global_params.push_back( Parameter("goal_10_pre", "", true, false));
- global_params.push_back( Parameter("goal_11_pre", "", true, false));
- global_params.push_back( Parameter("goal_12_pre", "", true, false));
- global_params.push_back( Parameter("goal_13_pre", "", true, false));
- global_params.push_back( Parameter("goal_14_pre", "", true, false));
- global_params.push_back( Parameter("goal_15_pre", "", true, false));
- global_params.push_back( Parameter("goal_16_pre", "", true, false));
- global_params.push_back( Parameter("goal_17_pre", "", true, false));
-
- global_params.push_back( Parameter("goal_0_post", "", true, false));
- global_params.push_back( Parameter("goal_1_post", "", true, false));
- global_params.push_back( Parameter("goal_2_post", "", true, false));
- global_params.push_back( Parameter("goal_3_post", "", true, false));
- global_params.push_back( Parameter("goal_4_post", "", true, false));
- global_params.push_back( Parameter("goal_5_post", "", true, false));
- global_params.push_back( Parameter("goal_6_post", "", true, false));
- global_params.push_back( Parameter("goal_7_post", "", true, false));
- global_params.push_back( Parameter("goal_8_post", "", true, false));
- global_params.push_back( Parameter("goal_9_post", "", true, false));
- global_params.push_back( Parameter("goal_10_post", "", true, false));
- global_params.push_back( Parameter("goal_11_post", "", true, false));
- global_params.push_back( Parameter("goal_12_post", "", true, false));
- global_params.push_back( Parameter("goal_13_post", "", true, false));
- global_params.push_back( Parameter("goal_14_post", "", true, false));
- global_params.push_back( Parameter("goal_15_post", "", true, false));
- global_params.push_back( Parameter("goal_16_post", "", true, false));
- global_params.push_back( Parameter("goal_17_post", "", true, false));
-
- global_params.push_back( Parameter("goal_0", "", true, false));
- global_params.push_back( Parameter("goal_1", "", true, false));
- global_params.push_back( Parameter("goal_2", "", true, false));
- global_params.push_back( Parameter("goal_3", "", true, false));
- global_params.push_back( Parameter("goal_4", "", true, false));
- global_params.push_back( Parameter("goal_5", "", true, false));
- global_params.push_back( Parameter("goal_6", "", true, false));
- global_params.push_back( Parameter("goal_7", "", true, false));
- global_params.push_back( Parameter("goal_8", "", true, false));
- global_params.push_back( Parameter("goal_9", "", true, false));
- global_params.push_back( Parameter("goal_10", "", true, false));
- global_params.push_back( Parameter("goal_11", "", true, false));
- global_params.push_back( Parameter("goal_12", "", true, false));
- global_params.push_back( Parameter("goal_13", "", true, false));
- global_params.push_back( Parameter("goal_14", "", true, false));
- global_params.push_back( Parameter("goal_15", "", true, false));
- global_params.push_back( Parameter("goal_16", "", true, false));
- global_params.push_back( Parameter("goal_17", "", true, false));
-
- global_params.push_back( Parameter("Stick To Nav Mesh", "", true, false));
-
- global_params.push_back( Parameter("fall_death", "", true, false));
- global_params.push_back( Parameter("fall_damage_mult", "", true, false));
-
- global_params.push_back( Parameter("time", "", true, false));
-
- global_params.push_back( Parameter("Display Text", "", true, false));
-
- global_params.push_back( Parameter("KillNPC", "", true, false));
- global_params.push_back( Parameter("KillPlayer", "", true, false));
- global_params.push_back( Parameter("characters", "", true, false));
-
- global_params.push_back( Parameter("Start Disabled", "", true, false));
-
- global_params.push_back( Parameter("Throw Counter Probability", "", true, false));
- global_params.push_back( Parameter("Throw Trainer", "", true, false));
- global_params.push_back( Parameter("Weapon Catch Skill", "", true, false));
-
- global_params.push_back( Parameter("SavedTransform", "", true, false));
-
- global_params.push_back( Parameter("rotation_scale", "", true, false));
- global_params.push_back( Parameter("time_scale", "", true, false));
- global_params.push_back( Parameter("translation_scale", "", true, false));
-
- global_params.push_back( Parameter("music_layer_override", "", true, false));
-
- global_params.push_back( Parameter("Invisible When Stationary", "", true, false));
-
- global_params.push_back( Parameter("No Look Around", "", true, false));
-
- global_params.push_back( Parameter("Short", "", true, false));
- global_params.push_back( Parameter("Offset", "", true, false));
- global_params.push_back( Parameter("Lethal", "", true, false));
+
+ global_params.push_back(Parameter("Type", "", true, false));
+ global_params.push_back(Parameter("Exclamation Character", "", true, false));
+ global_params.push_back(Parameter("Hearing Modifier", "", true, false));
+ global_params.push_back(Parameter("goal_0_post", "", true, false));
+ global_params.push_back(Parameter("goal_1_post", "", true, false));
+ global_params.push_back(Parameter("goal_2_post", "", true, false));
+
+ global_params.push_back(Parameter("goal_0_pre", "", true, false));
+ global_params.push_back(Parameter("goal_1_pre", "", true, false));
+ global_params.push_back(Parameter("goal_2_pre", "", true, false));
+ global_params.push_back(Parameter("goal_3_pre", "", true, false));
+ global_params.push_back(Parameter("goal_4_pre", "", true, false));
+ global_params.push_back(Parameter("goal_5_pre", "", true, false));
+ global_params.push_back(Parameter("goal_6_pre", "", true, false));
+ global_params.push_back(Parameter("goal_7_pre", "", true, false));
+ global_params.push_back(Parameter("goal_8_pre", "", true, false));
+ global_params.push_back(Parameter("goal_9_pre", "", true, false));
+ global_params.push_back(Parameter("goal_10_pre", "", true, false));
+ global_params.push_back(Parameter("goal_11_pre", "", true, false));
+ global_params.push_back(Parameter("goal_12_pre", "", true, false));
+ global_params.push_back(Parameter("goal_13_pre", "", true, false));
+ global_params.push_back(Parameter("goal_14_pre", "", true, false));
+ global_params.push_back(Parameter("goal_15_pre", "", true, false));
+ global_params.push_back(Parameter("goal_16_pre", "", true, false));
+ global_params.push_back(Parameter("goal_17_pre", "", true, false));
+
+ global_params.push_back(Parameter("goal_0_post", "", true, false));
+ global_params.push_back(Parameter("goal_1_post", "", true, false));
+ global_params.push_back(Parameter("goal_2_post", "", true, false));
+ global_params.push_back(Parameter("goal_3_post", "", true, false));
+ global_params.push_back(Parameter("goal_4_post", "", true, false));
+ global_params.push_back(Parameter("goal_5_post", "", true, false));
+ global_params.push_back(Parameter("goal_6_post", "", true, false));
+ global_params.push_back(Parameter("goal_7_post", "", true, false));
+ global_params.push_back(Parameter("goal_8_post", "", true, false));
+ global_params.push_back(Parameter("goal_9_post", "", true, false));
+ global_params.push_back(Parameter("goal_10_post", "", true, false));
+ global_params.push_back(Parameter("goal_11_post", "", true, false));
+ global_params.push_back(Parameter("goal_12_post", "", true, false));
+ global_params.push_back(Parameter("goal_13_post", "", true, false));
+ global_params.push_back(Parameter("goal_14_post", "", true, false));
+ global_params.push_back(Parameter("goal_15_post", "", true, false));
+ global_params.push_back(Parameter("goal_16_post", "", true, false));
+ global_params.push_back(Parameter("goal_17_post", "", true, false));
+
+ global_params.push_back(Parameter("goal_0", "", true, false));
+ global_params.push_back(Parameter("goal_1", "", true, false));
+ global_params.push_back(Parameter("goal_2", "", true, false));
+ global_params.push_back(Parameter("goal_3", "", true, false));
+ global_params.push_back(Parameter("goal_4", "", true, false));
+ global_params.push_back(Parameter("goal_5", "", true, false));
+ global_params.push_back(Parameter("goal_6", "", true, false));
+ global_params.push_back(Parameter("goal_7", "", true, false));
+ global_params.push_back(Parameter("goal_8", "", true, false));
+ global_params.push_back(Parameter("goal_9", "", true, false));
+ global_params.push_back(Parameter("goal_10", "", true, false));
+ global_params.push_back(Parameter("goal_11", "", true, false));
+ global_params.push_back(Parameter("goal_12", "", true, false));
+ global_params.push_back(Parameter("goal_13", "", true, false));
+ global_params.push_back(Parameter("goal_14", "", true, false));
+ global_params.push_back(Parameter("goal_15", "", true, false));
+ global_params.push_back(Parameter("goal_16", "", true, false));
+ global_params.push_back(Parameter("goal_17", "", true, false));
+
+ global_params.push_back(Parameter("Stick To Nav Mesh", "", true, false));
+
+ global_params.push_back(Parameter("fall_death", "", true, false));
+ global_params.push_back(Parameter("fall_damage_mult", "", true, false));
+
+ global_params.push_back(Parameter("time", "", true, false));
+
+ global_params.push_back(Parameter("Display Text", "", true, false));
+
+ global_params.push_back(Parameter("KillNPC", "", true, false));
+ global_params.push_back(Parameter("KillPlayer", "", true, false));
+ global_params.push_back(Parameter("characters", "", true, false));
+
+ global_params.push_back(Parameter("Start Disabled", "", true, false));
+
+ global_params.push_back(Parameter("Throw Counter Probability", "", true, false));
+ global_params.push_back(Parameter("Throw Trainer", "", true, false));
+ global_params.push_back(Parameter("Weapon Catch Skill", "", true, false));
+
+ global_params.push_back(Parameter("SavedTransform", "", true, false));
+
+ global_params.push_back(Parameter("rotation_scale", "", true, false));
+ global_params.push_back(Parameter("time_scale", "", true, false));
+ global_params.push_back(Parameter("translation_scale", "", true, false));
+
+ global_params.push_back(Parameter("music_layer_override", "", true, false));
+
+ global_params.push_back(Parameter("Invisible When Stationary", "", true, false));
+
+ global_params.push_back(Parameter("No Look Around", "", true, false));
+
+ global_params.push_back(Parameter("Short", "", true, false));
+ global_params.push_back(Parameter("Offset", "", true, false));
+ global_params.push_back(Parameter("Lethal", "", true, false));
std::vector<ActorObject> aos;
{
std::vector<Parameter> params = global_params;
- params.push_back( Parameter("Dialogue", "dialogue",false,false, "empty"));
-
- params.push_back( Parameter("Script", "dialogue",false,true));
- params.push_back( Parameter("Battles", "battles",false,true));
-
- params.push_back( Parameter("Name", "",true,false));
- params.push_back( Parameter("DisplayName", "",true,false));
- params.push_back( Parameter("NumParticipants", "",true,false));
- params.push_back( Parameter("obj_1", "",true,false));
- params.push_back( Parameter("obj_2", "",true,false));
- params.push_back( Parameter("obj_3", "",true,false));
- params.push_back( Parameter("obj_4", "",true,false));
- params.push_back( Parameter("obj_5", "",true,false));
- params.push_back( Parameter("obj_6", "",true,false));
- params.push_back( Parameter("obj_7", "",true,false));
- params.push_back( Parameter("obj_8", "",true,false));
- params.push_back( Parameter("obj_9", "",true,false));
- params.push_back( Parameter("game_type", "",true,false));
- params.push_back( Parameter("team", "",true,false));
- params.push_back( Parameter("LocName", "",true,false));
- params.push_back( Parameter("Visible in game", "",true,false));
- params.push_back( Parameter("Automatic", "",true,false));
-
-
- ActorObject ao( "PlaceholderObject", "", true, params );
+ params.push_back(Parameter("Dialogue", "dialogue", false, false, "empty"));
+
+ params.push_back(Parameter("Script", "dialogue", false, true));
+ params.push_back(Parameter("Battles", "battles", false, true));
+
+ params.push_back(Parameter("Name", "", true, false));
+ params.push_back(Parameter("DisplayName", "", true, false));
+ params.push_back(Parameter("NumParticipants", "", true, false));
+ params.push_back(Parameter("obj_1", "", true, false));
+ params.push_back(Parameter("obj_2", "", true, false));
+ params.push_back(Parameter("obj_3", "", true, false));
+ params.push_back(Parameter("obj_4", "", true, false));
+ params.push_back(Parameter("obj_5", "", true, false));
+ params.push_back(Parameter("obj_6", "", true, false));
+ params.push_back(Parameter("obj_7", "", true, false));
+ params.push_back(Parameter("obj_8", "", true, false));
+ params.push_back(Parameter("obj_9", "", true, false));
+ params.push_back(Parameter("game_type", "", true, false));
+ params.push_back(Parameter("team", "", true, false));
+ params.push_back(Parameter("LocName", "", true, false));
+ params.push_back(Parameter("Visible in game", "", true, false));
+ params.push_back(Parameter("Automatic", "", true, false));
+
+ ActorObject ao("PlaceholderObject", "", true, params);
aos.push_back(ao);
}
{
std::vector<Parameter> params = global_params;
- params.push_back( Parameter("Wait", "", true, false));
-
- ActorObject ao( "PathPointObject", "", true, params );
+ params.push_back(Parameter("Wait", "", true, false));
+
+ ActorObject ao("PathPointObject", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "CameraObject", "", true, params );
+ ActorObject ao("CameraObject", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "parameters", "", true, params );
+ ActorObject ao("parameters", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "AmbientSoundObject", "ambient_sound_object", false, params );
+ ActorObject ao("AmbientSoundObject", "ambient_sound_object", false, params);
aos.push_back(ao);
}
{
std::vector<Parameter> params = global_params;
- params.push_back( Parameter("Rotating Y","", true,false));
+ params.push_back(Parameter("Rotating Y", "", true, false));
- ActorObject ao( "EnvObject", "object", false, params );
+ ActorObject ao("EnvObject", "object", false, params);
aos.push_back(ao);
}
{
std::vector<Parameter> params = global_params;
- params.push_back( Parameter("Aggression","", true,false));
- params.push_back( Parameter("Attack Damage","", true,false));
- params.push_back( Parameter("Attack Knockback" ,"", true,false));
- params.push_back( Parameter("Attack Speed","", true,false));
- params.push_back( Parameter("Block Follow-up" ,"", true,false));
- params.push_back( Parameter("Block Skill","", true,false));
- params.push_back( Parameter("Character Scale","", true,false));
- params.push_back( Parameter("Damage Resistance" ,"",true,false));
- params.push_back( Parameter("Ear Size","", true,false));
- params.push_back( Parameter("Fat","", true,false));
- params.push_back( Parameter("Ground Aggression","", true,false));
- params.push_back( Parameter("Left handed","", true,false));
- params.push_back( Parameter("Lives","", true,false));
- params.push_back( Parameter("Movement Speed","", true,false));
- params.push_back( Parameter("Muscle","", true,false));
- params.push_back( Parameter("Static","", true,false));
- params.push_back( Parameter("Teams","", true,false));
- params.push_back( Parameter("Knockout Shield","", true,false));
- params.push_back( Parameter("Armor","", true,false));
- params.push_back( Parameter("dead_body","", true,false));
-
- params.push_back( Parameter("Peripheral FOV distance","", true,false));
- params.push_back( Parameter("Peripheral FOV horizontal","", true,false));
- params.push_back( Parameter("Peripheral FOV vertical","", true,false));
-
- params.push_back( Parameter("Focus FOV distance","", true,false));
- params.push_back( Parameter("Focus FOV horizontal","", true,false));
- params.push_back( Parameter("Focus FOV vertical","", true,false));
-
- ActorObject ao( "ActorObject", "actor_object", false, params );
+ params.push_back(Parameter("Aggression", "", true, false));
+ params.push_back(Parameter("Attack Damage", "", true, false));
+ params.push_back(Parameter("Attack Knockback", "", true, false));
+ params.push_back(Parameter("Attack Speed", "", true, false));
+ params.push_back(Parameter("Block Follow-up", "", true, false));
+ params.push_back(Parameter("Block Skill", "", true, false));
+ params.push_back(Parameter("Character Scale", "", true, false));
+ params.push_back(Parameter("Damage Resistance", "", true, false));
+ params.push_back(Parameter("Ear Size", "", true, false));
+ params.push_back(Parameter("Fat", "", true, false));
+ params.push_back(Parameter("Ground Aggression", "", true, false));
+ params.push_back(Parameter("Left handed", "", true, false));
+ params.push_back(Parameter("Lives", "", true, false));
+ params.push_back(Parameter("Movement Speed", "", true, false));
+ params.push_back(Parameter("Muscle", "", true, false));
+ params.push_back(Parameter("Static", "", true, false));
+ params.push_back(Parameter("Teams", "", true, false));
+ params.push_back(Parameter("Knockout Shield", "", true, false));
+ params.push_back(Parameter("Armor", "", true, false));
+ params.push_back(Parameter("dead_body", "", true, false));
+
+ params.push_back(Parameter("Peripheral FOV distance", "", true, false));
+ params.push_back(Parameter("Peripheral FOV horizontal", "", true, false));
+ params.push_back(Parameter("Peripheral FOV vertical", "", true, false));
+
+ params.push_back(Parameter("Focus FOV distance", "", true, false));
+ params.push_back(Parameter("Focus FOV horizontal", "", true, false));
+ params.push_back(Parameter("Focus FOV vertical", "", true, false));
+
+ ActorObject ao("ActorObject", "actor_object", false, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "Decal", "decal_object", false, params );
+ ActorObject ao("Decal", "decal_object", false, params);
aos.push_back(ao);
}
{
@@ -407,12 +381,12 @@ void ActorObjectLevelSeeker::SearchGroup( std::vector<Item>& items, const Item&
params.push_back(Parameter("next_level", "level", false, false));
params.push_back(Parameter("Sound Path", "sound", false, false));
- ActorObject ao( "Hotspot", "hotspot_object", false, params );
+ ActorObject ao("Hotspot", "hotspot_object", false, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "ItemObject", "item", false, params );
+ ActorObject ao("ItemObject", "item", false, params);
aos.push_back(ao);
}
{
@@ -420,147 +394,133 @@ void ActorObjectLevelSeeker::SearchGroup( std::vector<Item>& items, const Item&
params.push_back(Parameter("Negative", "", true, false));
- ActorObject ao( "LightProbeObject", "", true, params );
+ ActorObject ao("LightProbeObject", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "NavmeshRegionObject", "", true, params );
+ ActorObject ao("NavmeshRegionObject", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "NavmeshHintObject", "", true, params );
+ ActorObject ao("NavmeshHintObject", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "NavmeshConnectionObject", "", true, params );
+ ActorObject ao("NavmeshConnectionObject", "", true, params);
aos.push_back(ao);
}
{
std::vector<Parameter> params = global_params;
params.push_back(Parameter("Global", "", true, false));
- ActorObject ao( "ReflectionCaptureObject", "", true, params );
+ ActorObject ao("ReflectionCaptureObject", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "LightVolumeObject", "", true, params );
+ ActorObject ao("LightVolumeObject", "", true, params);
aos.push_back(ao);
}
{
std::vector<Parameter> params = global_params;
- params.push_back( Parameter("Global", "",true,false));
+ params.push_back(Parameter("Global", "", true, false));
- ActorObject ao( "ReflectionCaptureObject", "", true, params );
+ ActorObject ao("ReflectionCaptureObject", "", true, params);
aos.push_back(ao);
}
{
std::vector<Parameter> params = global_params;
params.push_back(Parameter("portal_a_light", "", true, false));
- params.push_back( Parameter("Level to load", "", true,false));
+ params.push_back(Parameter("Level to load", "", true, false));
- ActorObject ao( "DynamicLightObject", "", true, params );
+ ActorObject ao("DynamicLightObject", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "Group", "", true, params );
+ ActorObject ao("Group", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "Prefab", "prefab", true, params );
+ ActorObject ao("Prefab", "prefab", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "EnvObjectAttachments", "", true, params );
+ ActorObject ao("EnvObjectAttachments", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "Palette", "", true, params );
+ ActorObject ao("Palette", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "ItemConnections", "", true, params );
+ ActorObject ao("ItemConnections", "", true, params);
aos.push_back(ao);
}
{
const std::vector<Parameter>& params = global_params;
- ActorObject ao( "Connections", "", true, params );
+ ActorObject ao("Connections", "", true, params);
aos.push_back(ao);
}
-
TiXmlElement* el = root->FirstChildElement();
- while( el )
- {
- if( strcmp( el->Value(), "Group" ) == 0 )
+ while (el) {
+ if (strcmp(el->Value(), "Group") == 0) {
+ SearchGroup(items, item, el);
+ } else if (strcmp(el->Value(), "Prefab") == 0) {
+ SearchGroup(items, item, el);
+ } else if (strcmp(el->Value(), "ActorObject") == 0) // Actor objects can have sub EnvObjects for attachments
{
- SearchGroup(items,item,el);
- }
- else if( strcmp( el->Value(), "Prefab" ) == 0 )
- {
- SearchGroup(items,item,el);
- }
- else if( strcmp( el->Value(), "ActorObject" ) == 0 ) //Actor objects can have sub EnvObjects for attachments
- {
- SearchGroup(items,item,el);
+ SearchGroup(items, item, el);
}
bool found = false;
- for(auto & ao : aos)
- {
- found |= ao.Search( items, item, el );
- }
+ for (auto& ao : aos) {
+ found |= ao.Search(items, item, el);
+ }
- if( !found )
- {
- LOGE << "Urecognized ActorObject " << el->Value() << " on row " << el->Row() << " in " << item << std::endl;
+ if (!found) {
+ LOGE << "Urecognized ActorObject " << el->Value() << " on row " << el->Row() << " in " << item << std::endl;
}
el = el->NextSiblingElement();
}
}
-std::vector<Item> ActorObjectLevelSeeker::SearchLevelRoot( const Item& source, TiXmlHandle& hRoot )
-{
+std::vector<Item> ActorObjectLevelSeeker::SearchLevelRoot(const Item& source, TiXmlHandle& hRoot) {
std::vector<Item> items;
- //The standard root now seems to be ActorObjects, but for historic reasons we look for some more than that.
- const char* entity_roots[] =
- {
- "ActorObjects", //Currently standard collected
- "Groups",
- "EnvObjects",
- "Decals",
- "Hotspots"
- };
-
- for(auto & entity_root : entity_roots)
- {
+ // The standard root now seems to be ActorObjects, but for historic reasons we look for some more than that.
+ const char* entity_roots[] =
+ {
+ "ActorObjects", // Currently standard collected
+ "Groups",
+ "EnvObjects",
+ "Decals",
+ "Hotspots"};
+
+ for (auto& entity_root : entity_roots) {
TiXmlElement* elem = hRoot.FirstChildElement(entity_root).ToElement();
- if( elem )
- {
- SearchGroup( items, source, elem );
- }
- else
- {
+ if (elem) {
+ SearchGroup(items, source, elem);
+ } else {
LOGD << source << " Is missing " << entity_root << std::endl;
}
}
diff --git a/Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.h b/Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.h
index c948f089..3e2a814d 100644
--- a/Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.h
+++ b/Source/Ogda/Searchers/Seekers/actorobjectlevelseeker.h
@@ -26,14 +26,12 @@
class TiXmlElement;
-class ActorObjectLevelSeeker : public LevelSeekerBase
-{
-public:
- virtual void SearchGroup( std::vector<Item>& items, const Item& item, TiXmlElement* root );
- std::vector<Item> SearchLevelRoot( const Item& item, TiXmlHandle& hRoot ) override;
+class ActorObjectLevelSeeker : public LevelSeekerBase {
+ public:
+ virtual void SearchGroup(std::vector<Item>& items, const Item& item, TiXmlElement* root);
+ std::vector<Item> SearchLevelRoot(const Item& item, TiXmlHandle& hRoot) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "actor_object_level_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/actorseeker.cpp b/Source/Ogda/Searchers/Seekers/actorseeker.cpp
index 09cd2337..3397f711 100644
--- a/Source/Ogda/Searchers/Seekers/actorseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/actorseeker.cpp
@@ -29,88 +29,66 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-std::vector<Item> ActorSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
- const char* elems[] =
- {
- "Character"
- };
+std::vector<Item> ActorSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
+ const char* elems[] =
+ {
+ "Character"};
const char* elems_type[] =
- {
- "character"
- };
+ {
+ "character"};
assert(ARRLEN(elems_type) == ARRLEN(elems));
- const char* ignored[] =
- {
- "ControlScript"
- };
+ const char* ignored[] =
+ {
+ "ControlScript"};
std::vector<Item> items;
TiXmlHandle hRoot(&doc);
const char* roots[] =
- {
- "Actor"
- };
-
- TiXmlElement *eRoot = hRoot.FirstChildElement().Element();
-
- if( !eRoot )
- {
+ {
+ "Actor"};
+
+ TiXmlElement* eRoot = hRoot.FirstChildElement().Element();
+
+ if (!eRoot) {
LOGE << "Can't find anything in file listed " << item << std::endl;
}
- while( eRoot )
- {
- if( FindStringInArray( roots, ARRLEN(roots), eRoot->Value() ) < 0 )
- {
+ while (eRoot) {
+ if (FindStringInArray(roots, ARRLEN(roots), eRoot->Value()) < 0) {
LOGE << "Unknown root " << eRoot->Value() << std::endl;
}
- TiXmlElement *eElem = eRoot->FirstChildElement();
+ TiXmlElement* eElem = eRoot->FirstChildElement();
- while( eElem )
- {
+ while (eElem) {
const char* name = eElem->Value();
const char* text = eElem->GetText();
- if( name )
- {
+ if (name) {
int id;
- if( (id = FindStringInArray( elems, ARRLEN(elems), name )) >= 0 )
- {
- if( text && strlen(text) > 0 )
- {
- items.push_back(Item(item.input_folder,text,elems_type[id],item.source));
- }
- else
- {
+ if ((id = FindStringInArray(elems, ARRLEN(elems), name)) >= 0) {
+ if (text && strlen(text) > 0) {
+ items.push_back(Item(item.input_folder, text, elems_type[id], item.source));
+ } else {
LOGW << "String value in " << item << " for element " << elems[id] << " is empty" << std::endl;
}
- }
- else if( (id = FindStringInArray( ignored, ARRLEN(ignored), name )) >= 0 )
- {
+ } else if ((id = FindStringInArray(ignored, ARRLEN(ignored), name)) >= 0) {
LOGD << "Ignored " << ignored[id] << " in " << item << std::endl;
- }
- else if( strmtch( "animations", name ) )
- {
+ } else if (strmtch("animations", name)) {
std::vector<attribpair> a;
- a.push_back(attribpair("idle", "animation"));
-
+ a.push_back(attribpair("idle", "animation"));
+
std::vector<const char*> i;
- AttributeScanner::Do( items, item, eElem, a, i );
- }
- else
- {
+ AttributeScanner::Do(items, item, eElem, a, i);
+ } else {
LOGE << "Unahandled subvalue in Character from " << item << " called " << name << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Generic warning" << std::endl;
}
@@ -119,5 +97,4 @@ std::vector<Item> ActorSeeker::SearchXML( const Item & item, TiXmlDocument& doc
eRoot = eRoot->NextSiblingElement();
}
return items;
-
}
diff --git a/Source/Ogda/Searchers/Seekers/actorseeker.h b/Source/Ogda/Searchers/Seekers/actorseeker.h
index 14aab01a..a6a3f12d 100644
--- a/Source/Ogda/Searchers/Seekers/actorseeker.h
+++ b/Source/Ogda/Searchers/Seekers/actorseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class ActorSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
+class ActorSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "actor_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.cpp b/Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.cpp
index b82114cd..a41aa37f 100644
--- a/Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.cpp
@@ -26,49 +26,40 @@
#include <Logging/logdata.h>
-std::vector<Item> AmbientSoundLevelSeeker::SearchLevelRoot( const Item& item, TiXmlHandle& hRoot )
-{
+std::vector<Item> AmbientSoundLevelSeeker::SearchLevelRoot(const Item& item, TiXmlHandle& hRoot) {
std::vector<Item> items;
- TiXmlElement *eElem = hRoot.FirstChildElement("AmbientSounds").FirstChildElement().Element();
+ TiXmlElement* eElem = hRoot.FirstChildElement("AmbientSounds").FirstChildElement().Element();
- while( eElem )
- {
+ while (eElem) {
const char* path = eElem->Attribute("path");
- if( path )
- {
+ if (path) {
{
std::stringstream ss;
ss << path << ".xml";
- Item i( item.input_folder, ss.str(), "sound", item.source );
-
- if( i.FileAccess() )
- {
+ Item i(item.input_folder, ss.str(), "sound", item.source);
+
+ if (i.FileAccess()) {
items.push_back(i);
}
}
-
+
bool found_file = false;
int counter = 1;
- do
- {
+ do {
std::stringstream ss;
ss << path << "_" << counter << ".wav";
- Item i( item.input_folder, ss.str(), "sound", item.source );
-
- if( i.FileAccess() )
- {
+ Item i(item.input_folder, ss.str(), "sound", item.source);
+
+ if (i.FileAccess()) {
found_file = true;
items.push_back(i);
- }
- else
- {
+ } else {
found_file = false;
- }
+ }
counter++;
- }
- while( found_file );
+ } while (found_file);
}
eElem = eElem->NextSiblingElement();
}
diff --git a/Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.h b/Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.h
index bc1c49c5..fba3ec8d 100644
--- a/Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.h
+++ b/Source/Ogda/Searchers/Seekers/ambientsoundlevelseeker.h
@@ -26,13 +26,11 @@
class TiXmlElement;
-class AmbientSoundLevelSeeker : public LevelSeekerBase
-{
-public:
- std::vector<Item> SearchLevelRoot( const Item& item, TiXmlHandle& hRoot ) override;
+class AmbientSoundLevelSeeker : public LevelSeekerBase {
+ public:
+ std::vector<Item> SearchLevelRoot(const Item& item, TiXmlHandle& hRoot) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "ambient_sound_level_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/animationretargetseeker.cpp b/Source/Ogda/Searchers/Seekers/animationretargetseeker.cpp
index 245c8fe2..fc9a3cb2 100644
--- a/Source/Ogda/Searchers/Seekers/animationretargetseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/animationretargetseeker.cpp
@@ -29,52 +29,42 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-std::vector<Item> AnimationRetargetSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
+std::vector<Item> AnimationRetargetSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
std::vector<Item> items;
TiXmlHandle hRoot(&doc);
- TiXmlElement *eRoot = hRoot.FirstChildElement().Element();
+ TiXmlElement* eRoot = hRoot.FirstChildElement().Element();
std::vector<elempair> elems;
- elems.push_back( elempair( "rig", "" ) );
-
+ elems.push_back(elempair("rig", ""));
+
std::vector<const char*> elems_ignore;
-
- if( !eRoot )
- {
+
+ if (!eRoot) {
LOGE << "Can't find anything in file listed " << item << std::endl;
- }
- else
- {
- ElementScanner::Do( items, item, eRoot, elems, elems_ignore, this, (void*)1 );
+ } else {
+ ElementScanner::Do(items, item, eRoot, elems, elems_ignore, this, (void*)1);
}
return items;
}
-void AnimationRetargetSeeker::HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata )
-{
- if( userdata == (void*)1 && strmtch(eElem->Value(), "rig") )
- {
+void AnimationRetargetSeeker::HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) {
+ if (userdata == (void*)1 && strmtch(eElem->Value(), "rig")) {
{
std::vector<elempair> elems;
- elems.push_back( elempair( "anim", "animation" ) );
+ elems.push_back(elempair("anim", "animation"));
std::vector<const char*> elems_ignore;
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)2 );
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)2);
}
{
std::vector<attribpair> elems;
- elems.push_back( attribpair( "path", "skeleton" ) );
+ elems.push_back(attribpair("path", "skeleton"));
std::vector<const char*> elems_ignore;
AttributeScanner::Do(items, item, eElem, elems, elems_ignore);
}
- }
- else if( userdata == (void*)2 )
- {
- }
- else
- {
- XMLSeekerBase::HandleElementCallback( items, eRoot, eElem, item, userdata );
+ } else if (userdata == (void*)2) {
+ } else {
+ XMLSeekerBase::HandleElementCallback(items, eRoot, eElem, item, userdata);
}
}
diff --git a/Source/Ogda/Searchers/Seekers/animationretargetseeker.h b/Source/Ogda/Searchers/Seekers/animationretargetseeker.h
index 2ab0b2bf..598209cb 100644
--- a/Source/Ogda/Searchers/Seekers/animationretargetseeker.h
+++ b/Source/Ogda/Searchers/Seekers/animationretargetseeker.h
@@ -27,14 +27,12 @@
class TiXmlDocument;
class JobHandler;
-class AnimationRetargetSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
- void HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata ) override;
+class AnimationRetargetSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
+ void HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "animation_retarget_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/attackseeker.cpp b/Source/Ogda/Searchers/Seekers/attackseeker.cpp
index 4229aa71..e8c84a56 100644
--- a/Source/Ogda/Searchers/Seekers/attackseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/attackseeker.cpp
@@ -29,90 +29,70 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-std::vector<Item> AttackSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
- const char* elems[] =
- {
- "reaction"
- };
+std::vector<Item> AttackSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
+ const char* elems[] =
+ {
+ "reaction"};
const char* elems_type[] =
- {
- "attack"
- };
+ {
+ "attack"};
assert(ARRLEN(elems_type) == ARRLEN(elems));
- const char* ignored[] =
- {
- "flags",
- "impact_dir",
- "block_damage",
- "damage",
- "sharp_damage",
- "force",
- "materialevent",
- "stab_dir",
- "cut_plane"
- };
+ const char* ignored[] =
+ {
+ "flags",
+ "impact_dir",
+ "block_damage",
+ "damage",
+ "sharp_damage",
+ "force",
+ "materialevent",
+ "stab_dir",
+ "cut_plane"};
std::vector<Item> items;
TiXmlHandle hRoot(&doc);
-
- TiXmlElement *eRoot = hRoot.FirstChildElement().Element();
-
- if( !eRoot )
- {
+
+ TiXmlElement* eRoot = hRoot.FirstChildElement().Element();
+
+ if (!eRoot) {
LOGE << "Can't find anything in file listed " << item << std::endl;
}
- while( eRoot )
- {
- TiXmlElement *eElem = eRoot->FirstChildElement();
+ while (eRoot) {
+ TiXmlElement* eElem = eRoot->FirstChildElement();
- while( eElem )
- {
+ while (eElem) {
const char* name = eElem->Value();
const char* text = eElem->GetText();
- if( name )
- {
+ if (name) {
int id;
- if( (id = FindStringInArray( elems, ARRLEN(elems), name )) >= 0 )
- {
- if( text && strlen(text) > 0 )
- {
- items.push_back(Item(item.input_folder, text,elems_type[id],item.source));
- }
- else
- {
+ if ((id = FindStringInArray(elems, ARRLEN(elems), name)) >= 0) {
+ if (text && strlen(text) > 0) {
+ items.push_back(Item(item.input_folder, text, elems_type[id], item.source));
+ } else {
LOGW << "String value in " << item << " for element " << elems[id] << " is empty" << std::endl;
}
- }
- else if( (id = FindStringInArray( ignored, ARRLEN(ignored), name )) >= 0 )
- {
+ } else if ((id = FindStringInArray(ignored, ARRLEN(ignored), name)) >= 0) {
LOGD << "Ignored " << ignored[id] << " in " << item << std::endl;
- }
- else if( strmtch( "animations", name ) )
- {
+ } else if (strmtch("animations", name)) {
std::vector<attribpair> attribs;
- attribs.push_back(attribpair("unblocked", "animation"));
- attribs.push_back(attribpair("blocked", "animation"));
- attribs.push_back(attribpair("throw", "animation"));
- attribs.push_back(attribpair("thrown", "animation"));
+ attribs.push_back(attribpair("unblocked", "animation"));
+ attribs.push_back(attribpair("blocked", "animation"));
+ attribs.push_back(attribpair("throw", "animation"));
+ attribs.push_back(attribpair("thrown", "animation"));
attribs.push_back(attribpair("thrown_counter", "animation"));
std::vector<const char*> ignore;
- AttributeScanner::Do( items, item, eElem, attribs, ignore );
- }
- else
- {
+ AttributeScanner::Do(items, item, eElem, attribs, ignore);
+ } else {
LOGE << "Unahandled subvalue in Attack from " << item << " called " << name << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Generic warning" << std::endl;
}
@@ -122,5 +102,4 @@ std::vector<Item> AttackSeeker::SearchXML( const Item & item, TiXmlDocument& doc
}
return items;
-
}
diff --git a/Source/Ogda/Searchers/Seekers/attackseeker.h b/Source/Ogda/Searchers/Seekers/attackseeker.h
index 09860122..4788de7e 100644
--- a/Source/Ogda/Searchers/Seekers/attackseeker.h
+++ b/Source/Ogda/Searchers/Seekers/attackseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class AttackSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
+class AttackSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "attack_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/characterseeker.cpp b/Source/Ogda/Searchers/Seekers/characterseeker.cpp
index 852cd090..33de9171 100644
--- a/Source/Ogda/Searchers/Seekers/characterseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/characterseeker.cpp
@@ -29,92 +29,70 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-std::vector<Item> CharacterSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
- const char* elems[] =
- {
- "clothing"
- };
+std::vector<Item> CharacterSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
+ const char* elems[] =
+ {
+ "clothing"};
const char* elems_type[] =
- {
- "material"
- };
+ {
+ "material"};
assert(ARRLEN(elems_type) == ARRLEN(elems));
- const char* ignored[] =
- {
- "morphs",
- "tags",
- "visemes",
- "morphs",
- "team",
- "soundmod"
- };
+ const char* ignored[] =
+ {
+ "morphs",
+ "tags",
+ "visemes",
+ "morphs",
+ "team",
+ "soundmod"};
std::vector<Item> items;
TiXmlHandle hRoot(&doc);
const char* roots[] =
- {
- "character"
- };
-
- TiXmlElement *eRoot = hRoot.FirstChildElement().Element();
-
- if( !eRoot )
- {
+ {
+ "character"};
+
+ TiXmlElement* eRoot = hRoot.FirstChildElement().Element();
+
+ if (!eRoot) {
LOGE << "Can't find anything in file listed " << item << std::endl;
}
- while( eRoot )
- {
- if( FindStringInArray( roots, ARRLEN(roots), eRoot->Value() ) < 0 )
- {
+ while (eRoot) {
+ if (FindStringInArray(roots, ARRLEN(roots), eRoot->Value()) < 0) {
LOGE << "Unknown root " << eRoot->Value() << " from " << item << std::endl;
}
- TiXmlElement *eElem = eRoot->FirstChildElement();
+ TiXmlElement* eElem = eRoot->FirstChildElement();
- while( eElem )
- {
+ while (eElem) {
const char* name = eElem->Value();
const char* text = eElem->GetText();
- if( name )
- {
+ if (name) {
int id;
- if( (id = FindStringInArray( elems, ARRLEN(elems), name )) >= 0 )
- {
- if( text && strlen(text) > 0 )
- {
- items.push_back(Item(item.input_folder, text,elems_type[id],item.source));
- }
- else
- {
+ if ((id = FindStringInArray(elems, ARRLEN(elems), name)) >= 0) {
+ if (text && strlen(text) > 0) {
+ items.push_back(Item(item.input_folder, text, elems_type[id], item.source));
+ } else {
LOGW << "String value in " << item << " for element " << elems[id] << " is empty" << std::endl;
}
- }
- else if( (id = FindStringInArray( ignored, ARRLEN(ignored), name )) >= 0 )
- {
+ } else if ((id = FindStringInArray(ignored, ARRLEN(ignored), name)) >= 0) {
LOGD << "Ignored " << ignored[id] << " in " << item << std::endl;
- }
- else if( strmtch( "animations", name ) )
- {
- AttributeScanner::DoAllSame( items, item, eElem, "animation" );
- }
- else if( strmtch( "attacks", name ) )
- {
- AttributeScanner::DoAllSame( items, item, eElem, "attack");
- }
- else if( strmtch( "appearance", name ) )
- {
+ } else if (strmtch("animations", name)) {
+ AttributeScanner::DoAllSame(items, item, eElem, "animation");
+ } else if (strmtch("attacks", name)) {
+ AttributeScanner::DoAllSame(items, item, eElem, "attack");
+ } else if (strmtch("appearance", name)) {
std::vector<attribpair> a;
a.push_back(attribpair("obj_path", "object"));
- a.push_back(attribpair("morph", "model"));
+ a.push_back(attribpair("morph", "model"));
a.push_back(attribpair("skeleton", "skeleton"));
- a.push_back(attribpair("fur", "model"));
+ a.push_back(attribpair("fur", "model"));
std::vector<const char*> i;
i.push_back("model_scale");
@@ -124,26 +102,20 @@ std::vector<Item> CharacterSeeker::SearchXML( const Item & item, TiXmlDocument&
i.push_back("channel_2");
i.push_back("channel_3");
i.push_back("channel_4");
-
- AttributeScanner::Do( items, item, eElem, a, i );
- }
- else if( strmtch( "voice", name ) )
- {
+
+ AttributeScanner::Do(items, item, eElem, a, i);
+ } else if (strmtch("voice", name)) {
std::vector<attribpair> a;
a.push_back(attribpair("path", "voice"));
std::vector<const char*> i;
i.push_back("pitch");
- AttributeScanner::Do( items, item, eElem, a, i );
- }
- else
- {
+ AttributeScanner::Do(items, item, eElem, a, i);
+ } else {
LOGE << "Unahandled subvalue in Character from " << item << " called " << name << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Generic warning" << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/characterseeker.h b/Source/Ogda/Searchers/Seekers/characterseeker.h
index bb8160dc..f3755e0f 100644
--- a/Source/Ogda/Searchers/Seekers/characterseeker.h
+++ b/Source/Ogda/Searchers/Seekers/characterseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class CharacterSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
+class CharacterSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "character_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/decalseeker.cpp b/Source/Ogda/Searchers/Seekers/decalseeker.cpp
index ce7b54c9..52738412 100644
--- a/Source/Ogda/Searchers/Seekers/decalseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/decalseeker.cpp
@@ -26,8 +26,7 @@
#include <Logging/logdata.h>
-std::vector<Item> DecalSeeker::SearchXML( const Item& item, TiXmlDocument& doc )
-{
+std::vector<Item> DecalSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
std::vector<Item> items;
TiXmlHandle root(&doc);
@@ -35,39 +34,27 @@ std::vector<Item> DecalSeeker::SearchXML( const Item& item, TiXmlDocument& doc )
TiXmlElement* eColormap = root.FirstChildElement("DecalObject").FirstChildElement("ColorMap").Element();
TiXmlElement* eNormalmap = root.FirstChildElement("DecalObject").FirstChildElement("NormalMap").Element();
- if( eColormap )
- {
+ if (eColormap) {
const char* colormap = eColormap->GetText();
- if( colormap && strlen( colormap ) > 0 )
- {
- items.push_back(Item(item.input_folder,colormap,"texture",item.source));
- }
- else
- {
+ if (colormap && strlen(colormap) > 0) {
+ items.push_back(Item(item.input_folder, colormap, "texture", item.source));
+ } else {
LOGE << "ColorMap text missing" << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "ColorMap element missing in Decal" << std::endl;
}
- if( eNormalmap )
- {
+ if (eNormalmap) {
const char* normalmap = eNormalmap->GetText();
- if( normalmap && strlen( normalmap ) > 0 )
- {
- items.push_back(Item(item.input_folder, normalmap,"texture",item.source));
- }
- else
- {
+ if (normalmap && strlen(normalmap) > 0) {
+ items.push_back(Item(item.input_folder, normalmap, "texture", item.source));
+ } else {
LOGE << "NormalMap text missing" << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "NormalMap element missing in Decal" << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/decalseeker.h b/Source/Ogda/Searchers/Seekers/decalseeker.h
index 2ef1cae8..58ecfe99 100644
--- a/Source/Ogda/Searchers/Seekers/decalseeker.h
+++ b/Source/Ogda/Searchers/Seekers/decalseeker.h
@@ -26,13 +26,11 @@
class TiXmlHandle;
-class DecalSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item& item, TiXmlDocument& doc ) override;
+class DecalSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "decal_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/hotspotseeker.cpp b/Source/Ogda/Searchers/Seekers/hotspotseeker.cpp
index 787c5c58..b6f848a6 100644
--- a/Source/Ogda/Searchers/Seekers/hotspotseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/hotspotseeker.cpp
@@ -26,21 +26,18 @@
#include <Logging/logdata.h>
-std::vector<Item> HotspotSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
+std::vector<Item> HotspotSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
std::vector<Item> items;
TiXmlHandle hRoot(&doc);
-
- TiXmlElement *eElem = hRoot.FirstChildElement("Hotspot").FirstChildElement("BillboardColorMap").Element();
- if( eElem )
- {
+ TiXmlElement* eElem = hRoot.FirstChildElement("Hotspot").FirstChildElement("BillboardColorMap").Element();
+
+ if (eElem) {
const char* billboard = eElem->GetText();
-
- if( billboard && strlen(billboard) > 0 )
- {
- items.push_back( Item( item.input_folder, billboard, "texture", item.source ));
+
+ if (billboard && strlen(billboard) > 0) {
+ items.push_back(Item(item.input_folder, billboard, "texture", item.source));
}
}
diff --git a/Source/Ogda/Searchers/Seekers/hotspotseeker.h b/Source/Ogda/Searchers/Seekers/hotspotseeker.h
index 468e39fc..83fcc5bf 100644
--- a/Source/Ogda/Searchers/Seekers/hotspotseeker.h
+++ b/Source/Ogda/Searchers/Seekers/hotspotseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class HotspotSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
+class HotspotSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "hotspot_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/itemseeker.cpp b/Source/Ogda/Searchers/Seekers/itemseeker.cpp
index a1c77b8e..d9e0484e 100644
--- a/Source/Ogda/Searchers/Seekers/itemseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/itemseeker.cpp
@@ -29,44 +29,39 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-enum
-{
+enum {
ROOT = 1,
ITEM,
ATTACHMENT
};
-std::vector<Item> ItemSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
+std::vector<Item> ItemSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
std::vector<Item> items;
std::vector<elempair> elems;
- elems.push_back( elempair( "item", "" ) );
- elems.push_back( elempair( "attachment", "" ) );
-
+ elems.push_back(elempair("item", ""));
+ elems.push_back(elempair("attachment", ""));
+
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, &doc, elems, elems_ignore, this, (void*)ROOT );
+
+ ElementScanner::Do(items, item, &doc, elems, elems_ignore, this, (void*)ROOT);
return items;
}
-void ItemSeeker::HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata )
-{
- if( userdata == (void*)ROOT )
- {
- if( strmtch(eElem->Value(), "item") )
- {
+void ItemSeeker::HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) {
+ if (userdata == (void*)ROOT) {
+ if (strmtch(eElem->Value(), "item")) {
std::vector<elempair> elems;
- elems.push_back( elempair( "appearance", "" ) );
- elems.push_back( elempair( "grip", "" ) );
- elems.push_back( elempair( "anim_blend", "" ) );
- elems.push_back( elempair( "attack_override", "" ) );
- elems.push_back( elempair( "anim_override", "" ) );
- elems.push_back( elempair( "reaction_override", "" ) );
- elems.push_back( elempair( "sheathe",""));
- elems.push_back( elempair( "attachments",""));
-
+ elems.push_back(elempair("appearance", ""));
+ elems.push_back(elempair("grip", ""));
+ elems.push_back(elempair("anim_blend", ""));
+ elems.push_back(elempair("attack_override", ""));
+ elems.push_back(elempair("anim_override", ""));
+ elems.push_back(elempair("reaction_override", ""));
+ elems.push_back(elempair("sheathe", ""));
+ elems.push_back(elempair("attachments", ""));
+
std::vector<const char*> elems_ignore;
elems_ignore.push_back("type");
elems_ignore.push_back("points");
@@ -75,57 +70,42 @@ void ItemSeeker::HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRo
elems_ignore.push_back("label");
elems_ignore.push_back("range");
elems_ignore.push_back("anim_override_flags");
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)ITEM );
- }
- else if( strmtch(eElem->Value(), "attachment") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)ITEM);
+ } else if (strmtch(eElem->Value(), "attachment")) {
std::vector<elempair> elems;
- elems.push_back( elempair( "anim", "animation" ) );
-
+ elems.push_back(elempair("anim", "animation"));
+
std::vector<const char*> elems_ignore;
- elems_ignore.push_back( "attach" );
- elems_ignore.push_back( "mirror" );
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)ATTACHMENT );
- }
- else
- {
- LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
+ elems_ignore.push_back("attach");
+ elems_ignore.push_back("mirror");
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)ATTACHMENT);
+ } else {
+ LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
}
- }
- else if( userdata == (void*)ITEM )
- {
+ } else if (userdata == (void*)ITEM) {
std::vector<attribpair> elems;
std::vector<const char*> elems_ignore;
- if( strmtch(eElem->Value(), "appearance") )
- {
+ if (strmtch(eElem->Value(), "appearance")) {
elems.push_back(attribpair("obj_path", "object"));
- }
- else if( strmtch( eElem->Value(), "grip" ) )
- {
+ } else if (strmtch(eElem->Value(), "grip")) {
elems.push_back(attribpair("anim", "animation"));
elems.push_back(attribpair("anim_base", "animation"));
-
+
elems_ignore.push_back("ik_attach");
elems_ignore.push_back("hands");
- }
- else if( strmtch( eElem->Value(), "anim_blend" ) )
- {
+ } else if (strmtch(eElem->Value(), "anim_blend")) {
elems.push_back(attribpair("idle", "animation"));
elems.push_back(attribpair("movement", "animation"));
- }
- else if( strmtch( eElem->Value(), "attack_override" ) )
- {
+ } else if (strmtch(eElem->Value(), "attack_override")) {
elems.push_back(attribpair("stationary", "attack"));
elems.push_back(attribpair("moving", "attack"));
elems.push_back(attribpair("moving_close", "attack"));
elems.push_back(attribpair("stationary_close", "attack"));
elems.push_back(attribpair("low", "attack"));
- }
- else if( strmtch( eElem->Value(), "anim_override" ) )
- {
+ } else if (strmtch(eElem->Value(), "anim_override")) {
elems.push_back(attribpair("idle", "animation"));
elems.push_back(attribpair("movement", "animation"));
elems.push_back(attribpair("medleftblock", "animation"));
@@ -135,62 +115,42 @@ void ItemSeeker::HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRo
elems.push_back(attribpair("lowleftblock", "animation"));
elems.push_back(attribpair("lowrightblock", "animation"));
elems.push_back(attribpair("blockflinch", "animation"));
- }
- else if( strmtch( eElem->Value(), "reaction_override" ) )
- {
+ } else if (strmtch(eElem->Value(), "reaction_override")) {
std::vector<elempair> e;
- e.push_back( elempair( "reaction", "" ) );
-
+ e.push_back(elempair("reaction", ""));
+
std::vector<const char*> ei;
-
- ElementScanner::Do( items, item, eElem, e, ei, this, (void*)ITEM );
- }
- else if( strmtch( eElem->Value(), "reaction" ) )
- {
+
+ ElementScanner::Do(items, item, eElem, e, ei, this, (void*)ITEM);
+ } else if (strmtch(eElem->Value(), "reaction")) {
elems.push_back(attribpair("old", "attack"));
elems.push_back(attribpair("new", "attack"));
- }
- else if( strmtch( eElem->Value(), "sheathe" ) )
- {
+ } else if (strmtch(eElem->Value(), "sheathe")) {
elems.push_back(attribpair("anim", "animation"));
elems.push_back(attribpair("anim_base", "animation"));
elems.push_back(attribpair("contains", "item"));
- elems_ignore.push_back("ik_attach");
- }
- else if( strmtch( eElem->Value(), "attachments" ) )
- {
+ elems_ignore.push_back("ik_attach");
+ } else if (strmtch(eElem->Value(), "attachments")) {
std::vector<elempair> e;
- e.push_back( elempair( "attachment", "item" ) );
-
+ e.push_back(elempair("attachment", "item"));
+
std::vector<const char*> ei;
-
- ElementScanner::Do( items, item, eElem, e, ei, this, (void*)0 );
- }
- else
- {
- LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
- }
- AttributeScanner::Do( items, item, eElem, elems, elems_ignore);
- }
- else if( userdata == (void*)ATTACHMENT )
- {
- if( strmtch(eElem->Value(), "anim") )
- {
- //Ignore
- }
- else
- {
- LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
+ ElementScanner::Do(items, item, eElem, e, ei, this, (void*)0);
+ } else {
+ LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
}
- }
- else if( userdata == (void*)0 )
- {
- }
- else
- {
- XMLSeekerBase::HandleElementCallback( items, eRoot, eElem, item, userdata );
+ AttributeScanner::Do(items, item, eElem, elems, elems_ignore);
+ } else if (userdata == (void*)ATTACHMENT) {
+ if (strmtch(eElem->Value(), "anim")) {
+ // Ignore
+ } else {
+ LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
+ }
+ } else if (userdata == (void*)0) {
+ } else {
+ XMLSeekerBase::HandleElementCallback(items, eRoot, eElem, item, userdata);
}
}
diff --git a/Source/Ogda/Searchers/Seekers/itemseeker.h b/Source/Ogda/Searchers/Seekers/itemseeker.h
index 185dc489..2f40de39 100644
--- a/Source/Ogda/Searchers/Seekers/itemseeker.h
+++ b/Source/Ogda/Searchers/Seekers/itemseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class ItemSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
- void HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata ) override;
- inline const char* GetName() override
- {
+class ItemSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
+ void HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) override;
+ inline const char* GetName() override {
return "item_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/jsonseekerbase.cpp b/Source/Ogda/Searchers/Seekers/jsonseekerbase.cpp
index f380d7be..3b03eded 100644
--- a/Source/Ogda/Searchers/Seekers/jsonseekerbase.cpp
+++ b/Source/Ogda/Searchers/Seekers/jsonseekerbase.cpp
@@ -27,25 +27,18 @@
#include <fstream>
#include <string>
-std::vector<Item> JSONSeekerBase::Search(const Item& item)
-{
+std::vector<Item> JSONSeekerBase::Search(const Item& item) {
std::fstream fs(item.GetAbsPath().c_str(), std::fstream::in);
- if( fs.good() )
- {
+ if (fs.good()) {
SimpleJSONWrapper json;
std::string err;
- if( json.parseIstream( fs, err ) )
- {
- return SearchJSON(item, json.getRoot() );
- }
- else
- {
+ if (json.parseIstream(fs, err)) {
+ return SearchJSON(item, json.getRoot());
+ } else {
LOGE << "Unable to parse " << item << " in json parser, reason: " << err << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Unable to open " << item << " in json parser" << std::endl;
return std::vector<Item>();
}
diff --git a/Source/Ogda/Searchers/Seekers/jsonseekerbase.h b/Source/Ogda/Searchers/Seekers/jsonseekerbase.h
index f2a4171f..495e0b1f 100644
--- a/Source/Ogda/Searchers/Seekers/jsonseekerbase.h
+++ b/Source/Ogda/Searchers/Seekers/jsonseekerbase.h
@@ -20,20 +20,18 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include "seekerbase.h"
class JobHandler;
-namespace Json
-{
- class Value;
+namespace Json {
+class Value;
}
-class JSONSeekerBase : public SeekerBase
-{
-public:
+class JSONSeekerBase : public SeekerBase {
+ public:
std::vector<Item> Search(const Item& item) override;
- virtual std::vector<Item> SearchJSON(const Item & item, Json::Value& root ) = 0;
+ virtual std::vector<Item> SearchJSON(const Item& item, Json::Value& root) = 0;
};
diff --git a/Source/Ogda/Searchers/Seekers/levelnormseeker.cpp b/Source/Ogda/Searchers/Seekers/levelnormseeker.cpp
index 74b1daaa..9c8fdf11 100644
--- a/Source/Ogda/Searchers/Seekers/levelnormseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/levelnormseeker.cpp
@@ -24,14 +24,14 @@
#include "Internal/filesystem.h"
#include "Logging/logdata.h"
-std::vector<Item> LevelNormSeeker::Search(const Item& item ) {
+std::vector<Item> LevelNormSeeker::Search(const Item& item) {
std::vector<Item> items;
const std::string full_path = item.GetAbsPath();
std::string col_full_path = full_path + ".col_norm.zip";
- if( CheckFileAccess(col_full_path.c_str()) ) {
- items.push_back(Item(item.input_folder, item.GetPath() + ".col_norm.zip", "level_norm", item.source ));
+ if (CheckFileAccess(col_full_path.c_str())) {
+ items.push_back(Item(item.input_folder, item.GetPath() + ".col_norm.zip", "level_norm", item.source));
}
-
+
return items;
}
diff --git a/Source/Ogda/Searchers/Seekers/levelnormseeker.h b/Source/Ogda/Searchers/Seekers/levelnormseeker.h
index e7f9aed4..e17d3bc4 100644
--- a/Source/Ogda/Searchers/Seekers/levelnormseeker.h
+++ b/Source/Ogda/Searchers/Seekers/levelnormseeker.h
@@ -20,16 +20,14 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include "seekerbase.h"
-class LevelNormSeeker : public SeekerBase
-{
-public:
- std::vector<Item> Search(const Item& item ) override;
- const char* GetName() override
- {
+class LevelNormSeeker : public SeekerBase {
+ public:
+ std::vector<Item> Search(const Item& item) override;
+ const char* GetName() override {
return "level_norm_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/levelseekerbase.cpp b/Source/Ogda/Searchers/Seekers/levelseekerbase.cpp
index e41b4a48..979a90d0 100644
--- a/Source/Ogda/Searchers/Seekers/levelseekerbase.cpp
+++ b/Source/Ogda/Searchers/Seekers/levelseekerbase.cpp
@@ -26,17 +26,13 @@
#include <Logging/logdata.h>
-std::vector<Item> LevelSeekerBase::SearchXML( const Item& item, TiXmlDocument& doc )
-{
+std::vector<Item> LevelSeekerBase::SearchXML(const Item& item, TiXmlDocument& doc) {
TiXmlElement* eRoot = doc.RootElement();
TiXmlHandle hRoot(eRoot);
-
- if( strcmp(eRoot->Value(), "Level") == 0 )
- {
+
+ if (strcmp(eRoot->Value(), "Level") == 0) {
return this->SearchLevelRoot(item, hRoot);
- }
- else
- {
+ } else {
TiXmlHandle root(&(doc));
return this->SearchLevelRoot(item, root);
}
diff --git a/Source/Ogda/Searchers/Seekers/levelseekerbase.h b/Source/Ogda/Searchers/Seekers/levelseekerbase.h
index a4440bdf..b7e6069e 100644
--- a/Source/Ogda/Searchers/Seekers/levelseekerbase.h
+++ b/Source/Ogda/Searchers/Seekers/levelseekerbase.h
@@ -20,14 +20,13 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include "xmlseekerbase.h"
class TiXmlHandle;
-class LevelSeekerBase : public XMLSeekerBase
-{
- std::vector<Item> SearchXML( const Item& item, TiXmlDocument& doc ) override;
- virtual std::vector<Item> SearchLevelRoot( const Item& item, TiXmlHandle& hRoot ) = 0;
+class LevelSeekerBase : public XMLSeekerBase {
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
+ virtual std::vector<Item> SearchLevelRoot(const Item& item, TiXmlHandle& hRoot) = 0;
};
diff --git a/Source/Ogda/Searchers/Seekers/materialseeker.cpp b/Source/Ogda/Searchers/Seekers/materialseeker.cpp
index 54c02155..742bbe62 100644
--- a/Source/Ogda/Searchers/Seekers/materialseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/materialseeker.cpp
@@ -29,8 +29,7 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-enum
-{
+enum {
ROOT = 1,
EVENT,
MATERIAL,
@@ -38,154 +37,131 @@ enum
DECALS
};
-std::vector<Item> MaterialSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
+std::vector<Item> MaterialSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
std::vector<Item> items;
std::vector<elempair> elems;
- elems.push_back( elempair( "material", "" ) );
-
+ elems.push_back(elempair("material", ""));
+
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, &doc, elems, elems_ignore, this, (void*)ROOT );
+
+ ElementScanner::Do(items, item, &doc, elems, elems_ignore, this, (void*)ROOT);
return items;
}
-void MaterialSeeker::HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata )
-{
- if( userdata == (void*)ROOT )
- {
- if( strmtch(eElem->Value(), "material") )
- {
+void MaterialSeeker::HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) {
+ if (userdata == (void*)ROOT) {
+ if (strmtch(eElem->Value(), "material")) {
std::vector<elempair> elems;
- elems.push_back(elempair("events",""));
- elems.push_back(elempair("particles",""));
- elems.push_back(elempair("decals",""));
+ elems.push_back(elempair("events", ""));
+ elems.push_back(elempair("particles", ""));
+ elems.push_back(elempair("decals", ""));
std::vector<const char*> elems_ignore;
- elems_ignore.push_back( "physics" );
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)MATERIAL );
- }
- else
- {
- LOGE << "Unknown item sub " << eElem->Value() << " " << item << std::endl;
+ elems_ignore.push_back("physics");
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)MATERIAL);
+ } else {
+ LOGE << "Unknown item sub " << eElem->Value() << " " << item << std::endl;
}
- }
- else if( userdata == (void*)MATERIAL )
- {
- if( strmtch(eElem->Value(), "events") )
- {
+ } else if (userdata == (void*)MATERIAL) {
+ if (strmtch(eElem->Value(), "events")) {
std::vector<elempair> elems;
- elems.push_back(elempair("leftrunstep",""));
- elems.push_back(elempair("rightrunstep",""));
- elems.push_back(elempair("leftwallstep",""));
- elems.push_back(elempair("rightwallstep",""));
- elems.push_back(elempair("leftwalkstep",""));
- elems.push_back(elempair("rightwalkstep",""));
- elems.push_back(elempair("leftcrouchwalkstep",""));
- elems.push_back(elempair("rightcrouchwalkstep",""));
- elems.push_back(elempair("leftcrouchwalkstep",""));
- elems.push_back(elempair("rightcrouchwalkstep",""));
- elems.push_back(elempair("land",""));
- elems.push_back(elempair("land_soft",""));
- elems.push_back(elempair("land_slide",""));
- elems.push_back(elempair("slide",""));
- elems.push_back(elempair("kick",""));
- elems.push_back(elempair("sweep",""));
- elems.push_back(elempair("jump",""));
- elems.push_back(elempair("roll",""));
- elems.push_back(elempair("edge_grab",""));
- elems.push_back(elempair("edge_crawl",""));
- elems.push_back(elempair("bodyfall",""));
- elems.push_back(elempair("flip",""));
- elems.push_back(elempair("choke_move",""));
- elems.push_back(elempair("choke_grab",""));
- elems.push_back(elempair("choke_full",""));
- elems.push_back(elempair("choke_fall",""));
-
- elems.push_back(elempair("weapon_drop_light",""));
- elems.push_back(elempair("weapon_drop_medium",""));
- elems.push_back(elempair("weapon_drop_heavy",""));
-
- elems.push_back(elempair("bodyfall_light",""));
- elems.push_back(elempair("bodyfall_medium",""));
- elems.push_back(elempair("bodyfall_heavy",""));
-
- elems.push_back(elempair("blood_spatter",""));
- elems.push_back(elempair("blood_drip",""));
-
- elems.push_back(elempair("physics",""));
+ elems.push_back(elempair("leftrunstep", ""));
+ elems.push_back(elempair("rightrunstep", ""));
+ elems.push_back(elempair("leftwallstep", ""));
+ elems.push_back(elempair("rightwallstep", ""));
+ elems.push_back(elempair("leftwalkstep", ""));
+ elems.push_back(elempair("rightwalkstep", ""));
+ elems.push_back(elempair("leftcrouchwalkstep", ""));
+ elems.push_back(elempair("rightcrouchwalkstep", ""));
+ elems.push_back(elempair("leftcrouchwalkstep", ""));
+ elems.push_back(elempair("rightcrouchwalkstep", ""));
+ elems.push_back(elempair("land", ""));
+ elems.push_back(elempair("land_soft", ""));
+ elems.push_back(elempair("land_slide", ""));
+ elems.push_back(elempair("slide", ""));
+ elems.push_back(elempair("kick", ""));
+ elems.push_back(elempair("sweep", ""));
+ elems.push_back(elempair("jump", ""));
+ elems.push_back(elempair("roll", ""));
+ elems.push_back(elempair("edge_grab", ""));
+ elems.push_back(elempair("edge_crawl", ""));
+ elems.push_back(elempair("bodyfall", ""));
+ elems.push_back(elempair("flip", ""));
+ elems.push_back(elempair("choke_move", ""));
+ elems.push_back(elempair("choke_grab", ""));
+ elems.push_back(elempair("choke_full", ""));
+ elems.push_back(elempair("choke_fall", ""));
+
+ elems.push_back(elempair("weapon_drop_light", ""));
+ elems.push_back(elempair("weapon_drop_medium", ""));
+ elems.push_back(elempair("weapon_drop_heavy", ""));
+
+ elems.push_back(elempair("bodyfall_light", ""));
+ elems.push_back(elempair("bodyfall_medium", ""));
+ elems.push_back(elempair("bodyfall_heavy", ""));
+
+ elems.push_back(elempair("blood_spatter", ""));
+ elems.push_back(elempair("blood_drip", ""));
+
+ elems.push_back(elempair("physics", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)EVENT );
- }
- else if( strmtch(eElem->Value(), "particles") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)EVENT);
+ } else if (strmtch(eElem->Value(), "particles")) {
std::vector<elempair> elems;
- elems.push_back(elempair("step",""));
- elems.push_back(elempair("skid",""));
+ elems.push_back(elempair("step", ""));
+ elems.push_back(elempair("skid", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)PARTICLES );
- }
- else if( strmtch(eElem->Value(), "decals") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)PARTICLES);
+ } else if (strmtch(eElem->Value(), "decals")) {
std::vector<elempair> elems;
- elems.push_back(elempair("step",""));
- elems.push_back(elempair("skid",""));
+ elems.push_back(elempair("step", ""));
+ elems.push_back(elempair("skid", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)DECALS );
- }
- else
- {
- LOGE << "Unknown item sub " << eElem->Value() << " " << item << std::endl;
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)DECALS);
+ } else {
+ LOGE << "Unknown item sub " << eElem->Value() << " " << item << std::endl;
}
- }
- else if( userdata == (void*)DECALS )
- {
+ } else if (userdata == (void*)DECALS) {
std::vector<attribpair> elems;
std::vector<const char*> elems_ignore;
elems.push_back(attribpair("color", "texture"));
elems.push_back(attribpair("normal", "texture"));
-
+
elems_ignore.push_back("shader");
- AttributeScanner::Do( items, item, eElem, elems, elems_ignore);
- }
- else if( userdata == (void*)EVENT )
- {
+ AttributeScanner::Do(items, item, eElem, elems, elems_ignore);
+ } else if (userdata == (void*)EVENT) {
std::vector<attribpair> elems;
std::vector<const char*> elems_ignore;
elems.push_back(attribpair("soundgroup", "sound"));
-
+
elems_ignore.push_back("attached");
elems_ignore.push_back("max_distance");
- AttributeScanner::Do( items, item, eElem, elems, elems_ignore);
- }
- else if( userdata == (void*)PARTICLES )
- {
+ AttributeScanner::Do(items, item, eElem, elems, elems_ignore);
+ } else if (userdata == (void*)PARTICLES) {
std::vector<attribpair> elems;
std::vector<const char*> elems_ignore;
elems.push_back(attribpair("path", "particle"));
- AttributeScanner::Do( items, item, eElem, elems, elems_ignore);
- }
- else
- {
- XMLSeekerBase::HandleElementCallback( items, eRoot, eElem, item, userdata );
+ AttributeScanner::Do(items, item, eElem, elems, elems_ignore);
+ } else {
+ XMLSeekerBase::HandleElementCallback(items, eRoot, eElem, item, userdata);
}
}
diff --git a/Source/Ogda/Searchers/Seekers/materialseeker.h b/Source/Ogda/Searchers/Seekers/materialseeker.h
index 75eb130d..dbe834a5 100644
--- a/Source/Ogda/Searchers/Seekers/materialseeker.h
+++ b/Source/Ogda/Searchers/Seekers/materialseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class MaterialSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
- void HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata ) override;
- inline const char* GetName() override
- {
+class MaterialSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
+ void HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) override;
+ inline const char* GetName() override {
return "material_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/objcolseeker.cpp b/Source/Ogda/Searchers/Seekers/objcolseeker.cpp
index 3aa985da..0ef2b62e 100644
--- a/Source/Ogda/Searchers/Seekers/objcolseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/objcolseeker.cpp
@@ -24,20 +24,19 @@
#include "Internal/filesystem.h"
#include "Logging/logdata.h"
-std::vector<Item> ObjColSeeker::Search(const Item& item ) {
+std::vector<Item> ObjColSeeker::Search(const Item& item) {
std::vector<Item> items;
const std::string full_path = item.GetAbsPath();
- std::string col_full_path = full_path.substr(0,full_path.length()-4) + "_COL.obj";
- if( CheckFileAccess(col_full_path.c_str()) ) {
- items.push_back(Item(item.input_folder, item.GetPath().substr(0,item.path.length()-4) + "_COL.obj", "model_collision", item.source ));
+ std::string col_full_path = full_path.substr(0, full_path.length() - 4) + "_COL.obj";
+ if (CheckFileAccess(col_full_path.c_str())) {
+ items.push_back(Item(item.input_folder, item.GetPath().substr(0, item.path.length() - 4) + "_COL.obj", "model_collision", item.source));
} else {
- col_full_path = full_path.substr(0,full_path.length()-4) + "_col.obj";
- if( CheckFileAccess(col_full_path.c_str()) )
- {
- items.push_back(Item( item.input_folder, item.GetPath().substr(0,item.path.length()-4) + "_col.obj", "model_collision", item.source ));
+ col_full_path = full_path.substr(0, full_path.length() - 4) + "_col.obj";
+ if (CheckFileAccess(col_full_path.c_str())) {
+ items.push_back(Item(item.input_folder, item.GetPath().substr(0, item.path.length() - 4) + "_col.obj", "model_collision", item.source));
}
}
-
+
return items;
}
diff --git a/Source/Ogda/Searchers/Seekers/objcolseeker.h b/Source/Ogda/Searchers/Seekers/objcolseeker.h
index ab55de55..175efdd5 100644
--- a/Source/Ogda/Searchers/Seekers/objcolseeker.h
+++ b/Source/Ogda/Searchers/Seekers/objcolseeker.h
@@ -20,16 +20,14 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include "seekerbase.h"
-class ObjColSeeker : public SeekerBase
-{
-public:
- std::vector<Item> Search( const Item& item ) override;
- const char* GetName() override
- {
+class ObjColSeeker : public SeekerBase {
+ public:
+ std::vector<Item> Search(const Item& item) override;
+ const char* GetName() override {
return "objcol_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/objectseeker.cpp b/Source/Ogda/Searchers/Seekers/objectseeker.cpp
index 6c1babd2..32ab6e65 100644
--- a/Source/Ogda/Searchers/Seekers/objectseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/objectseeker.cpp
@@ -27,146 +27,117 @@
#include <Logging/logdata.h>
#include <Utility/strings.h>
-std::vector<Item> ObjectSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
- const char* elems[] =
- {
- "Model",
- "ColorMap",
- "NormalMap",
- "PaletteMap",
- "WeightMap",
- "TranslucencyMap",
- "WindMap",
- "MaterialPath",
- "SharpnessMap"
- };
+std::vector<Item> ObjectSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
+ const char* elems[] =
+ {
+ "Model",
+ "ColorMap",
+ "NormalMap",
+ "PaletteMap",
+ "WeightMap",
+ "TranslucencyMap",
+ "WindMap",
+ "MaterialPath",
+ "SharpnessMap"};
const char* elems_type[] =
- {
- "model",
- "texture",
- "texture",
- "texture",
- "texture",
- "texture",
- "texture",
- "material",
- "texture"
- };
+ {
+ "model",
+ "texture",
+ "texture",
+ "texture",
+ "texture",
+ "texture",
+ "texture",
+ "material",
+ "texture"};
assert(ARRLEN(elems_type) == ARRLEN(elems));
- const char* ignored[] =
- {
- "Shader",
- "ShaderName",
- "ShaderPath",
- "flags",
- "GroundOffset",
- "avg_color",
- "label"
- };
+ const char* ignored[] =
+ {
+ "Shader",
+ "ShaderName",
+ "ShaderPath",
+ "flags",
+ "GroundOffset",
+ "avg_color",
+ "label"};
std::vector<Item> items;
TiXmlHandle hRoot(&doc);
-
- TiXmlElement *eElem = hRoot.FirstChildElement("Object").FirstChildElement().Element();
- if( !eElem )
- {
+ TiXmlElement* eElem = hRoot.FirstChildElement("Object").FirstChildElement().Element();
+
+ if (!eElem) {
LOGE << "Cant find right root node in " << item << std::endl;
}
- while( eElem )
- {
+ while (eElem) {
const char* name = eElem->Value();
const char* text = eElem->GetText();
- if( name )
- {
+ if (name) {
int id;
- if( (id = FindStringInArray( elems, ARRLEN(elems), name )) >= 0 )
- {
- if( text && strlen(text) > 0 )
- {
- items.push_back(Item(item.input_folder, text,elems_type[id],item.source));
- }
- else
- {
+ if ((id = FindStringInArray(elems, ARRLEN(elems), name)) >= 0) {
+ if (text && strlen(text) > 0) {
+ items.push_back(Item(item.input_folder, text, elems_type[id], item.source));
+ } else {
LOGW << "String value in " << item << " for element " << elems[id] << " is empty" << std::endl;
}
- }
- else if( (id = FindStringInArray( ignored, ARRLEN(ignored), name )) >= 0 )
- {
+ } else if ((id = FindStringInArray(ignored, ARRLEN(ignored), name)) >= 0) {
LOGD << "Ignored " << ignored[id] << " in " << item << std::endl;
- }
- else if( strmtch( "DetailObjects", name ) )
- {
- TiXmlElement *eDetailObject = eElem->FirstChildElement();
+ } else if (strmtch("DetailObjects", name)) {
+ TiXmlElement* eDetailObject = eElem->FirstChildElement();
- while( eDetailObject )
- {
+ while (eDetailObject) {
{
const char* obj_path = eDetailObject->Attribute("obj_path");
- if( obj_path )
- {
+ if (obj_path) {
items.push_back(Item(item.input_folder, obj_path, "object", item.source));
}
}
{
const char* weight_path = eDetailObject->Attribute("weight_path");
- if( weight_path )
- {
+ if (weight_path) {
items.push_back(Item(item.input_folder, weight_path, "texture", item.source));
}
}
eDetailObject = eDetailObject->NextSiblingElement();
}
- }
- else if( strmtch( "DetailMaps", name ) )
- {
- TiXmlElement *eDetailMap = eElem->FirstChildElement();
-
- while( eDetailMap )
- {
+ } else if (strmtch("DetailMaps", name)) {
+ TiXmlElement* eDetailMap = eElem->FirstChildElement();
+ while (eDetailMap) {
{
- const char* colorpath = eDetailMap->Attribute("colorpath");
- if( colorpath )
- {
- items.push_back(Item(item.input_folder, colorpath,"texture",item.source));
+ const char* colorpath = eDetailMap->Attribute("colorpath");
+ if (colorpath) {
+ items.push_back(Item(item.input_folder, colorpath, "texture", item.source));
}
}
{
- const char* normalpath = eDetailMap->Attribute("normalpath");
- if( normalpath )
- {
- items.push_back(Item(item.input_folder, normalpath,"texture",item.source));
+ const char* normalpath = eDetailMap->Attribute("normalpath");
+ if (normalpath) {
+ items.push_back(Item(item.input_folder, normalpath, "texture", item.source));
}
}
{
- const char* materialpath = eDetailMap->Attribute("materialpath");
- if( materialpath )
- {
- items.push_back(Item(item.input_folder, materialpath,"material",item.source));
+ const char* materialpath = eDetailMap->Attribute("materialpath");
+ if (materialpath) {
+ items.push_back(Item(item.input_folder, materialpath, "material", item.source));
}
}
eDetailMap = eDetailMap->NextSiblingElement();
}
- }
- else
- {
+ } else {
LOGE << "Unahandled subvalue in Object from " << item << " called " << name << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Generic warning" << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/objectseeker.h b/Source/Ogda/Searchers/Seekers/objectseeker.h
index bcad089a..26d1c18e 100644
--- a/Source/Ogda/Searchers/Seekers/objectseeker.h
+++ b/Source/Ogda/Searchers/Seekers/objectseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class ObjectSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
+class ObjectSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "object_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/objhullseeker.cpp b/Source/Ogda/Searchers/Seekers/objhullseeker.cpp
index 64d1df92..b693f7bc 100644
--- a/Source/Ogda/Searchers/Seekers/objhullseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/objhullseeker.cpp
@@ -24,25 +24,21 @@
#include "Internal/filesystem.h"
#include "Logging/logdata.h"
-std::vector<Item> ObjHullSeeker::Search(const Item& item )
-{
+std::vector<Item> ObjHullSeeker::Search(const Item& item) {
std::vector<Item> items;
std::string full_path;
full_path = item.GetAbsPath();
- full_path = full_path.substr(0,full_path.length()-4) + "HULL.obj";
- if( CheckFileAccess(full_path.c_str()) )
- {
- items.push_back(Item( item.input_folder, item.GetPath().substr(0,item.path.length()-4) + "HULL.obj", "model_hull", item.source ));
+ full_path = full_path.substr(0, full_path.length() - 4) + "HULL.obj";
+ if (CheckFileAccess(full_path.c_str())) {
+ items.push_back(Item(item.input_folder, item.GetPath().substr(0, item.path.length() - 4) + "HULL.obj", "model_hull", item.source));
}
full_path = item.GetAbsPath();
- full_path = full_path.substr(0,full_path.length()-4) + "hull.obj";
- if( CheckFileAccess(full_path.c_str()) )
- {
- items.push_back(Item( item.input_folder, item.GetPath().substr(0,item.path.length()-4) + "hull.obj", "model_hull", item.source ));
+ full_path = full_path.substr(0, full_path.length() - 4) + "hull.obj";
+ if (CheckFileAccess(full_path.c_str())) {
+ items.push_back(Item(item.input_folder, item.GetPath().substr(0, item.path.length() - 4) + "hull.obj", "model_hull", item.source));
}
return items;
}
-
diff --git a/Source/Ogda/Searchers/Seekers/objhullseeker.h b/Source/Ogda/Searchers/Seekers/objhullseeker.h
index 6b13a7dd..06a7d08a 100644
--- a/Source/Ogda/Searchers/Seekers/objhullseeker.h
+++ b/Source/Ogda/Searchers/Seekers/objhullseeker.h
@@ -20,16 +20,14 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include "seekerbase.h"
-class ObjHullSeeker : public SeekerBase
-{
-public:
- std::vector<Item> Search(const Item& item ) override;
- const char* GetName() override
- {
+class ObjHullSeeker : public SeekerBase {
+ public:
+ std::vector<Item> Search(const Item& item) override;
+ const char* GetName() override {
return "objhull_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/particleseeker.cpp b/Source/Ogda/Searchers/Seekers/particleseeker.cpp
index 6f1857a1..66783956 100644
--- a/Source/Ogda/Searchers/Seekers/particleseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/particleseeker.cpp
@@ -29,36 +29,31 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-enum
-{
+enum {
ROOT = 1,
PARTICLE
};
-std::vector<Item> ParticleSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
+std::vector<Item> ParticleSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
std::vector<Item> items;
std::vector<elempair> elems;
- elems.push_back( elempair( "particle", "" ) );
-
+ elems.push_back(elempair("particle", ""));
+
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, &doc, elems, elems_ignore, this, (void*)ROOT );
+
+ ElementScanner::Do(items, item, &doc, elems, elems_ignore, this, (void*)ROOT);
return items;
}
-void ParticleSeeker::HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata )
-{
- if( userdata == (void*)ROOT )
- {
- if( strmtch(eElem->Value(), "particle") )
- {
+void ParticleSeeker::HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) {
+ if (userdata == (void*)ROOT) {
+ if (strmtch(eElem->Value(), "particle")) {
std::vector<elempair> elems;
- elems.push_back( elempair( "textures", "" ) );
- elems.push_back( elempair( "collision", "" ) );
-
+ elems.push_back(elempair("textures", ""));
+ elems.push_back(elempair("collision", ""));
+
std::vector<const char*> elems_ignore;
elems_ignore.push_back("size");
elems_ignore.push_back("rotation");
@@ -69,54 +64,40 @@ void ParticleSeeker::HandleElementCallback( std::vector<Item>& items, TiXmlNode*
elems_ignore.push_back("no_rotation");
elems_ignore.push_back("quadratic_expansion");
elems_ignore.push_back("quadratic_dispersion");
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)PARTICLE );
- }
- else
- {
- LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)PARTICLE);
+ } else {
+ LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
}
- }
- else if( userdata == (void*)PARTICLE )
- {
+ } else if (userdata == (void*)PARTICLE) {
std::vector<attribpair> elems;
std::vector<const char*> elems_ignore;
- if( strmtch(eElem->Value(), "textures") )
- {
+ if (strmtch(eElem->Value(), "textures")) {
elems.push_back(attribpair("color_map", "texture"));
elems.push_back(attribpair("normal_map", "texture"));
- //Ignoring this as it never seems to actually point to any real object.
- //elems.push_back(attribpair("animation_effect", "animation_effect"));
+ // Ignoring this as it never seems to actually point to any real object.
+ // elems.push_back(attribpair("animation_effect", "animation_effect"));
- elems_ignore.push_back( "animation_effect" );
- elems_ignore.push_back( "shader" );
- elems_ignore.push_back( "soft_shader" );
- }
- else if( strmtch(eElem->Value(), "collision") )
- {
+ elems_ignore.push_back("animation_effect");
+ elems_ignore.push_back("shader");
+ elems_ignore.push_back("soft_shader");
+ } else if (strmtch(eElem->Value(), "collision")) {
elems.push_back(attribpair("decal", "decal_object"));
- elems_ignore.push_back( "decal_size_mult" );
- elems_ignore.push_back( "destroy" );
- elems_ignore.push_back( "character_collide" );
- elems_ignore.push_back( "character_add_blood" );
- elems_ignore.push_back( "material_event" );
- elems_ignore.push_back( "materialevent" );
- }
- else
- {
- LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
+ elems_ignore.push_back("decal_size_mult");
+ elems_ignore.push_back("destroy");
+ elems_ignore.push_back("character_collide");
+ elems_ignore.push_back("character_add_blood");
+ elems_ignore.push_back("material_event");
+ elems_ignore.push_back("materialevent");
+ } else {
+ LOGE << "Unknown item sub" << eElem->Value() << " " << item << std::endl;
}
- AttributeScanner::Do( items, item, eElem, elems, elems_ignore);
- }
- else if( userdata == (void*)0 )
- {
-
- }
- else
- {
- XMLSeekerBase::HandleElementCallback( items, eRoot, eElem, item, userdata );
+ AttributeScanner::Do(items, item, eElem, elems, elems_ignore);
+ } else if (userdata == (void*)0) {
+ } else {
+ XMLSeekerBase::HandleElementCallback(items, eRoot, eElem, item, userdata);
}
}
diff --git a/Source/Ogda/Searchers/Seekers/particleseeker.h b/Source/Ogda/Searchers/Seekers/particleseeker.h
index 9021d75d..18949be2 100644
--- a/Source/Ogda/Searchers/Seekers/particleseeker.h
+++ b/Source/Ogda/Searchers/Seekers/particleseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class ParticleSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
- void HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata ) override;
- inline const char* GetName() override
- {
+class ParticleSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
+ void HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) override;
+ inline const char* GetName() override {
return "particle_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.cpp b/Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.cpp
index 85dde581..2a0d0587 100644
--- a/Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.cpp
@@ -24,16 +24,14 @@
#include <Internal/filesystem.h>
-std::vector<Item> PreConvertedDDSSeeker::Search( const Item& item )
-{
+std::vector<Item> PreConvertedDDSSeeker::Search(const Item& item) {
std::vector<Item> items;
std::string abs_path = item.GetAbsPath() + "_converted.dds";
- if(CheckFileAccess(abs_path.c_str()))
- {
- Item nitem = Item( item.input_folder, item.GetPath() + "_converted.dds", item.type, item.source );
+ if (CheckFileAccess(abs_path.c_str())) {
+ Item nitem = Item(item.input_folder, item.GetPath() + "_converted.dds", item.type, item.source);
nitem.SetOvershadows(item);
- items.push_back( nitem );
+ items.push_back(nitem);
}
return items;
diff --git a/Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.h b/Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.h
index 7d8ac95f..50cd0a2a 100644
--- a/Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.h
+++ b/Source/Ogda/Searchers/Seekers/preconvertedddsshadowseeker.h
@@ -26,13 +26,11 @@
class JobHandler;
-class PreConvertedDDSSeeker : public SeekerBase
-{
-public:
- std::vector<Item> Search( const Item& item ) override;
+class PreConvertedDDSSeeker : public SeekerBase {
+ public:
+ std::vector<Item> Search(const Item& item) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "pre_converted_dds_shadow";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/prefabseeker.cpp b/Source/Ogda/Searchers/Seekers/prefabseeker.cpp
index 2eac5efc..9947271a 100644
--- a/Source/Ogda/Searchers/Seekers/prefabseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/prefabseeker.cpp
@@ -29,901 +29,858 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-enum
-{
+enum {
ROOT = 1,
GROUP,
PARAMETER
};
-std::vector<Item> PrefabSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
+std::vector<Item> PrefabSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
std::vector<Item> items;
std::vector<elempair> elems;
- elems.push_back( elempair( "Prefab", "" ) );
- elems.push_back( elempair( "Groups", "" ) );
- elems.push_back( elempair( "ActorObjects", "" ) );
- elems.push_back( elempair( "EnvObjects", "" ) );
- elems.push_back( elempair( "Decals", "" ) );
- elems.push_back( elempair( "Hotspots", "" ) );
-
+ elems.push_back(elempair("Prefab", ""));
+ elems.push_back(elempair("Groups", ""));
+ elems.push_back(elempair("ActorObjects", ""));
+ elems.push_back(elempair("EnvObjects", ""));
+ elems.push_back(elempair("Decals", ""));
+ elems.push_back(elempair("Hotspots", ""));
+
std::vector<const char*> elems_ignore;
- elems_ignore.push_back( "Type" );
-
- ElementScanner::Do( items, item, &doc, elems, elems_ignore, this, (void*)ROOT );
+ elems_ignore.push_back("Type");
+
+ ElementScanner::Do(items, item, &doc, elems, elems_ignore, this, (void*)ROOT);
return items;
}
-void PrefabSeeker::HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata )
-{
- if( userdata == (void*)ROOT )
- {
+void PrefabSeeker::HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) {
+ if (userdata == (void*)ROOT) {
std::vector<elempair> elems;
- elems.push_back( elempair( "parameters", "") );
- elems.push_back( elempair( "Prefab", "" ) );
- elems.push_back( elempair( "Group", "" ) );
- elems.push_back( elempair( "ActorObject","" ));
- elems.push_back( elempair( "EnvObject","" ));
- elems.push_back( elempair( "Decal","" ));
- elems.push_back( elempair( "Hotspot","" ));
- elems.push_back( elempair( "PlaceholderObject","" ));
- elems.push_back( elempair( "PathPointObject", "" ));
- elems.push_back( elempair( "LightProbeObject", "" ));
- elems.push_back( elempair( "DynamicLightObject", "" ));
- elems.push_back( elempair( "NavmeshHintObject", ""));
- elems.push_back( elempair( "NavmeshConnectionObject", ""));
- elems.push_back( elempair( "NavmeshRegionObject", ""));
- elems.push_back( elempair( "ReflectionCaptureObject",""));
- elems.push_back( elempair( "LightVolumeObject",""));
+ elems.push_back(elempair("parameters", ""));
+ elems.push_back(elempair("Prefab", ""));
+ elems.push_back(elempair("Group", ""));
+ elems.push_back(elempair("ActorObject", ""));
+ elems.push_back(elempair("EnvObject", ""));
+ elems.push_back(elempair("Decal", ""));
+ elems.push_back(elempair("Hotspot", ""));
+ elems.push_back(elempair("PlaceholderObject", ""));
+ elems.push_back(elempair("PathPointObject", ""));
+ elems.push_back(elempair("LightProbeObject", ""));
+ elems.push_back(elempair("DynamicLightObject", ""));
+ elems.push_back(elempair("NavmeshHintObject", ""));
+ elems.push_back(elempair("NavmeshConnectionObject", ""));
+ elems.push_back(elempair("NavmeshRegionObject", ""));
+ elems.push_back(elempair("ReflectionCaptureObject", ""));
+ elems.push_back(elempair("LightVolumeObject", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)GROUP );
- }
- else if( userdata == (void*)GROUP )
- {
- if( strmtch(eElem->Value(), "Group") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)GROUP);
+ } else if (userdata == (void*)GROUP) {
+ if (strmtch(eElem->Value(), "Group")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
-
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "uses_imposter" );
-
- attribs_ignore.push_back( "d0" );
- attribs_ignore.push_back( "d1" );
- attribs_ignore.push_back( "d2" );
-
- attribs_ignore.push_back( "c0" );
- attribs_ignore.push_back( "c1" );
- attribs_ignore.push_back( "c2" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "version" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("uses_imposter");
+
+ attribs_ignore.push_back("d0");
+ attribs_ignore.push_back("d1");
+ attribs_ignore.push_back("d2");
+
+ attribs_ignore.push_back("c0");
+ attribs_ignore.push_back("c1");
+ attribs_ignore.push_back("c2");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("version");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
std::vector<elempair> elems;
- elems.push_back( elempair( "parameters", "") );
- elems.push_back( elempair( "Prefab", "" ) );
- elems.push_back( elempair( "Group", "" ) );
- elems.push_back( elempair( "ActorObject","" ));
- elems.push_back( elempair( "EnvObject","" ));
- elems.push_back( elempair( "Decal","" ));
- elems.push_back( elempair( "Hotspot","" ));
- elems.push_back( elempair( "PlaceholderObject","" ));
- elems.push_back( elempair( "PathPointObject", "" ));
- elems.push_back( elempair( "LightProbeObject", "" ));
- elems.push_back( elempair( "DynamicLightObject", "" ));
- elems.push_back( elempair( "NavmeshHintObject", ""));
- elems.push_back( elempair( "NavmeshConnectionObject", ""));
- elems.push_back( elempair( "NavmeshRegionObject", ""));
- elems.push_back( elempair( "ReflectionCaptureObject",""));
- elems.push_back( elempair( "LightVolumeObject",""));
+ elems.push_back(elempair("parameters", ""));
+ elems.push_back(elempair("Prefab", ""));
+ elems.push_back(elempair("Group", ""));
+ elems.push_back(elempair("ActorObject", ""));
+ elems.push_back(elempair("EnvObject", ""));
+ elems.push_back(elempair("Decal", ""));
+ elems.push_back(elempair("Hotspot", ""));
+ elems.push_back(elempair("PlaceholderObject", ""));
+ elems.push_back(elempair("PathPointObject", ""));
+ elems.push_back(elempair("LightProbeObject", ""));
+ elems.push_back(elempair("DynamicLightObject", ""));
+ elems.push_back(elempair("NavmeshHintObject", ""));
+ elems.push_back(elempair("NavmeshConnectionObject", ""));
+ elems.push_back(elempair("NavmeshRegionObject", ""));
+ elems.push_back(elempair("ReflectionCaptureObject", ""));
+ elems.push_back(elempair("LightVolumeObject", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)GROUP );
- }
- else if( strmtch(eElem->Value(), "Prefab") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)GROUP);
+ } else if (strmtch(eElem->Value(), "Prefab")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
-
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "uses_imposter" );
-
- attribs_ignore.push_back( "d0" );
- attribs_ignore.push_back( "d1" );
- attribs_ignore.push_back( "d2" );
-
- attribs_ignore.push_back( "c0" );
- attribs_ignore.push_back( "c1" );
- attribs_ignore.push_back( "c2" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "version" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("uses_imposter");
+
+ attribs_ignore.push_back("d0");
+ attribs_ignore.push_back("d1");
+ attribs_ignore.push_back("d2");
+
+ attribs_ignore.push_back("c0");
+ attribs_ignore.push_back("c1");
+ attribs_ignore.push_back("c2");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("version");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
std::vector<elempair> elems;
- elems.push_back( elempair( "parameters", "") );
- elems.push_back( elempair( "Prefab", "" ) );
- elems.push_back( elempair( "Group", "" ) );
- elems.push_back( elempair( "ActorObject","" ));
- elems.push_back( elempair( "EnvObject","" ));
- elems.push_back( elempair( "Decal","" ));
- elems.push_back( elempair( "Hotspot","" ));
- elems.push_back( elempair( "PlaceholderObject","" ));
- elems.push_back( elempair( "PathPointObject", "" ));
- elems.push_back( elempair( "LightProbeObject", "" ));
- elems.push_back( elempair( "DynamicLightObject", "" ));
- elems.push_back( elempair( "NavmeshHintObject", ""));
- elems.push_back( elempair( "NavmeshConnectionObject", ""));
- elems.push_back( elempair( "NavmeshRegionObject", ""));
- elems.push_back( elempair( "ReflectionCaptureObject",""));
- elems.push_back( elempair( "LightVolumeObject",""));
+ elems.push_back(elempair("parameters", ""));
+ elems.push_back(elempair("Prefab", ""));
+ elems.push_back(elempair("Group", ""));
+ elems.push_back(elempair("ActorObject", ""));
+ elems.push_back(elempair("EnvObject", ""));
+ elems.push_back(elempair("Decal", ""));
+ elems.push_back(elempair("Hotspot", ""));
+ elems.push_back(elempair("PlaceholderObject", ""));
+ elems.push_back(elempair("PathPointObject", ""));
+ elems.push_back(elempair("LightProbeObject", ""));
+ elems.push_back(elempair("DynamicLightObject", ""));
+ elems.push_back(elempair("NavmeshHintObject", ""));
+ elems.push_back(elempair("NavmeshConnectionObject", ""));
+ elems.push_back(elempair("NavmeshRegionObject", ""));
+ elems.push_back(elempair("ReflectionCaptureObject", ""));
+ elems.push_back(elempair("LightVolumeObject", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)GROUP );
- }
- else if( strmtch(eElem->Value(), "PlaceholderObject") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)GROUP);
+ } else if (strmtch(eElem->Value(), "PlaceholderObject")) {
std::vector<attribpair> attribs;
- attribs.push_back( attribpair("type_file", "object") );
+ attribs.push_back(attribpair("type_file", "object"));
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "special_type" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("special_type");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
std::vector<elempair> elems;
- elems.push_back( elempair( "parameters", "" ) );
+ elems.push_back(elempair("parameters", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)GROUP );
- }
- else if( strmtch(eElem->Value(), "EnvObject") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)GROUP);
+ } else if (strmtch(eElem->Value(), "EnvObject")) {
std::vector<attribpair> attribs;
- attribs.push_back( attribpair("type_file", "object") );
+ attribs.push_back(attribpair("type_file", "object"));
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
std::vector<elempair> elems;
- elems.push_back( elempair( "parameters", "" ) );
+ elems.push_back(elempair("parameters", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)GROUP );
- }
- else if( strmtch(eElem->Value(), "Decal") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)GROUP);
+ } else if (strmtch(eElem->Value(), "Decal")) {
std::vector<attribpair> attribs;
- attribs.push_back( attribpair("type_file", "decal_object") );
+ attribs.push_back(attribpair("type_file", "decal_object"));
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "i" );
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "p0" );
- attribs_ignore.push_back( "p1" );
- attribs_ignore.push_back( "p2" );
-
- attribs_ignore.push_back( "p_mode" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
+ attribs_ignore.push_back("i");
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("p0");
+ attribs_ignore.push_back("p1");
+ attribs_ignore.push_back("p2");
+
+ attribs_ignore.push_back("p_mode");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
std::vector<elempair> elems;
- elems.push_back( elempair( "parameters", "" ) );
+ elems.push_back(elempair("parameters", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)GROUP );
- }
- else if( strmtch(eElem->Value(), "ActorObject") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)GROUP);
+ } else if (strmtch(eElem->Value(), "ActorObject")) {
std::vector<attribpair> attribs;
- attribs.push_back( attribpair("type_file", "actor_object") );
+ attribs.push_back(attribpair("type_file", "actor_object"));
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "is_player" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("is_player");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
std::vector<elempair> elems;
- elems.push_back( elempair( "parameters", "" ) );
+ elems.push_back(elempair("parameters", ""));
std::vector<const char*> elems_ignore;
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)GROUP );
- }
- else if( strmtch(eElem->Value(), "PathPointObject") )
- {
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)GROUP);
+ } else if (strmtch(eElem->Value(), "PathPointObject")) {
std::vector<attribpair> attribs;
- attribs.push_back( attribpair("type_file", "path_point_object") );
+ attribs.push_back(attribpair("type_file", "path_point_object"));
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
std::vector<elempair> elems;
- elems.push_back( elempair( "parameters", "" ) );
+ elems.push_back(elempair("parameters", ""));
std::vector<const char*> elems_ignore;
- elems_ignore.push_back( "Connections" );
-
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)GROUP );
- }
- else if( strmtch(eElem->Value(), "LightProbeObject") )
- {
+ elems_ignore.push_back("Connections");
+
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)GROUP);
+ } else if (strmtch(eElem->Value(), "LightProbeObject")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "special_type" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
- }
- else if( strmtch(eElem->Value(), "DynamicLightObject") )
- {
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("special_type");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
+ } else if (strmtch(eElem->Value(), "DynamicLightObject")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "special_type" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
- }
- else if( strmtch(eElem->Value(), "NavmeshHintObject") )
- {
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("special_type");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
+ } else if (strmtch(eElem->Value(), "NavmeshHintObject")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "special_type" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
- }
- else if( strmtch(eElem->Value(), "NavmeshConnectionObject") )
- {
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("special_type");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
+ } else if (strmtch(eElem->Value(), "NavmeshConnectionObject")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "special_type" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
- }
- else if( strmtch(eElem->Value(), "NavmeshRegionObject") )
- {
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("special_type");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
+ } else if (strmtch(eElem->Value(), "NavmeshRegionObject")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "special_type" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
- }
- else if( strmtch(eElem->Value(), "ReflectionCaptureObject") )
- {
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("special_type");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
+ } else if (strmtch(eElem->Value(), "ReflectionCaptureObject")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "special_type" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
- }
- else if( strmtch(eElem->Value(), "Hotspot") )
- {
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("special_type");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
+ } else if (strmtch(eElem->Value(), "Hotspot")) {
std::vector<attribpair> attribs;
- attribs.push_back( attribpair("type_file", "hotspot_object") );
+ attribs.push_back(attribpair("type_file", "hotspot_object"));
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "group_id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- attribs_ignore.push_back( "special_type" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
- }
- else if( strmtch(eElem->Value(), "LightVolumeObject") )
- {
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("group_id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ attribs_ignore.push_back("special_type");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
+ } else if (strmtch(eElem->Value(), "LightVolumeObject")) {
std::vector<attribpair> attribs;
std::vector<const char*> attribs_ignore;
- attribs_ignore.push_back( "id" );
- attribs_ignore.push_back( "s0" );
- attribs_ignore.push_back( "s1" );
- attribs_ignore.push_back( "s2" );
-
- attribs_ignore.push_back( "t0" );
- attribs_ignore.push_back( "t1" );
- attribs_ignore.push_back( "t2" );
-
- attribs_ignore.push_back( "color_r" );
- attribs_ignore.push_back( "color_b" );
- attribs_ignore.push_back( "color_g" );
-
- attribs_ignore.push_back( "overbright" );
-
- attribs_ignore.push_back( "r0" );
- attribs_ignore.push_back( "r1" );
- attribs_ignore.push_back( "r2" );
- attribs_ignore.push_back( "r3" );
- attribs_ignore.push_back( "r4" );
- attribs_ignore.push_back( "r5" );
- attribs_ignore.push_back( "r6" );
- attribs_ignore.push_back( "r7" );
- attribs_ignore.push_back( "r8" );
- attribs_ignore.push_back( "r9" );
- attribs_ignore.push_back( "r10" );
- attribs_ignore.push_back( "r11" );
- attribs_ignore.push_back( "r12" );
- attribs_ignore.push_back( "r13" );
- attribs_ignore.push_back( "r14" );
- attribs_ignore.push_back( "r15" );
-
- attribs_ignore.push_back( "q0" );
- attribs_ignore.push_back( "q1" );
- attribs_ignore.push_back( "q2" );
- attribs_ignore.push_back( "q3" );
-
- AttributeScanner::Do( items, item, eElem, attribs, attribs_ignore );
- }
- else if( strmtch(eElem->Value(), "parameters") )
- {
+ attribs_ignore.push_back("id");
+ attribs_ignore.push_back("s0");
+ attribs_ignore.push_back("s1");
+ attribs_ignore.push_back("s2");
+
+ attribs_ignore.push_back("t0");
+ attribs_ignore.push_back("t1");
+ attribs_ignore.push_back("t2");
+
+ attribs_ignore.push_back("color_r");
+ attribs_ignore.push_back("color_b");
+ attribs_ignore.push_back("color_g");
+
+ attribs_ignore.push_back("overbright");
+
+ attribs_ignore.push_back("r0");
+ attribs_ignore.push_back("r1");
+ attribs_ignore.push_back("r2");
+ attribs_ignore.push_back("r3");
+ attribs_ignore.push_back("r4");
+ attribs_ignore.push_back("r5");
+ attribs_ignore.push_back("r6");
+ attribs_ignore.push_back("r7");
+ attribs_ignore.push_back("r8");
+ attribs_ignore.push_back("r9");
+ attribs_ignore.push_back("r10");
+ attribs_ignore.push_back("r11");
+ attribs_ignore.push_back("r12");
+ attribs_ignore.push_back("r13");
+ attribs_ignore.push_back("r14");
+ attribs_ignore.push_back("r15");
+
+ attribs_ignore.push_back("q0");
+ attribs_ignore.push_back("q1");
+ attribs_ignore.push_back("q2");
+ attribs_ignore.push_back("q3");
+
+ AttributeScanner::Do(items, item, eElem, attribs, attribs_ignore);
+ } else if (strmtch(eElem->Value(), "parameters")) {
std::vector<elempair> elems;
- elems.push_back(elempair("parameter",""));
+ elems.push_back(elempair("parameter", ""));
std::vector<const char*> elems_ignore;
- ElementScanner::Do( items, item, eElem, elems, elems_ignore, this, (void*)PARAMETER );
- }
- else
- {
- LOGE << "Unknown item sub " << eElem->Value() << " " << item << std::endl;
+ ElementScanner::Do(items, item, eElem, elems, elems_ignore, this, (void*)PARAMETER);
+ } else {
+ LOGE << "Unknown item sub " << eElem->Value() << " " << item << std::endl;
}
- }
- else if( userdata == (void*)PARAMETER )
- {
- std::vector<parampair> params;
+ } else if (userdata == (void*)PARAMETER) {
+ std::vector<parampair> params;
- std::vector<const char*> params_ignore;
- params_ignore.push_back( "Name" );
+ std::vector<const char*> params_ignore;
+ params_ignore.push_back("Name");
- ParameterScanner::Do( items, item, eElem, params, params_ignore);
- }
- else
- {
- XMLSeekerBase::HandleElementCallback( items, eRoot, eElem, item, userdata );
+ ParameterScanner::Do(items, item, eElem, params, params_ignore);
+ } else {
+ XMLSeekerBase::HandleElementCallback(items, eRoot, eElem, item, userdata);
}
}
diff --git a/Source/Ogda/Searchers/Seekers/prefabseeker.h b/Source/Ogda/Searchers/Seekers/prefabseeker.h
index e2bf1039..de505a2c 100644
--- a/Source/Ogda/Searchers/Seekers/prefabseeker.h
+++ b/Source/Ogda/Searchers/Seekers/prefabseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class PrefabSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
- void HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata ) override;
- inline const char* GetName() override
- {
+class PrefabSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
+ void HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) override;
+ inline const char* GetName() override {
return "prefab_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/seekerbase.h b/Source/Ogda/Searchers/Seekers/seekerbase.h
index 92b2a069..71bfd169 100644
--- a/Source/Ogda/Searchers/Seekers/seekerbase.h
+++ b/Source/Ogda/Searchers/Seekers/seekerbase.h
@@ -20,7 +20,7 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include <vector>
#include <Ogda/item.h>
@@ -28,9 +28,8 @@
class JobHandler;
class Item;
-class SeekerBase
-{
-public:
- virtual std::vector<Item> Search(const Item& item ) = 0;
+class SeekerBase {
+ public:
+ virtual std::vector<Item> Search(const Item& item) = 0;
virtual const char* GetName() = 0;
};
diff --git a/Source/Ogda/Searchers/Seekers/skeletonseeker.cpp b/Source/Ogda/Searchers/Seekers/skeletonseeker.cpp
index c94a3047..68481df6 100644
--- a/Source/Ogda/Searchers/Seekers/skeletonseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/skeletonseeker.cpp
@@ -29,40 +29,35 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-std::vector<Item> SkeletonSeeker::SearchXML( const Item & item, TiXmlDocument& doc )
-{
+std::vector<Item> SkeletonSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
std::vector<Item> items;
TiXmlHandle hRoot(&doc);
const char* roots[] =
- {
- "rig"
- };
-
- TiXmlElement *eRoot = hRoot.FirstChildElement().Element();
-
- if( !eRoot )
- {
+ {
+ "rig"};
+
+ TiXmlElement* eRoot = hRoot.FirstChildElement().Element();
+
+ if (!eRoot) {
LOGE << "Can't find anything in file listed " << item << std::endl;
}
- while( eRoot )
- {
- if( FindStringInArray( roots, ARRLEN(roots), eRoot->Value() ) < 0 )
- {
+ while (eRoot) {
+ if (FindStringInArray(roots, ARRLEN(roots), eRoot->Value()) < 0) {
LOGE << "Unknown root " << eRoot->Value() << std::endl;
}
std::vector<attribpair> attribs;
- attribs.push_back(attribpair("bone_path", "skeleton"));
+ attribs.push_back(attribpair("bone_path", "skeleton"));
attribs.push_back(attribpair("model_path", "model"));
- attribs.push_back(attribpair("mass_path", "skeleton"));
+ attribs.push_back(attribpair("mass_path", "skeleton"));
std::vector<const char*> attribs_ignore;
- AttributeScanner::Do( items, item, eRoot, attribs, attribs_ignore );
-
+ AttributeScanner::Do(items, item, eRoot, attribs, attribs_ignore);
+
eRoot = eRoot->NextSiblingElement();
}
return items;
diff --git a/Source/Ogda/Searchers/Seekers/skeletonseeker.h b/Source/Ogda/Searchers/Seekers/skeletonseeker.h
index 692a7e69..ae42f5e6 100644
--- a/Source/Ogda/Searchers/Seekers/skeletonseeker.h
+++ b/Source/Ogda/Searchers/Seekers/skeletonseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class SkeletonSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
+class SkeletonSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "skeleton_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/skylevelseeker.cpp b/Source/Ogda/Searchers/Seekers/skylevelseeker.cpp
index be43f4bd..a0e62d8f 100644
--- a/Source/Ogda/Searchers/Seekers/skylevelseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/skylevelseeker.cpp
@@ -26,18 +26,14 @@
#include <Logging/logdata.h>
-std::vector<Item> SkyLevelSeeker::SearchLevelRoot(const Item& item, TiXmlHandle& hRoot)
-{
+std::vector<Item> SkyLevelSeeker::SearchLevelRoot(const Item& item, TiXmlHandle& hRoot) {
std::vector<Item> items;
- TiXmlElement *eElem = hRoot.FirstChildElement("Sky").FirstChildElement("DomeTexture").Element();
+ TiXmlElement* eElem = hRoot.FirstChildElement("Sky").FirstChildElement("DomeTexture").Element();
- if( eElem && eElem->GetText() && strlen(eElem->GetText()) > 0 )
- {
+ if (eElem && eElem->GetText() && strlen(eElem->GetText()) > 0) {
items.push_back(Item(item.input_folder, eElem->GetText(), "texture", item.source));
- }
- else
- {
+ } else {
LOGW << "Level missing Sky DomeTexture " << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/skylevelseeker.h b/Source/Ogda/Searchers/Seekers/skylevelseeker.h
index ff33875c..482a3a17 100644
--- a/Source/Ogda/Searchers/Seekers/skylevelseeker.h
+++ b/Source/Ogda/Searchers/Seekers/skylevelseeker.h
@@ -26,13 +26,11 @@
class TiXmlElement;
-class SkyLevelSeeker : public LevelSeekerBase
-{
-public:
- std::vector<Item> SearchLevelRoot( const Item& item, TiXmlHandle& hRoot ) override;
+class SkyLevelSeeker : public LevelSeekerBase {
+ public:
+ std::vector<Item> SearchLevelRoot(const Item& item, TiXmlHandle& hRoot) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "sky_level_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/spawnerlistseeker.cpp b/Source/Ogda/Searchers/Seekers/spawnerlistseeker.cpp
index 936083d7..4e690b99 100644
--- a/Source/Ogda/Searchers/Seekers/spawnerlistseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/spawnerlistseeker.cpp
@@ -26,57 +26,42 @@
#include <Logging/logdata.h>
#include <string>
-std::vector<Item> SpawnerListSeeker::SearchJSON( const Item & item, Json::Value& root )
-{
+std::vector<Item> SpawnerListSeeker::SearchJSON(const Item& item, Json::Value& root) {
std::vector<Item> items;
Json::Value spawner_tab = root["spawner_tab"];
Json::Value ogda_type = root["ogda_type"];
Json::Value objects = root["objects"];
- if( spawner_tab.empty() )
- {
+ if (spawner_tab.empty()) {
LOGW << item << " is missing a spawner_tab value" << std::endl;
- }
+ }
- if( ogda_type.isString() )
- {
+ if (ogda_type.isString()) {
std::string type_string = ogda_type.asString();
- if( objects.isArray() )
- {
- for( int i = 0; i < objects.size(); i++ )
- {
+ if (objects.isArray()) {
+ for (int i = 0; i < objects.size(); i++) {
Json::Value json_item = objects[i];
- if( json_item.isArray() )
- {
+ if (json_item.isArray()) {
Json::Value path = json_item[1];
- if( path.isString() )
- {
- std::string path_string = path.asString();
- Item i = Item( item.input_folder, path_string, type_string, item.source );
+ if (path.isString()) {
+ std::string path_string = path.asString();
+ Item i = Item(item.input_folder, path_string, type_string, item.source);
items.push_back(i);
+ } else {
+ LOGE << "Unexpected path value on index " << i << " in " << item << std::endl;
}
- else
- {
- LOGE << "Unexpected path value on index " << i << " in " << item << std::endl;
- }
- }
- else
- {
- LOGE << "Unexpected item element on index " << i << " " << item << std::endl;
+ } else {
+ LOGE << "Unexpected item element on index " << i << " " << item << std::endl;
}
}
+ } else {
+ LOGE << "Malformed json file " << item << std::endl;
}
- else
- {
- LOGE << "Malformed json file " << item << std::endl;
- }
- }
- else
- {
+ } else {
LOGE << "Missing ogda_type value in " << item << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/spawnerlistseeker.h b/Source/Ogda/Searchers/Seekers/spawnerlistseeker.h
index c6ced6f7..a2ee004a 100644
--- a/Source/Ogda/Searchers/Seekers/spawnerlistseeker.h
+++ b/Source/Ogda/Searchers/Seekers/spawnerlistseeker.h
@@ -20,18 +20,16 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include "jsonseekerbase.h"
-namespace Json
-{
- class Value;
+namespace Json {
+class Value;
}
-class SpawnerListSeeker : public JSONSeekerBase
-{
-public:
- std::vector<Item> SearchJSON( const Item & item, Json::Value& root ) override;
+class SpawnerListSeeker : public JSONSeekerBase {
+ public:
+ std::vector<Item> SearchJSON(const Item& item, Json::Value& root) override;
const char* GetName() override { return "spawner_list_seeker"; }
};
diff --git a/Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.cpp b/Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.cpp
index b4d26ce5..b638d115 100644
--- a/Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.cpp
@@ -29,82 +29,61 @@
#include <Utility/strings.h>
#include <Logging/logdata.h>
-std::vector<Item> SyncedAnimationGroupSeeker::SearchXML(const Item & item, TiXmlDocument& doc )
-{
- const char* elems[] =
- {
- };
+std::vector<Item> SyncedAnimationGroupSeeker::SearchXML(const Item& item, TiXmlDocument& doc) {
+ const char* elems[] =
+ {};
const char* elems_type[] =
- {
- };
+ {};
assert(ARRLEN(elems_type) == ARRLEN(elems));
- const char* ignored[] =
- {
- "CoordLabel",
- "Overshoot",
- "InAir"
- };
+ const char* ignored[] =
+ {
+ "CoordLabel",
+ "Overshoot",
+ "InAir"};
std::vector<Item> items;
TiXmlHandle hRoot(&doc);
-
- TiXmlElement *eElem = hRoot.FirstChildElement("SyncedAnimationGroup").FirstChildElement().Element();
- if( !eElem )
- {
+ TiXmlElement* eElem = hRoot.FirstChildElement("SyncedAnimationGroup").FirstChildElement().Element();
+
+ if (!eElem) {
LOGE << "Can't find anything in file listed " << item << std::endl;
}
- while( eElem )
- {
+ while (eElem) {
const char* name = eElem->Value();
const char* text = eElem->GetText();
- if( name )
- {
+ if (name) {
int id;
- if( (id = FindStringInArray( elems, ARRLEN(elems), name )) >= 0 )
- {
- if( text && strlen(text) > 0 )
- {
- items.push_back(Item(item.input_folder,text,elems_type[id],item.source));
- }
- else
- {
+ if ((id = FindStringInArray(elems, ARRLEN(elems), name)) >= 0) {
+ if (text && strlen(text) > 0) {
+ items.push_back(Item(item.input_folder, text, elems_type[id], item.source));
+ } else {
LOGW << "String value in " << item << " for element " << elems[id] << " is empty" << std::endl;
}
- }
- else if( (id = FindStringInArray( ignored, ARRLEN(ignored), name )) >= 0 )
- {
+ } else if ((id = FindStringInArray(ignored, ARRLEN(ignored), name)) >= 0) {
LOGD << "Ignored " << ignored[id] << " in " << item << std::endl;
- }
- else if( strmtch( "Animations", name ) )
- {
- TiXmlElement *eDetailObject = eElem->FirstChildElement();
+ } else if (strmtch("Animations", name)) {
+ TiXmlElement* eDetailObject = eElem->FirstChildElement();
- while( eDetailObject )
- {
+ while (eDetailObject) {
{
const char* path = eDetailObject->Attribute("path");
- if( path )
- {
+ if (path) {
items.push_back(Item(item.input_folder, path, "animation", item.source));
}
}
eDetailObject = eDetailObject->NextSiblingElement();
}
- }
- else
- {
+ } else {
LOGE << "Unahandled subvalue in SyncedAnimationGroup from " << item << " called " << name << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Generic warning" << std::endl;
}
@@ -112,5 +91,4 @@ std::vector<Item> SyncedAnimationGroupSeeker::SearchXML(const Item & item, TiXml
}
return items;
-
}
diff --git a/Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.h b/Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.h
index b556e5df..ef700f17 100644
--- a/Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.h
+++ b/Source/Ogda/Searchers/Seekers/syncedanimationgroupseeker.h
@@ -27,13 +27,11 @@
class TiXmlDocument;
class JobHandler;
-class SyncedAnimationGroupSeeker : public XMLSeekerBase
-{
-public:
- std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) override;
+class SyncedAnimationGroupSeeker : public XMLSeekerBase {
+ public:
+ std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "synced_animation_group_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/terrainlevelseeker.cpp b/Source/Ogda/Searchers/Seekers/terrainlevelseeker.cpp
index 084e2a99..4bad0247 100644
--- a/Source/Ogda/Searchers/Seekers/terrainlevelseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/terrainlevelseeker.cpp
@@ -27,105 +27,81 @@
#include <tinyxml.h>
-std::vector<Item> TerrainLevelSeeker::SearchLevelRoot( const Item& item, TiXmlHandle& hRoot )
-{
+std::vector<Item> TerrainLevelSeeker::SearchLevelRoot(const Item& item, TiXmlHandle& hRoot) {
std::vector<Item> items;
const char* simpleTextures[] = {
"Heightmap",
"DetailMap",
"ColorMap",
"WeightMap",
- "ModelOverride"
- };
-
- const char* type[] =
- {
- "heightmap",
- "texture",
- "raw_texture",
- "texture",
- "model"
- };
-
- assert( ARRLEN(type) == ARRLEN(simpleTextures) );
-
- TiXmlElement *eTerrain = hRoot.FirstChildElement("Terrain").Element();
-
- if( eTerrain )
- {
- TiXmlElement *eElem = eTerrain->FirstChildElement();
-
- while( eElem )
+ "ModelOverride"};
+
+ const char* type[] =
{
+ "heightmap",
+ "texture",
+ "raw_texture",
+ "texture",
+ "model"};
+
+ assert(ARRLEN(type) == ARRLEN(simpleTextures));
+
+ TiXmlElement* eTerrain = hRoot.FirstChildElement("Terrain").Element();
+
+ if (eTerrain) {
+ TiXmlElement* eElem = eTerrain->FirstChildElement();
+
+ while (eElem) {
const char* name = eElem->Value();
int id;
- if( (id = FindStringInArray( simpleTextures, ARRLEN(simpleTextures), name )) >= 0 )
- {
+ if ((id = FindStringInArray(simpleTextures, ARRLEN(simpleTextures), name)) >= 0) {
const char* v = eElem->GetText();
- if(v != NULL && strlen(v) > 0)
- {
- items.push_back(Item(item.input_folder, v,type[id], item.source));
+ if (v != NULL && strlen(v) > 0) {
+ items.push_back(Item(item.input_folder, v, type[id], item.source));
}
- }
- else if( strmtch( name, "DetailMaps" ) )
- {
- TiXmlElement *eDetailMap = eElem->FirstChildElement();
+ } else if (strmtch(name, "DetailMaps")) {
+ TiXmlElement* eDetailMap = eElem->FirstChildElement();
- while( eDetailMap )
- {
+ while (eDetailMap) {
std::vector<attribpair> attribs;
- attribs.push_back(attribpair("colorpath", "texture"));
- attribs.push_back(attribpair("normalpath", "texture"));
- attribs.push_back(attribpair("materialpath","material"));
+ attribs.push_back(attribpair("colorpath", "texture"));
+ attribs.push_back(attribpair("normalpath", "texture"));
+ attribs.push_back(attribpair("materialpath", "material"));
std::vector<const char*> ignore;
- AttributeScanner::Do( items, item, eDetailMap, attribs, ignore );
+ AttributeScanner::Do(items, item, eDetailMap, attribs, ignore);
eDetailMap = eDetailMap->NextSiblingElement();
}
- }
- else if( strmtch( name, "DetailObjects" ) )
- {
- TiXmlElement *eDetailObject = eElem->FirstChildElement();
+ } else if (strmtch(name, "DetailObjects")) {
+ TiXmlElement* eDetailObject = eElem->FirstChildElement();
- while( eDetailObject )
- {
+ while (eDetailObject) {
//<DetailObject obj_path="Data/Objects/Plants/Groundcover/Grass/WildGrass.xml" weight_path="Data/Textures/Terrain/scrubby_hills/scrubby_hills_grass.png" normal_conform="0.5" density="7" min_embed="0" max_embed="0.4" min_scale="0.7" max_scale="2" view_distance="30" jitter_degrees="10" overbright="0" />
{
const char* obj_path = eDetailObject->Attribute("obj_path");
- if( obj_path && strlen( obj_path ) > 0 )
- {
- items.push_back(Item(item.input_folder,obj_path,"object",item.source));
- }
- else
- {
+ if (obj_path && strlen(obj_path) > 0) {
+ items.push_back(Item(item.input_folder, obj_path, "object", item.source));
+ } else {
LOGW << "Missing expected attribute obj_path." << std::endl;
}
}
-
- {
+
+ {
const char* weight_path = eDetailObject->Attribute("weight_path");
- if( weight_path && strlen( weight_path ) > 0 )
- {
- items.push_back(Item(item.input_folder,weight_path,"texture",item.source));
- }
- else
- {
+ if (weight_path && strlen(weight_path) > 0) {
+ items.push_back(Item(item.input_folder, weight_path, "texture", item.source));
+ } else {
LOGW << "Missing expected attribute weight_path." << std::endl;
}
}
- eDetailObject = eDetailObject->NextSiblingElement();
+ eDetailObject = eDetailObject->NextSiblingElement();
}
- }
- else if( strmtch( name, "ShaderExtra" ) )
- {
-
- }
- else
- {
+ } else if (strmtch(name, "ShaderExtra")) {
+ } else {
LOGW << "Missing subhandler for " << name << " in Terrain under level" << item << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/terrainlevelseeker.h b/Source/Ogda/Searchers/Seekers/terrainlevelseeker.h
index d026a28a..3900ed75 100644
--- a/Source/Ogda/Searchers/Seekers/terrainlevelseeker.h
+++ b/Source/Ogda/Searchers/Seekers/terrainlevelseeker.h
@@ -26,13 +26,11 @@
class TiXmlElement;
-class TerrainLevelSeeker : public LevelSeekerBase
-{
-public:
- std::vector<Item> SearchLevelRoot( const Item& item, TiXmlHandle& hRoot ) override;
+class TerrainLevelSeeker : public LevelSeekerBase {
+ public:
+ std::vector<Item> SearchLevelRoot(const Item& item, TiXmlHandle& hRoot) override;
- inline const char* GetName() override
- {
+ inline const char* GetName() override {
return "terrain_level_seeker";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/voidseeker.cpp b/Source/Ogda/Searchers/Seekers/voidseeker.cpp
index 9431ddd2..c887ad8d 100644
--- a/Source/Ogda/Searchers/Seekers/voidseeker.cpp
+++ b/Source/Ogda/Searchers/Seekers/voidseeker.cpp
@@ -25,7 +25,6 @@
#include <Logging/logdata.h>
#include <Ogda/item.h>
-std::vector<Item> VoidSeeker::Search( const Item& item )
-{
- return std::vector<Item>();
+std::vector<Item> VoidSeeker::Search(const Item& item) {
+ return std::vector<Item>();
}
diff --git a/Source/Ogda/Searchers/Seekers/voidseeker.h b/Source/Ogda/Searchers/Seekers/voidseeker.h
index a7d447bb..cea69ad9 100644
--- a/Source/Ogda/Searchers/Seekers/voidseeker.h
+++ b/Source/Ogda/Searchers/Seekers/voidseeker.h
@@ -20,19 +20,17 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include "seekerbase.h"
class TiXmlDocument;
class JobHandler;
-class VoidSeeker : public SeekerBase
-{
-public:
- std::vector<Item> Search( const Item& item ) override;
- inline const char* GetName() override
- {
+class VoidSeeker : public SeekerBase {
+ public:
+ std::vector<Item> Search(const Item& item) override;
+ inline const char* GetName() override {
return "void";
}
};
diff --git a/Source/Ogda/Searchers/Seekers/xmlseekerbase.cpp b/Source/Ogda/Searchers/Seekers/xmlseekerbase.cpp
index 60e2ddf1..48a5e13e 100644
--- a/Source/Ogda/Searchers/Seekers/xmlseekerbase.cpp
+++ b/Source/Ogda/Searchers/Seekers/xmlseekerbase.cpp
@@ -30,23 +30,18 @@
#include <tinyxml.h>
#include <XML/xml_helper.h>
-std::vector<Item> XMLSeekerBase::Search( const Item& item )
-{
+std::vector<Item> XMLSeekerBase::Search(const Item& item) {
std::string full_path = item.GetAbsPath();
TiXmlDocument doc(full_path.c_str());
doc.LoadFile();
- if( !doc.Error() )
- {
- return this->SearchXML(item,doc);
- }
- else
- {
+ if (!doc.Error()) {
+ return this->SearchXML(item, doc);
+ } else {
return std::vector<Item>();
}
}
-void XMLSeekerBase::HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata )
-{
+void XMLSeekerBase::HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata) {
LOGE << "Unimplemented HandleElementCallback for " << GetName() << " on " << item << std::endl;
}
diff --git a/Source/Ogda/Searchers/Seekers/xmlseekerbase.h b/Source/Ogda/Searchers/Seekers/xmlseekerbase.h
index a27504d0..c8f8cb30 100644
--- a/Source/Ogda/Searchers/Seekers/xmlseekerbase.h
+++ b/Source/Ogda/Searchers/Seekers/xmlseekerbase.h
@@ -20,7 +20,7 @@
// limitations under the License.
//
//-----------------------------------------------------------------------------
-#pragma once
+#pragma once
#include "seekerbase.h"
#include "SeekerTools/attributescanner.h"
@@ -31,11 +31,10 @@ class TiXmlNode;
class TiXmlDocument;
class JobHandler;
-class XMLSeekerBase : public SeekerBase
-{
-public:
- std::vector<Item> Search( const Item& item ) override;
- virtual std::vector<Item> SearchXML( const Item & item, TiXmlDocument& doc ) = 0;
+class XMLSeekerBase : public SeekerBase {
+ public:
+ std::vector<Item> Search(const Item& item) override;
+ virtual std::vector<Item> SearchXML(const Item& item, TiXmlDocument& doc) = 0;
- virtual void HandleElementCallback( std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata );
+ virtual void HandleElementCallback(std::vector<Item>& items, TiXmlNode* eRoot, TiXmlElement* eElem, const Item& item, void* userdata);
};
diff --git a/Source/Ogda/Searchers/searcher.cpp b/Source/Ogda/Searchers/searcher.cpp
index 551321a9..dde2f79e 100644
--- a/Source/Ogda/Searchers/searcher.cpp
+++ b/Source/Ogda/Searchers/searcher.cpp
@@ -30,68 +30,52 @@
#include <XML/xml_helper.h>
#include <Utility/strings.h>
-
-//Small convinence function so i don't write this block multiple times.
-void ai(JobHandler& j, const char* t, const char* type)
-{
- if(t)
- {
+// Small convinence function so i don't write this block multiple times.
+void ai(JobHandler& j, const char* t, const char* type) {
+ if (t) {
std::string ts(t);
- if( !ts.empty() )
- {
- //j.AddItem(ts,type);
+ if (!ts.empty()) {
+ // j.AddItem(ts,type);
return;
}
}
LOGW << "Skipping ItemTextureHandler as string value is nonexistant or empty" << std::endl;
}
-//Small convinence function so i don't write this block multiple times.
-void aie( JobHandler& j, TiXmlElement* e, const char* type )
-{
- if(e)
- {
+// Small convinence function so i don't write this block multiple times.
+void aie(JobHandler& j, TiXmlElement* e, const char* type) {
+ if (e) {
ai(j, e->GetText(), type);
}
}
-Searcher::Searcher( SeekerBase* seeker, const std::string& _path_ending, const std::string& type_pattern_re )
-: seeker(seeker), path_ending(_path_ending)
-{
- try
- {
- type_pattern->Compile(type_pattern_re.c_str());
- }
- catch( const TRexParseException& pe )
- {
+Searcher::Searcher(SeekerBase* seeker, const std::string& _path_ending, const std::string& type_pattern_re)
+ : seeker(seeker), path_ending(_path_ending) {
+ try {
+ type_pattern->Compile(type_pattern_re.c_str());
+ } catch (const TRexParseException& pe) {
LOGE << "Failed to compile the type_pattern regex " << type_pattern_re << " reason: " << pe.desc << std::endl;
}
}
-bool Searcher::IsMatch(const Item& t)
-{
- if( endswith(t.GetPath().c_str(), path_ending.c_str()) && type_pattern->Match(t.type.c_str()) )
+bool Searcher::IsMatch(const Item& t) {
+ if (endswith(t.GetPath().c_str(), path_ending.c_str()) && type_pattern->Match(t.type.c_str()))
return true;
else
return false;
}
-std::vector<Item> Searcher::TrySearch( JobHandler& jh, const Item& item, int* matchcounter )
-{
- if( IsMatch(item) )
- {
+std::vector<Item> Searcher::TrySearch(JobHandler& jh, const Item& item, int* matchcounter) {
+ if (IsMatch(item)) {
LOGD << "Running " << seeker->GetName() << " on " << item << std::endl;
(*matchcounter)++;
return seeker->Search(item);
- }
- else
- {
+ } else {
LOGD << "Skipping " << seeker->GetName() << " on " << item << ", doesn't match pattern." << std::endl;
return std::vector<Item>();
}
}
-std::string Searcher::GetSeekerName()
-{
- return std::string(seeker->GetName());
+std::string Searcher::GetSeekerName() {
+ return std::string(seeker->GetName());
}
diff --git a/Source/Ogda/Searchers/searcher.h b/Source/Ogda/Searchers/searcher.h
index 454a64b7..23ce5e63 100644
--- a/Source/Ogda/Searchers/searcher.h
+++ b/Source/Ogda/Searchers/searcher.h
@@ -34,16 +34,14 @@
class JobHandler;
class TiXmlElement;
-class Searcher
-{
-public:
-
- Searcher( SeekerBase* seeker, const std::string& path_ending, const std::string& type_pattern_re );
+class Searcher {
+ public:
+ Searcher(SeekerBase* seeker, const std::string& path_ending, const std::string& type_pattern_re);
bool IsMatch(const Item& t);
- std::vector<Item> TrySearch( JobHandler& jh, const Item& item, int* matchcounter );
+ std::vector<Item> TrySearch(JobHandler& jh, const Item& item, int* matchcounter);
std::string GetSeekerName();
-private:
+ private:
std::string path_ending;
ReferenceCounter<TRexpp> type_pattern;
ReferenceCounter<SeekerBase> seeker;
diff --git a/Source/Ogda/Searchers/searcherfactory.cpp b/Source/Ogda/Searchers/searcherfactory.cpp
index 38c25ccb..f1b68eac 100644
--- a/Source/Ogda/Searchers/searcherfactory.cpp
+++ b/Source/Ogda/Searchers/searcherfactory.cpp
@@ -50,70 +50,61 @@
#include "Seekers/objhullseeker.h"
#include "Seekers/levelnormseeker.h"
-SearcherFactory::SearcherFactory()
-{
- seekers.push_back( new SeekerFactory<VoidSeeker>() );
- seekers.push_back( new SeekerFactory<ActorObjectLevelSeeker>() );
- seekers.push_back( new SeekerFactory<TerrainLevelSeeker>() );
- seekers.push_back( new SeekerFactory<DecalSeeker>() );
- seekers.push_back( new SeekerFactory<SkyLevelSeeker>() );
- seekers.push_back( new SeekerFactory<AmbientSoundLevelSeeker>() );
- seekers.push_back( new SeekerFactory<HotspotSeeker>() );
- seekers.push_back( new SeekerFactory<ObjectSeeker>() );
- seekers.push_back( new SeekerFactory<SyncedAnimationGroupSeeker>() );
- seekers.push_back( new SeekerFactory<AttackSeeker>() );
- seekers.push_back( new SeekerFactory<CharacterSeeker>() );
- seekers.push_back( new SeekerFactory<ActorSeeker>() );
- seekers.push_back( new SeekerFactory<SkeletonSeeker>() );
- seekers.push_back( new SeekerFactory<AnimationRetargetSeeker>() );
- seekers.push_back( new SeekerFactory<ItemSeeker>() );
- seekers.push_back( new SeekerFactory<MaterialSeeker>() );
- seekers.push_back( new SeekerFactory<ParticleSeeker>() );
- seekers.push_back( new SeekerFactory<PrefabSeeker>() );
- seekers.push_back( new SeekerFactory<SpawnerListSeeker>() );
- seekers.push_back( new SeekerFactory<PreConvertedDDSSeeker>() );
- seekers.push_back( new SeekerFactory<ObjColSeeker>() );
- seekers.push_back( new SeekerFactory<ObjHullSeeker>() );
- seekers.push_back( new SeekerFactory<LevelNormSeeker>() );
+SearcherFactory::SearcherFactory() {
+ seekers.push_back(new SeekerFactory<VoidSeeker>());
+ seekers.push_back(new SeekerFactory<ActorObjectLevelSeeker>());
+ seekers.push_back(new SeekerFactory<TerrainLevelSeeker>());
+ seekers.push_back(new SeekerFactory<DecalSeeker>());
+ seekers.push_back(new SeekerFactory<SkyLevelSeeker>());
+ seekers.push_back(new SeekerFactory<AmbientSoundLevelSeeker>());
+ seekers.push_back(new SeekerFactory<HotspotSeeker>());
+ seekers.push_back(new SeekerFactory<ObjectSeeker>());
+ seekers.push_back(new SeekerFactory<SyncedAnimationGroupSeeker>());
+ seekers.push_back(new SeekerFactory<AttackSeeker>());
+ seekers.push_back(new SeekerFactory<CharacterSeeker>());
+ seekers.push_back(new SeekerFactory<ActorSeeker>());
+ seekers.push_back(new SeekerFactory<SkeletonSeeker>());
+ seekers.push_back(new SeekerFactory<AnimationRetargetSeeker>());
+ seekers.push_back(new SeekerFactory<ItemSeeker>());
+ seekers.push_back(new SeekerFactory<MaterialSeeker>());
+ seekers.push_back(new SeekerFactory<ParticleSeeker>());
+ seekers.push_back(new SeekerFactory<PrefabSeeker>());
+ seekers.push_back(new SeekerFactory<SpawnerListSeeker>());
+ seekers.push_back(new SeekerFactory<PreConvertedDDSSeeker>());
+ seekers.push_back(new SeekerFactory<ObjColSeeker>());
+ seekers.push_back(new SeekerFactory<ObjHullSeeker>());
+ seekers.push_back(new SeekerFactory<LevelNormSeeker>());
}
-SearcherFactory::~SearcherFactory()
-{
+SearcherFactory::~SearcherFactory() {
std::vector<SeekerFactoryBase*>::iterator factoryit;
- for( factoryit = seekers.begin(); factoryit != seekers.end(); factoryit++ )
- {
+ for (factoryit = seekers.begin(); factoryit != seekers.end(); factoryit++) {
delete *factoryit;
}
seekers.clear();
}
-bool SearcherFactory::HasSearcher( const std::string& searcher )
-{
+bool SearcherFactory::HasSearcher(const std::string& searcher) {
std::vector<SeekerFactoryBase*>::iterator factoryit;
- for( factoryit = seekers.begin(); factoryit != seekers.end(); factoryit++ )
- {
- if( (*factoryit)->GetSeekerName() == searcher )
- {
+ for (factoryit = seekers.begin(); factoryit != seekers.end(); factoryit++) {
+ if ((*factoryit)->GetSeekerName() == searcher) {
return true;
}
}
return false;
}
-Searcher SearcherFactory::CreateSearcher( const std::string& searcher, const std::string& path_ending, const std::string& type_pattern_re )
-{
+Searcher SearcherFactory::CreateSearcher(const std::string& searcher, const std::string& path_ending, const std::string& type_pattern_re) {
std::vector<SeekerFactoryBase*>::iterator factoryit;
- for( factoryit = seekers.begin(); factoryit != seekers.end(); factoryit++ )
- {
- if( (*factoryit)->GetSeekerName() == searcher )
- {
+ for (factoryit = seekers.begin(); factoryit != seekers.end(); factoryit++) {
+ if ((*factoryit)->GetSeekerName() == searcher) {
return Searcher((*factoryit)->NewInstance(), path_ending, type_pattern_re);
}
}
LOGE << "Unable to find searcher matching name " << searcher << std::endl;
- return Searcher( new VoidSeeker(), path_ending, type_pattern_re );
+ return Searcher(new VoidSeeker(), path_ending, type_pattern_re);
}
diff --git a/Source/Ogda/Searchers/searcherfactory.h b/Source/Ogda/Searchers/searcherfactory.h
index ec7bedd6..e0945991 100644
--- a/Source/Ogda/Searchers/searcherfactory.h
+++ b/Source/Ogda/Searchers/searcherfactory.h
@@ -24,34 +24,30 @@
#include "searcher.h"
#include <vector>
-class SearcherFactory
-{
-private:
- class SeekerFactoryBase
- {
- public:
+class SearcherFactory {
+ private:
+ class SeekerFactoryBase {
+ public:
virtual SeekerBase* NewInstance() = 0;
virtual std::string GetSeekerName() = 0;
};
- template<class Seeker>
- class SeekerFactory : public SeekerFactoryBase
- {
- SeekerBase* NewInstance() override
- {
+ template <class Seeker>
+ class SeekerFactory : public SeekerFactoryBase {
+ SeekerBase* NewInstance() override {
return new Seeker();
}
- std::string GetSeekerName() override
- {
+ std::string GetSeekerName() override {
return std::string(Seeker().GetName());
}
};
std::vector<SeekerFactoryBase*> seekers;
-public:
+
+ public:
SearcherFactory();
~SearcherFactory();
- bool HasSearcher( const std::string& searcher );
- Searcher CreateSearcher( const std::string& searcher, const std::string& path_ending, const std::string& type_pattern_re );
+ bool HasSearcher(const std::string& searcher);
+ Searcher CreateSearcher(const std::string& searcher, const std::string& path_ending, const std::string& type_pattern_re);
};
diff --git a/Source/Ogda/database_manifest.cpp b/Source/Ogda/database_manifest.cpp
index 5da9d06f..a015fe70 100644
--- a/Source/Ogda/database_manifest.cpp
+++ b/Source/Ogda/database_manifest.cpp
@@ -33,212 +33,178 @@
#include "jobhandler.h"
-DatabaseManifest::DatabaseManifest()
-{
+DatabaseManifest::DatabaseManifest() {
}
-bool DatabaseManifest::Load(const std::string& manifest)
-{
+bool DatabaseManifest::Load(const std::string& manifest) {
results.clear();
CommonRegex cr;
- TiXmlDocument doc( manifest.c_str() );
+ TiXmlDocument doc(manifest.c_str());
doc.LoadFile();
- if( !doc.Error() )
- {
+ if (!doc.Error()) {
TiXmlElement* pRoot = doc.RootElement();
- if( pRoot )
- {
+ if (pRoot) {
TiXmlHandle hRoot(pRoot);
TiXmlNode* nResult = hRoot.FirstChild().ToNode();
- while( nResult )
- {
+ while (nResult) {
TiXmlElement* eResult = nResult->ToElement();
-
- if( eResult )
- {
- if( strcmp(eResult->Value(), "DatabaseResult") == 0 )
- {
-
- const char* dest = eResult->Attribute("dest");
- const char* dest_hash = eResult->Attribute("dest_hash");
- const char* builder = eResult->Attribute("builder");
- const char* builder_version = eResult->Attribute("builder_version");
- const char* type = eResult->Attribute("type");
+
+ if (eResult) {
+ if (strcmp(eResult->Value(), "DatabaseResult") == 0) {
+ const char* dest = eResult->Attribute("dest");
+ const char* dest_hash = eResult->Attribute("dest_hash");
+ const char* builder = eResult->Attribute("builder");
+ const char* builder_version = eResult->Attribute("builder_version");
+ const char* type = eResult->Attribute("type");
std::string dest_s;
- if( dest )
- dest_s = std::string( dest );
+ if (dest)
+ dest_s = std::string(dest);
std::string dest_hash_s;
- if( dest_hash )
- dest_hash_s = std::string( dest_hash );
+ if (dest_hash)
+ dest_hash_s = std::string(dest_hash);
std::string builder_s;
- if( builder )
- builder_s = std::string( builder );
+ if (builder)
+ builder_s = std::string(builder);
std::string builder_version_s;
- if( builder_version )
+ if (builder_version)
builder_version_s = std::string(builder_version);
std::string type_s;
- if( type )
+ if (type)
type_s = std::string(type);
TiXmlElement* eItem = nResult->FirstChild("Item")->ToElement();
-
- if( eItem )
- {
+
+ if (eItem) {
const char* item_path = eItem->Attribute("path");
const char* item_type = eItem->Attribute("type");
const char* item_hash = eItem->Attribute("hash");
std::string item_path_s;
- if( item_path )
- item_path_s = std::string( item_path );
+ if (item_path)
+ item_path_s = std::string(item_path);
std::string item_type_s;
- if( item_type )
- item_type_s = std::string( item_type );
+ if (item_type)
+ item_type_s = std::string(item_type);
std::string item_hash_s;
- if( item_hash )
- item_hash_s = std::string( item_hash );
-
+ if (item_hash)
+ item_hash_s = std::string(item_hash);
eItem = eItem->NextSiblingElement("Item");
-
- results.push_back( DatabaseManifestResult( Item("", item_path_s, item_type_s, item_hash_s, JobXMLParser::Item()), dest_hash_s, dest_s, builder_s, builder_version_s, type_s ) );
+ results.push_back(DatabaseManifestResult(Item("", item_path_s, item_type_s, item_hash_s, JobXMLParser::Item()), dest_hash_s, dest_s, builder_s, builder_version_s, type_s));
} else {
LOGE << "Missing item for DatabaseManifestResult" << std::endl;
}
- }
- else
- {
+ } else {
LOGE << "Unknown element name: " << eResult->Value() << std::endl;
}
+ } else {
+ LOGE << "Malformed element in manifest" << std::endl;
}
- else
- {
- LOGE << "Malformed element in manifest" << std::endl;
- }
-
- nResult = nResult->NextSibling();
+
+ nResult = nResult->NextSibling();
}
- }
- else
- {
+ } else {
LOGE << "Problem loading manifest file" << manifest << std::endl;
return false;
}
- }
- else
- {
+ } else {
LOGE << "Error parsing manifest file: \"" << doc.ErrorDesc() << "\"" << std::endl;
return false;
}
std::vector<DatabaseManifestResult>::const_iterator mrit;
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
hash_set.insert(mrit->item.GetSubHash());
}
return true;
}
-bool DatabaseManifest::Save(const std::string& manifest)
-{
+bool DatabaseManifest::Save(const std::string& manifest) {
TiXmlDocument doc;
- TiXmlDeclaration * decl = new TiXmlDeclaration( "2.0", "", "" );
- TiXmlElement * root = new TiXmlElement( "DatabaseManifest" );
+ TiXmlDeclaration* decl = new TiXmlDeclaration("2.0", "", "");
+ TiXmlElement* root = new TiXmlElement("DatabaseManifest");
root->SetAttribute("version", "1");
std::vector<DatabaseManifestResult>::const_iterator mrit;
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
- TiXmlElement* eResult = new TiXmlElement( "DatabaseResult" );
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
+ TiXmlElement* eResult = new TiXmlElement("DatabaseResult");
+
+ TiXmlElement* eItem = new TiXmlElement("Item");
- TiXmlElement* eItem = new TiXmlElement( "Item" );
+ eItem->SetAttribute("path", mrit->item.GetPath().c_str());
+ eItem->SetAttribute("type", mrit->item.type.c_str());
+ eItem->SetAttribute("hash", mrit->item.hash.c_str());
- eItem->SetAttribute( "path", mrit->item.GetPath().c_str() );
- eItem->SetAttribute( "type", mrit->item.type.c_str() );
- eItem->SetAttribute( "hash", mrit->item.hash.c_str() );
+ eResult->LinkEndChild(eItem);
- eResult->LinkEndChild( eItem );
-
- eResult->SetAttribute( "dest", mrit->dest.c_str() );
- eResult->SetAttribute( "dest_hash", mrit->dest_hash.c_str() );
- eResult->SetAttribute( "builder", mrit->name.c_str() );
- eResult->SetAttribute( "builder_version", mrit->version.c_str() );
- eResult->SetAttribute( "type", mrit->type.c_str() );
+ eResult->SetAttribute("dest", mrit->dest.c_str());
+ eResult->SetAttribute("dest_hash", mrit->dest_hash.c_str());
+ eResult->SetAttribute("builder", mrit->name.c_str());
+ eResult->SetAttribute("builder_version", mrit->version.c_str());
+ eResult->SetAttribute("type", mrit->type.c_str());
- root->LinkEndChild( eResult );
+ root->LinkEndChild(eResult);
}
- doc.LinkEndChild( decl );
- doc.LinkEndChild( root );
- doc.SaveFile( manifest.c_str() );
+ doc.LinkEndChild(decl);
+ doc.LinkEndChild(root);
+ doc.SaveFile(manifest.c_str());
return !doc.Error();
}
-void DatabaseManifest::AddResult( const DatabaseManifestResult& a ) {
+void DatabaseManifest::AddResult(const DatabaseManifestResult& a) {
results.push_back(a);
hash_set.insert(a.item.GetSubHash());
}
-bool DatabaseManifest::HasBuiltResultFor( JobHandler& jh, const Item& item, const Builder& builder )
-{
+bool DatabaseManifest::HasBuiltResultFor(JobHandler& jh, const Item& item, const Builder& builder) {
std::vector<DatabaseManifestResult>::iterator mrit;
- if( hash_set.find(item.GetSubHash()) != hash_set.end() )
- {
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
- if( mrit->item == item )
- {
- //Check that it's the same builder, one builder, one type of possible output file
- if( mrit->name == builder.GetBuilderName() )
- {
- //Check the builder version, to verify that the expected output wouldn't change.
- if( mrit->version == builder.GetBuilderVersion() )
- {
- //Check if the claimed destination file from the manifest differs from the file on disk according to hash
- //and that the hash isn't invalid
- if( mrit->GetCurrentDestHash(jh.databasedir) == mrit->dest_hash && mrit->dest_hash != std::string("") )
- {
+ if (hash_set.find(item.GetSubHash()) != hash_set.end()) {
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
+ if (mrit->item == item) {
+ // Check that it's the same builder, one builder, one type of possible output file
+ if (mrit->name == builder.GetBuilderName()) {
+ // Check the builder version, to verify that the expected output wouldn't change.
+ if (mrit->version == builder.GetBuilderVersion()) {
+ // Check if the claimed destination file from the manifest differs from the file on disk according to hash
+ // and that the hash isn't invalid
+ if (mrit->GetCurrentDestHash(jh.databasedir) == mrit->dest_hash && mrit->dest_hash != std::string("")) {
return true;
}
}
- }
- }
+ }
+ }
}
}
return false;
}
-DatabaseManifestResult DatabaseManifest::GetPreviouslyBuiltResult(const Item& item, const Builder& builder)
-{
+DatabaseManifestResult DatabaseManifest::GetPreviouslyBuiltResult(const Item& item, const Builder& builder) {
std::vector<DatabaseManifestResult>::const_iterator mrit;
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
- //First, check that it's the same item.
- //This "magically" includes the hash as item contains the hash value
- if( mrit->item == item )
- {
- //Check that it's the same builder, one builder, one type of possible output file
- if( mrit->name == builder.GetBuilderName() )
- {
- //This is mostly for sanity, but should never really evaluate to false as we already found the right builder and there is only one per name.
- //If this was false, that would mean we have changed the version of the builder and the asset we're looking for is actually outdated.
- //Meaning that previous checks and evalutation should have lead us to the conclusion to rebuild this item.
- if( mrit->version == builder.GetBuilderVersion() )
- {
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
+ // First, check that it's the same item.
+ // This "magically" includes the hash as item contains the hash value
+ if (mrit->item == item) {
+ // Check that it's the same builder, one builder, one type of possible output file
+ if (mrit->name == builder.GetBuilderName()) {
+ // This is mostly for sanity, but should never really evaluate to false as we already found the right builder and there is only one per name.
+ // If this was false, that would mean we have changed the version of the builder and the asset we're looking for is actually outdated.
+ // Meaning that previous checks and evalutation should have lead us to the conclusion to rebuild this item.
+ if (mrit->version == builder.GetBuilderVersion()) {
return *mrit;
}
- }
- }
+ }
+ }
}
throw "Big error";
}
diff --git a/Source/Ogda/database_manifest.h b/Source/Ogda/database_manifest.h
index bc24f788..47743473 100644
--- a/Source/Ogda/database_manifest.h
+++ b/Source/Ogda/database_manifest.h
@@ -30,19 +30,19 @@ class JobHandler;
class Builder;
class Item;
-class DatabaseManifest
-{
+class DatabaseManifest {
int thread;
std::vector<DatabaseManifestResult> results;
std::set<uint64_t> hash_set;
-public:
+
+ public:
DatabaseManifest();
bool Load(const std::string& manifest);
bool Save(const std::string& manifest);
- void AddResult( const DatabaseManifestResult& results );
+ void AddResult(const DatabaseManifestResult& results);
- bool HasBuiltResultFor( JobHandler& jh, const Item& item, const Builder& builder );
- DatabaseManifestResult GetPreviouslyBuiltResult( const Item& item, const Builder& builder);
+ bool HasBuiltResultFor(JobHandler& jh, const Item& item, const Builder& builder);
+ DatabaseManifestResult GetPreviouslyBuiltResult(const Item& item, const Builder& builder);
};
diff --git a/Source/Ogda/databasemanifestresult.cpp b/Source/Ogda/databasemanifestresult.cpp
index c965f708..186b1b21 100644
--- a/Source/Ogda/databasemanifestresult.cpp
+++ b/Source/Ogda/databasemanifestresult.cpp
@@ -30,19 +30,16 @@
#include <Ogda/Generators/creatorbase.h>
#include <Ogda/ogda_hash.h>
-DatabaseManifestResult::DatabaseManifestResult( const Item& item, const std::string& dest_hash, const std::string& dest, const std::string& name, const std::string& version, const std::string& type )
-: item(item), dest(dest), dest_hash(dest_hash), name(name), version(version), type(type)
-{
+DatabaseManifestResult::DatabaseManifestResult(const Item& item, const std::string& dest_hash, const std::string& dest, const std::string& name, const std::string& version, const std::string& type)
+ : item(item), dest(dest), dest_hash(dest_hash), name(name), version(version), type(type) {
}
-void DatabaseManifestResult::CalculateHash(const char* base_path)
-{
- current_dest_hash = GetFileHash(AssemblePath(base_path, AssemblePath("files",AssemblePath(item.hash,dest_hash))).c_str()).ToString();
+void DatabaseManifestResult::CalculateHash(const char* base_path) {
+ current_dest_hash = GetFileHash(AssemblePath(base_path, AssemblePath("files", AssemblePath(item.hash, dest_hash))).c_str()).ToString();
}
-const std::string& DatabaseManifestResult::GetCurrentDestHash(const std::string& base_path)
-{
- if( current_dest_hash.empty() )
+const std::string& DatabaseManifestResult::GetCurrentDestHash(const std::string& base_path) {
+ if (current_dest_hash.empty())
CalculateHash(base_path.c_str());
return current_dest_hash;
}
diff --git a/Source/Ogda/databasemanifestresult.h b/Source/Ogda/databasemanifestresult.h
index 51c1cdee..bde7a889 100644
--- a/Source/Ogda/databasemanifestresult.h
+++ b/Source/Ogda/databasemanifestresult.h
@@ -29,13 +29,12 @@ class ActionBase;
class CreatorBase;
class JobHandler;
-class DatabaseManifestResult
-{
-private:
+class DatabaseManifestResult {
+ private:
std::string current_dest_hash;
-public:
- DatabaseManifestResult( const Item& item, const std::string& dest_hash, const std::string& dest, const std::string& name, const std::string& version, const std::string& type );
+ public:
+ DatabaseManifestResult(const Item& item, const std::string& dest_hash, const std::string& dest, const std::string& name, const std::string& version, const std::string& type);
void CalculateHash(const char* base_path);
const std::string& GetCurrentDestHash(const std::string& base_path);
@@ -43,11 +42,11 @@ public:
std::string dest;
std::string dest_hash;
- std::string name; //Either creator or action
- std::string version; //Either creator or action
+ std::string name; // Either creator or action
+ std::string version; // Either creator or action
std::string type;
- //Only in built data does this come in as relevant.
- //And even then, we don't have support for more than one source at this time.
+ // Only in built data does this come in as relevant.
+ // And even then, we don't have support for more than one source at this time.
Item item;
};
diff --git a/Source/Ogda/filterbase.h b/Source/Ogda/filterbase.h
index 43ef2efd..075530ae 100644
--- a/Source/Ogda/filterbase.h
+++ b/Source/Ogda/filterbase.h
@@ -22,6 +22,5 @@
//-----------------------------------------------------------------------------
#pragma once
-class FilterBase
-{
+class FilterBase {
};
diff --git a/Source/Ogda/item.cpp b/Source/Ogda/item.cpp
index 9742b829..4f6b52e8 100644
--- a/Source/Ogda/item.cpp
+++ b/Source/Ogda/item.cpp
@@ -30,214 +30,158 @@
#include <Internal/datemodified.h>
#include <Ogda/ogda_hash.h>
-Item::Item( const std::string& input_folder, const std::string& path, const std::string& type, const JobXMLParser::Item& source ) :
- input_folder(input_folder),
- type(type),
- hash(""),
- source(source),
- only_parse(false),
- delete_on_exit(false),
- is_overshadowed(false)
-{
+Item::Item(const std::string& input_folder, const std::string& path, const std::string& type, const JobXMLParser::Item& source) : input_folder(input_folder),
+ type(type),
+ hash(""),
+ source(source),
+ only_parse(false),
+ delete_on_exit(false),
+ is_overshadowed(false) {
SetPath(path);
}
-Item::Item( const std::string& input_folder, const std::string& path, const std::string& type, const std::string& hash, const JobXMLParser::Item& source ) :
- input_folder(input_folder),
- type(type),
- hash(hash),
- source(source),
- only_parse(false),
- delete_on_exit(false),
- is_overshadowed(false)
-{
+Item::Item(const std::string& input_folder, const std::string& path, const std::string& type, const std::string& hash, const JobXMLParser::Item& source) : input_folder(input_folder),
+ type(type),
+ hash(hash),
+ source(source),
+ only_parse(false),
+ delete_on_exit(false),
+ is_overshadowed(false) {
SetPath(path);
}
-
-void Item::SetPath( std::string path )
-{
- //This is a bit of a hack, to look for Data, but it's almost part of the standard by now.
- if( path.substr(0,5) == std::string("Data/") )
- {
- this->path = path.substr(5);
- }
- else if( path.substr(0,5) == std::string("Data\\") )
- {
- this->path = path.substr(5);
- }
- else if( path.substr(0,5) == std::string("data\\") )
- {
- this->path = path.substr(5);
- }
- else if( path.substr(0,5) == std::string("data/") )
- {
- this->path = path.substr(5);
- }
- else
- {
+
+void Item::SetPath(std::string path) {
+ // This is a bit of a hack, to look for Data, but it's almost part of the standard by now.
+ if (path.substr(0, 5) == std::string("Data/")) {
+ this->path = path.substr(5);
+ } else if (path.substr(0, 5) == std::string("Data\\")) {
+ this->path = path.substr(5);
+ } else if (path.substr(0, 5) == std::string("data\\")) {
+ this->path = path.substr(5);
+ } else if (path.substr(0, 5) == std::string("data/")) {
+ this->path = path.substr(5);
+ } else {
this->path = path;
}
}
-bool Item::operator==(const JobXMLParser::Item& rhs) const
-{
+bool Item::operator==(const JobXMLParser::Item& rhs) const {
return this->type == rhs.type && this->path == rhs.path;
}
-bool Item::operator==(const Item& rhs) const
-{
- return this->hash == rhs.hash && this->path == rhs.path && this->type == rhs.type && this->only_parse == rhs.only_parse;
+bool Item::operator==(const Item& rhs) const {
+ return this->hash == rhs.hash && this->path == rhs.path && this->type == rhs.type && this->only_parse == rhs.only_parse;
}
-bool Item::operator<(const Item& rhs) const
-{
- if( hash < rhs.hash )
- {
+bool Item::operator<(const Item& rhs) const {
+ if (hash < rhs.hash) {
return true;
- }
- else if( hash == rhs.hash )
- {
- if( path < rhs.path )
- {
+ } else if (hash == rhs.hash) {
+ if (path < rhs.path) {
return true;
- }
- else if( path == rhs.path )
- {
- if( type < rhs.type )
- {
+ } else if (path == rhs.path) {
+ if (type < rhs.type) {
return true;
- }
- else if( type == rhs.type )
- {
- if( only_parse < rhs.only_parse )
- {
+ } else if (type == rhs.type) {
+ if (only_parse < rhs.only_parse) {
return true;
- }
- else if( only_parse == rhs.only_parse )
- {
+ } else if (only_parse == rhs.only_parse) {
return false;
- }
- else
- {
+ } else {
return false;
}
- }
- else
- {
+ } else {
return false;
}
- }
- else
- {
+ } else {
return false;
}
- }
- else
- {
+ } else {
return false;
}
}
-bool Item::FileAccess( )
-{
+bool Item::FileAccess() {
std::string fullpath = GetAbsPath();
return CheckFileAccess(fullpath.c_str());
}
-void Item::CalculateHash()
-{
+void Item::CalculateHash() {
hash = OgdaGetFileHash(GetAbsPath());
}
-std::string Item::GetPath() const
-{
+std::string Item::GetPath() const {
return path;
}
-void Item::VerifyPath()
-{
+void Item::VerifyPath() {
std::string assembled = GetAbsPath();
- if(!CheckFileAccess(assembled.c_str()))
- {
+ if (!CheckFileAccess(assembled.c_str())) {
std::string new_path = CaseCorrect(assembled);
SetPath(new_path.substr(input_folder.size()));
LOGD << "Case Corrected path to " << path << std::endl;
std::string assembled = GetAbsPath();
- if( !CheckFileAccess(assembled.c_str()) )
- {
+ if (!CheckFileAccess(assembled.c_str())) {
LOGE << "File still missing after case correction: " << assembled << std::endl;
}
}
}
-std::string Item::GetAbsPath() const
-{
- if( path[0] == '/' ) //Don't have to correct abs paths because they refer to a generated file.
+std::string Item::GetAbsPath() const {
+ if (path[0] == '/') // Don't have to correct abs paths because they refer to a generated file.
{
return path;
- }
- else
- {
+ } else {
return AssemblePath(input_folder, path);
}
}
-bool Item::IsOnlySearch()
-{
+bool Item::IsOnlySearch() {
return only_parse;
}
-void Item::SetOnlySearch(bool value)
-{
+void Item::SetOnlySearch(bool value) {
only_parse = value;
}
-bool Item::IsOvershadowed()
-{
+bool Item::IsOvershadowed() {
return is_overshadowed;
}
-void Item::SetOvershadowed(bool value)
-{
+void Item::SetOvershadowed(bool value) {
is_overshadowed = value;
}
-bool Item::Overshadows( const Item& item )
-{
- if( false == overshadows.empty() && overshadows == item.GetPath() )
- {
+bool Item::Overshadows(const Item& item) {
+ if (false == overshadows.empty() && overshadows == item.GetPath()) {
return true;
}
return false;
}
-void Item::SetOvershadows( const Item& item )
-{
+void Item::SetOvershadows(const Item& item) {
overshadows = item.GetPath();
}
-void Item::SetDeleteOnExit(bool value)
-{
+void Item::SetDeleteOnExit(bool value) {
delete_on_exit = value;
}
-bool Item::IsDeleteOnExit()
-{
+bool Item::IsDeleteOnExit() {
return delete_on_exit;
}
-std::ostream& operator<<(std::ostream& out, const Item& item)
-{
+std::ostream& operator<<(std::ostream& out, const Item& item) {
return (out << "Item(" << item.path << "," << item.type << "," << item.hash << "," << item.only_parse << "," << item.source << ")");
}
-uint64_t Item::GetSubHash() const{
+uint64_t Item::GetSubHash() const {
char val[8];
- if( hash.size() > 16 ) {
- for( int i = 0; i < 8; i++ ) {
- val[i] = hash[i*2] * 16 + hash[i*2+1];
+ if (hash.size() > 16) {
+ for (int i = 0; i < 8; i++) {
+ val[i] = hash[i * 2] * 16 + hash[i * 2 + 1];
}
} else {
LOGW << "Original hash is too small or nonexistant. " << *this << std::endl;
diff --git a/Source/Ogda/item.h b/Source/Ogda/item.h
index 97d184f3..8b90b1e4 100644
--- a/Source/Ogda/item.h
+++ b/Source/Ogda/item.h
@@ -27,26 +27,26 @@
class JobHandler;
-class Item
-{
-public:
+class Item {
+ public:
bool only_parse;
bool delete_on_exit;
bool is_overshadowed;
-private:
- void SetPath( std::string path );
+ private:
+ void SetPath(std::string path);
std::string overshadows;
-public:
- //Which of the input folders the item was found in
+
+ public:
+ // Which of the input folders the item was found in
std::string input_folder;
- //Relative path beneath the Data/ path
+ // Relative path beneath the Data/ path
std::string path;
std::string type;
std::string hash;
-
- //Original root source to this items existance, could be from a hierarchy of adds.
+
+ // Original root source to this items existance, could be from a hierarchy of adds.
JobXMLParser::Item source;
Item(const std::string& input_folder, const std::string& path, const std::string& type, const JobXMLParser::Item& source);
@@ -56,30 +56,30 @@ public:
bool operator==(const Item& rhs) const;
bool operator<(const Item& rhs) const;
- //Faster way of checking if the file is valid in case hash isn't calculated.
+ // Faster way of checking if the file is valid in case hash isn't calculated.
bool FileAccess();
void CalculateHash();
void VerifyPath();
std::string GetPath() const;
std::string GetAbsPath() const;
- //Remove file when program shuts down
+ // Remove file when program shuts down
bool IsDeleteOnExit();
- void SetDeleteOnExit(bool value);
- //Used for inlined scripts in XML files that are stored to a temp place on disk.
+ void SetDeleteOnExit(bool value);
+ // Used for inlined scripts in XML files that are stored to a temp place on disk.
bool IsOnlySearch();
void SetOnlySearch(bool value);
bool IsOvershadowed();
void SetOvershadowed(bool value);
- bool Overshadows( const Item& item );
- void SetOvershadows( const Item& item );
+ bool Overshadows(const Item& item);
+ void SetOvershadows(const Item& item);
- friend std::ostream& operator<<(std::ostream& out, const Item& item);
+ friend std::ostream& operator<<(std::ostream& out, const Item& item);
- //Extract a hash based on the first part. this is endian sensitive, so it shouldn't be stored, only used in runtime for first order identification.
+ // Extract a hash based on the first part. this is endian sensitive, so it shouldn't be stored, only used in runtime for first order identification.
uint64_t GetSubHash() const;
};
-std::ostream& operator<<(std::ostream& out, const Item& item);
+std::ostream& operator<<(std::ostream& out, const Item& item);
diff --git a/Source/Ogda/jobhandler.cpp b/Source/Ogda/jobhandler.cpp
index fa78b728..466bcf77 100644
--- a/Source/Ogda/jobhandler.cpp
+++ b/Source/Ogda/jobhandler.cpp
@@ -41,45 +41,37 @@
#include "main.h"
#include <Utility/strings.h>
-JobHandler::JobHandler(std::string output_folder, std::string manifest_dest, std::string manifest_source, std::string databasedir, bool perform_removes, bool force_removes, int threads)
-: output_folder(output_folder), manifest_dest(manifest_dest), manifest_source(manifest_source), databasedir(databasedir), perform_removes(perform_removes),force_removes(force_removes), threads(threads)
-{
-
+JobHandler::JobHandler(std::string output_folder, std::string manifest_dest, std::string manifest_source, std::string databasedir, bool perform_removes, bool force_removes, int threads)
+ : output_folder(output_folder), manifest_dest(manifest_dest), manifest_source(manifest_source), databasedir(databasedir), perform_removes(perform_removes), force_removes(force_removes), threads(threads) {
}
-bool JobHandler::Run(const std::string& path )
-{
+bool JobHandler::Run(const std::string& path) {
bool ret = true;
Manifest old_manifest(threads);
DatabaseManifest database_manifest;
std::string database_file = AssemblePath(databasedir, "database_manifest.xml");
- if(!manifest_source.empty())
- {
- old_manifest.Load(manifest_source);
- LOGI << "Calculating hashes of previously built files... [" << threads << "]" << std::endl;
+ if (!manifest_source.empty()) {
+ old_manifest.Load(manifest_source);
+ LOGI << "Calculating hashes of previously built files... [" << threads << "]" << std::endl;
{
old_manifest.PrecalculateCurrentDestinationHashes(output_folder);
}
}
- if(!databasedir.empty() )
- {
- if( config_load_from_database || config_save_to_database ) {
- database_manifest.Load(database_file);
+ if (!databasedir.empty()) {
+ if (config_load_from_database || config_save_to_database) {
+ database_manifest.Load(database_file);
}
}
-
+
{
JobXMLParser jobparser;
- if( !jobparser.Load( path ) )
- {
+ if (!jobparser.Load(path)) {
LOGE << "Error" << std::endl;
ret = false;
- }
- else
- {
+ } else {
input_folders = jobparser.inputs;
LOGI << "Adding Items..." << std::endl;
@@ -87,35 +79,32 @@ bool JobHandler::Run(const std::string& path )
size_t item_count = jobparser.items.size();
size_t cur = 0;
std::vector<JobXMLParser::Item>::iterator itemit;
- for( itemit = jobparser.items.begin(); itemit != jobparser.items.end(); itemit++ )
- {
+ for (itemit = jobparser.items.begin(); itemit != jobparser.items.end(); itemit++) {
std::string chosen_input_folder;
std::string item_path;
bool is_ok = false;
- LOGD << "Loading Transfer: " << itemit->path << std::endl;
- for(const std::string& input_folder : input_folders)
- {
- if(is_ok == false) {
- if( CheckFileAccess(AssemblePath(input_folder,itemit->path).c_str()) ) {
+ LOGD << "Loading Transfer: " << itemit->path << std::endl;
+ for (const std::string& input_folder : input_folders) {
+ if (is_ok == false) {
+ if (CheckFileAccess(AssemblePath(input_folder, itemit->path).c_str())) {
item_path = itemit->path;
- chosen_input_folder = input_folder;
+ chosen_input_folder = input_folder;
is_ok = true;
} else {
- std::string case_corrected = CaseCorrect(AssemblePath(input_folder,itemit->path));
- if(CheckFileAccess(case_corrected.c_str())) {
+ std::string case_corrected = CaseCorrect(AssemblePath(input_folder, itemit->path));
+ if (CheckFileAccess(case_corrected.c_str())) {
item_path = case_corrected.substr(input_folder.size());
- chosen_input_folder = input_folder;
+ chosen_input_folder = input_folder;
is_ok = true;
LOGW << "Path \"" << itemit->path << "\" for item had to be case corrected to " << item_path << ". Row: " << itemit->row << std::endl;
}
}
- }
- }
+ }
+ }
- if( is_ok ) {
- if( itemit->recursive )
- {
+ if (is_ok) {
+ if (itemit->recursive) {
LOGD << "Transfer is recursive" << std::endl;
std::vector<std::string> manifest;
@@ -124,43 +113,35 @@ bool JobHandler::Run(const std::string& path )
LOGD << "Loaded from " << manifest_path << " found " << manifest.size() << " files." << std::endl;
- std::vector<std::string>::iterator manifestit;
+ std::vector<std::string>::iterator manifestit;
- for( manifestit = manifest.begin(); manifestit != manifest.end(); manifestit++ )
- {
- std::string full_sub_path = AssemblePath(item_path,*manifestit);
- if(endswith(full_sub_path.c_str(), itemit->path_ending.c_str()))
- {
+ for (manifestit = manifest.begin(); manifestit != manifest.end(); manifestit++) {
+ std::string full_sub_path = AssemblePath(item_path, *manifestit);
+ if (endswith(full_sub_path.c_str(), itemit->path_ending.c_str())) {
LOGD << "Including " << full_sub_path << std::endl;
- AddItem(chosen_input_folder, full_sub_path,itemit->type,*itemit);
- }
- else
- {
+ AddItem(chosen_input_folder, full_sub_path, itemit->type, *itemit);
+ } else {
LOGD << "Ignoring " << full_sub_path << std::endl;
}
}
- }
- else
- {
- AddItem(chosen_input_folder, item_path,itemit->type,*itemit);
+ } else {
+ AddItem(chosen_input_folder, item_path, itemit->type, *itemit);
}
} else {
LOGE << "Path \"" << itemit->path << "\" for item is invalid, even after case correction. Row: " << itemit->row << std::endl;
- }
+ }
cur++;
- SetPercent( item_path.c_str(), (int)(100.0f*((float)cur/(float)item_count)) );
+ SetPercent(item_path.c_str(), (int)(100.0f * ((float)cur / (float)item_count)));
}
}
- if( config_print_item_list )
- {
+ if (config_print_item_list) {
LOGI << "Printing item list from deployment file..." << std::endl;
-
+
std::vector<Item>::iterator itemit = items.begin();
- for( ;itemit != items.end();itemit++ )
- {
+ for (; itemit != items.end(); itemit++) {
LOGI << *itemit << std::endl;
}
}
@@ -169,15 +150,11 @@ bool JobHandler::Run(const std::string& path )
{
SearcherFactory sf;
std::vector<JobXMLParser::Searcher>::iterator searcherit;
- for( searcherit = jobparser.searchers.begin(); searcherit != jobparser.searchers.end(); searcherit++ )
- {
- if( sf.HasSearcher(searcherit->searcher))
- {
- Searcher searcher = sf.CreateSearcher( searcherit->searcher, searcherit->path_ending, searcherit->type_pattern_re);
+ for (searcherit = jobparser.searchers.begin(); searcherit != jobparser.searchers.end(); searcherit++) {
+ if (sf.HasSearcher(searcherit->searcher)) {
+ Searcher searcher = sf.CreateSearcher(searcherit->searcher, searcherit->path_ending, searcherit->type_pattern_re);
searchers.push_back(searcher);
- }
- else
- {
+ } else {
ret = false;
LOGE << "Unable to find searcher matching name " << searcherit->searcher << std::endl;
}
@@ -188,15 +165,11 @@ bool JobHandler::Run(const std::string& path )
{
BuilderFactory bf;
std::vector<JobXMLParser::Builder>::iterator builderit;
- for( builderit = jobparser.builders.begin(); builderit != jobparser.builders.end(); builderit++ )
- {
- if( bf.HasBuilder( builderit->builder ) )
- {
- Builder builder = bf.CreateBuilder( builderit->builder, builderit->path_ending, builderit->type_pattern_re);
+ for (builderit = jobparser.builders.begin(); builderit != jobparser.builders.end(); builderit++) {
+ if (bf.HasBuilder(builderit->builder)) {
+ Builder builder = bf.CreateBuilder(builderit->builder, builderit->path_ending, builderit->type_pattern_re);
builders.push_back(builder);
- }
- else
- {
+ } else {
LOGE << "Unable to find builder matching name " << builderit->builder << std::endl;
ret = false;
}
@@ -207,20 +180,15 @@ bool JobHandler::Run(const std::string& path )
{
GeneratorFactory bf;
std::vector<JobXMLParser::Generator>::iterator generatorit;
- for( generatorit = jobparser.generators.begin(); generatorit != jobparser.generators.end(); generatorit++ )
- {
- if( bf.HasGenerator( generatorit->generator ) )
- {
- Generator generator = bf.CreateGenerator( generatorit->generator );
+ for (generatorit = jobparser.generators.begin(); generatorit != jobparser.generators.end(); generatorit++) {
+ if (bf.HasGenerator(generatorit->generator)) {
+ Generator generator = bf.CreateGenerator(generatorit->generator);
generators.push_back(generator);
- }
- else
- {
+ } else {
LOGE << "Unable to find generator matching name " << generatorit->generator << std::endl;
ret = false;
}
}
-
}
LOGD << jobparser << std::endl;
@@ -230,90 +198,75 @@ bool JobHandler::Run(const std::string& path )
LOGI << "Running searchers through Items..." << std::endl;
{
std::vector<Item>::iterator itemit;
- for( itemit = items.begin(); itemit != items.end(); itemit++ )
- {
- RunRecursiveSearchOn( *itemit );
+ for (itemit = items.begin(); itemit != items.end(); itemit++) {
+ RunRecursiveSearchOn(*itemit);
}
LOGI << "Found a total of " << foundItems.size() << " objects when searching" << std::endl;
- items.insert( items.end(), foundItems.begin(), foundItems.end() );
+ items.insert(items.end(), foundItems.begin(), foundItems.end());
}
LOGI << "Marking overshadowed Items" << std::endl;
{
std::vector<Item>::iterator itemit;
- for( itemit = items.begin(); itemit != items.end(); itemit++ )
- {
+ for (itemit = items.begin(); itemit != items.end(); itemit++) {
std::vector<Item>::iterator item2it;
- for( item2it = items.begin(); item2it != items.end(); item2it++ )
- {
- if( itemit->Overshadows(*item2it) )
- {
+ for (item2it = items.begin(); item2it != items.end(); item2it++) {
+ if (itemit->Overshadows(*item2it)) {
item2it->SetOvershadowed(true);
}
}
}
}
- if( config_print_duplicates )
- {
+ if (config_print_duplicates) {
LOGI << "Looking for duplicate items..." << std::endl;
{
- std::vector<Item>::iterator itemit;
+ std::vector<Item>::iterator itemit;
std::vector<Item>::iterator itemit2;
-
+
std::set<JobXMLParser::Item> first_level_duplicates;
- for( itemit = items.begin(); itemit != items.end(); itemit++ )
- {
- for( itemit2 = itemit + 1; itemit2 != items.end(); itemit2++ )
- {
- if( itemit->GetAbsPath() == itemit2->GetAbsPath()
- && itemit->type == itemit2->type )
- {
- if( *itemit == itemit->source )
- {
- first_level_duplicates.insert( itemit->source );
- LOGW << "Found duplicated of " << *itemit << " " << "sourced from rows: " << itemit->source.row << " and " << itemit2->source.row << "." << std::endl;
- }
- else if( *itemit2 == itemit2->source )
- {
- first_level_duplicates.insert( itemit2->source );
- LOGW << "Found duplicated of " << *itemit << " " << "sourced from rows: " << itemit->source.row << " and " << itemit2->source.row << "." << std::endl;
+ for (itemit = items.begin(); itemit != items.end(); itemit++) {
+ for (itemit2 = itemit + 1; itemit2 != items.end(); itemit2++) {
+ if (itemit->GetAbsPath() == itemit2->GetAbsPath() && itemit->type == itemit2->type) {
+ if (*itemit == itemit->source) {
+ first_level_duplicates.insert(itemit->source);
+ LOGW << "Found duplicated of " << *itemit << " "
+ << "sourced from rows: " << itemit->source.row << " and " << itemit2->source.row << "." << std::endl;
+ } else if (*itemit2 == itemit2->source) {
+ first_level_duplicates.insert(itemit2->source);
+ LOGW << "Found duplicated of " << *itemit << " "
+ << "sourced from rows: " << itemit->source.row << " and " << itemit2->source.row << "." << std::endl;
}
}
}
}
-
+
LOGI << "Listing all first-level first-time references to duplicates... (For simple removal)" << std::endl;
{
std::set<JobXMLParser::Item>::iterator parserit;
- for( parserit = first_level_duplicates.begin(); parserit != first_level_duplicates.end(); parserit++ )
- {
- fprintf( stderr, "RMLN:%d\n", parserit->row );
+ for (parserit = first_level_duplicates.begin(); parserit != first_level_duplicates.end(); parserit++) {
+ fprintf(stderr, "RMLN:%d\n", parserit->row);
}
}
}
}
- if( config_print_missing )
- {
+ if (config_print_missing) {
LOGI << "Printing files in folder but not in deploy list..." << std::endl;
-
+
std::vector<std::string> manifest;
- for(const std::string& input_folder : input_folders)
- {
- GenerateManifest( input_folder.c_str(), manifest );
- }
+ for (const std::string& input_folder : input_folders) {
+ GenerateManifest(input_folder.c_str(), manifest);
+ }
std::vector<std::string>::iterator manifestit = manifest.begin();
- for( ; manifestit != manifest.end(); manifestit++ )
- {
- if( false == HasItemWithPath( *manifestit ) )
- {
+ for (; manifestit != manifest.end(); manifestit++) {
+ if (false == HasItemWithPath(*manifestit)) {
std::cout << *manifestit << std::endl;
}
}
@@ -328,30 +281,27 @@ bool JobHandler::Run(const std::string& path )
{
if( searchTypeIt->second == 0 )
{
- LOGW << "Item type: " << searchTypeIt->first << " has no assigned searchers." << std::endl;
+ LOGW << "Item type: " << searchTypeIt->first << " has no assigned searchers." << std::endl;
}
}
}
*/
- LOGI << "Calculating Item hashes...[" << threads << "]"<< std::endl;
+ LOGI << "Calculating Item hashes...[" << threads << "]" << std::endl;
{
JobHandlerThreadPool jhtp(threads);
jhtp.RunHashCalculation(items);
}
- if( !config_mute_missing )
- {
+ if (!config_mute_missing) {
LOGI << "Listing referenced items missing from disk..." << std::endl;
{
- std::vector<Item>::iterator itemit;
+ std::vector<Item>::iterator itemit;
- for( itemit = items.begin(); itemit != items.end(); itemit++ )
- {
- if( itemit->hash.empty() && itemit->IsOvershadowed() == false )
- {
+ for (itemit = items.begin(); itemit != items.end(); itemit++) {
+ if (itemit->hash.empty() && itemit->IsOvershadowed() == false) {
LOGE << "Missing item " << *itemit << std::endl;
- }
+ }
}
}
}
@@ -362,118 +312,94 @@ bool JobHandler::Run(const std::string& path )
size_t item_count = items.size();
size_t cur = 0;
std::vector<Item>::iterator itemit;
- for( itemit = items.begin(); itemit != items.end(); itemit++ )
- {
- if( itemit->IsOvershadowed() )
- {
- LOGI << "Skipping " << *itemit << " because it's overshadowed" << std::endl;
- }
- else if( itemit->IsOnlySearch() )
- {
- LOGD << "Skipping " << *itemit << " because it's search only" << std::endl;
- }
- else
- {
+ for (itemit = items.begin(); itemit != items.end(); itemit++) {
+ if (itemit->IsOvershadowed()) {
+ LOGI << "Skipping " << *itemit << " because it's overshadowed" << std::endl;
+ } else if (itemit->IsOnlySearch()) {
+ LOGD << "Skipping " << *itemit << " because it's search only" << std::endl;
+ } else {
std::vector<Builder>::iterator builderit;
int count = 0;
- for( builderit = builders.begin(); builderit != builders.end(); builderit++ )
- {
- if( builderit->IsMatch( *itemit ))
- {
+ for (builderit = builders.begin(); builderit != builders.end(); builderit++) {
+ if (builderit->IsMatch(*itemit)) {
count++;
- if(builderit->RunEvenOnIdenticalSource() == false && old_manifest.IsUpToDate( *this, *itemit, *builderit ) )
- {
+ if (builderit->RunEvenOnIdenticalSource() == false && old_manifest.IsUpToDate(*this, *itemit, *builderit)) {
LOGD << "Using cached result on " << *itemit << std::endl;
- result_manifest.AddResult(old_manifest.GetPreviouslyBuiltResult( *itemit, *builderit ));
- }
- else if( config_load_from_database && builderit->RunEvenOnIdenticalSource() == false && builderit->StoreResultInDatabase() && database_manifest.HasBuiltResultFor(*this, *itemit, *builderit) )
- {
+ result_manifest.AddResult(old_manifest.GetPreviouslyBuiltResult(*itemit, *builderit));
+ } else if (config_load_from_database && builderit->RunEvenOnIdenticalSource() == false && builderit->StoreResultInDatabase() && database_manifest.HasBuiltResultFor(*this, *itemit, *builderit)) {
LOGI << "Using database value on " << *itemit << std::endl;
DatabaseManifestResult dmr = database_manifest.GetPreviouslyBuiltResult(*itemit, *builderit);
-
- std::string result_source_path = AssemblePath(databasedir,AssemblePath("files",AssemblePath(dmr.item.hash,dmr.dest_hash)));
- std::string result_dest_path = AssemblePath(output_folder,dmr.dest);
+
+ std::string result_source_path = AssemblePath(databasedir, AssemblePath("files", AssemblePath(dmr.item.hash, dmr.dest_hash)));
+ std::string result_dest_path = AssemblePath(output_folder, dmr.dest);
CreateParentDirs(result_dest_path);
- copyfile(result_source_path,result_dest_path);
+ copyfile(result_source_path, result_dest_path);
result_manifest.AddResult(ManifestResult(dmr.dest_hash, *itemit, dmr.dest, true, dmr.name, dmr.version, ManifestResult::DATABASE, dmr.type));
- }
- else
- {
- //Check if item has source hash, meaning if the source file exists.
- if( !itemit->hash.empty() )
- {
+ } else {
+ // Check if item has source hash, meaning if the source file exists.
+ if (!itemit->hash.empty()) {
LOGD << "Running " << builderit->GetBuilderName() << " on " << *itemit << std::endl;
result_manifest.AddResult(builderit->Run(*this, *itemit));
- }
- else
- {
+ } else {
LOGE << "Unable to run " << builderit->GetBuilderName() << " on " << *itemit << " file missing." << std::endl;
ret = false;
}
}
- }
- else
- {
- LOGD << "Skipping " << builderit->GetBuilderName() << " on " << *itemit << ", doesn't match pattern." << std::endl;
+ } else {
+ LOGD << "Skipping " << builderit->GetBuilderName() << " on " << *itemit << ", doesn't match pattern." << std::endl;
}
}
- if( count == 0 && !itemit->hash.empty() )
+ if (count == 0 && !itemit->hash.empty())
LOGW << *itemit << " has no assigned builder" << std::endl;
- if( count > typeBuilderCount[itemit->type] )
+ if (count > typeBuilderCount[itemit->type])
typeBuilderCount[itemit->type] = count;
}
cur++;
- SetPercent( itemit->GetPath().c_str(), (int)(100.0f*((float)cur/(float)item_count)) );
+ SetPercent(itemit->GetPath().c_str(), (int)(100.0f * ((float)cur / (float)item_count)));
}
}
- //Copy manifest to use when running the generators.
+ // Copy manifest to use when running the generators.
const Manifest generated_manifest = result_manifest;
LOGI << "Running Generators..." << std::endl;
{
std::vector<Generator>::iterator generatorit;
int count = 0;
- for( generatorit = generators.begin(); generatorit != generators.end(); generatorit++ )
- {
+ for (generatorit = generators.begin(); generatorit != generators.end(); generatorit++) {
count++;
LOGD << "Running " << generatorit->GetGeneratorName() << std::endl;
- result_manifest.AddResult(generatorit->Run(*this,generated_manifest));
+ result_manifest.AddResult(generatorit->Run(*this, generated_manifest));
}
}
LOGI << "Checking what items don't have a builder..." << std::endl;
{
- std::map<std::string,int>::iterator builderTypeIt;
+ std::map<std::string, int>::iterator builderTypeIt;
- for( builderTypeIt = typeBuilderCount.begin(); builderTypeIt != typeBuilderCount.end(); builderTypeIt++ )
- {
- if( builderTypeIt->second == 0 )
- {
- LOGW << "Item type: " << builderTypeIt->first << " has no assigned builder." << std::endl;
+ for (builderTypeIt = typeBuilderCount.begin(); builderTypeIt != typeBuilderCount.end(); builderTypeIt++) {
+ if (builderTypeIt->second == 0) {
+ LOGW << "Item type: " << builderTypeIt->first << " has no assigned builder." << std::endl;
}
}
}
- if( result_manifest.HasError() )
- {
+ if (result_manifest.HasError()) {
LOGE << "Some builder(s) caused an error, see manifest for more info." << std::endl;
ret = false;
}
- //Unlinks are serious business, so we do this carefully
- if( ret || force_removes )
- {
+ // Unlinks are serious business, so we do this carefully
+ if (ret || force_removes) {
LOGI << "Removing items not listed in the generated manifest" << std::endl;
std::vector<std::string> destination_file_list;
- GenerateManifest( output_folder.c_str(), destination_file_list );
+ GenerateManifest(output_folder.c_str(), destination_file_list);
{
std::vector<std::string>::iterator missit;
- for(missit = destination_file_list.begin(); missit != destination_file_list.end(); missit++ )
- {
+ for (missit = destination_file_list.begin(); missit != destination_file_list.end(); missit++) {
LOGD << "In Output Folder: " << *missit << std::endl;
}
}
@@ -481,8 +407,7 @@ bool JobHandler::Run(const std::string& path )
std::vector<std::string> new_manifest_file_list = result_manifest.GetDestinationFiles();
{
std::vector<std::string>::iterator missit;
- for(missit = new_manifest_file_list.begin(); missit != new_manifest_file_list.end(); missit++ )
- {
+ for (missit = new_manifest_file_list.begin(); missit != new_manifest_file_list.end(); missit++) {
LOGD << "New Manifest File: " << *missit << std::endl;
}
}
@@ -490,216 +415,178 @@ bool JobHandler::Run(const std::string& path )
std::vector<std::string> old_manifest_file_list = old_manifest.GetDestinationFiles();
{
std::vector<std::string>::iterator missit;
- for(missit = old_manifest_file_list.begin(); missit != old_manifest_file_list.end(); missit++ )
- {
+ for (missit = old_manifest_file_list.begin(); missit != old_manifest_file_list.end(); missit++) {
LOGD << "Old Manifest File: " << *missit << std::endl;
}
}
std::vector<std::string> unlisted_files;
- std::sort( destination_file_list.begin(), destination_file_list.end() );
- std::sort( new_manifest_file_list.begin(), new_manifest_file_list.end() );
- std::sort( old_manifest_file_list.begin(), old_manifest_file_list.end() );
+ std::sort(destination_file_list.begin(), destination_file_list.end());
+ std::sort(new_manifest_file_list.begin(), new_manifest_file_list.end());
+ std::sort(old_manifest_file_list.begin(), old_manifest_file_list.end());
- std::set_difference( destination_file_list.begin(), destination_file_list.end(),
- new_manifest_file_list.begin(), new_manifest_file_list.end(),
- std::back_inserter(unlisted_files) );
+ std::set_difference(destination_file_list.begin(), destination_file_list.end(),
+ new_manifest_file_list.begin(), new_manifest_file_list.end(),
+ std::back_inserter(unlisted_files));
{
std::vector<std::string>::iterator missit;
- for(missit = unlisted_files.begin(); missit != unlisted_files.end(); missit++ )
- {
+ for (missit = unlisted_files.begin(); missit != unlisted_files.end(); missit++) {
LOGI << "Unlisted: " << *missit << std::endl;
}
}
std::vector<std::string> remove_list;
-
- //Remove files that are in the folder but not known from previous builds?
- if( config_remove_unlisted_files )
- {
+ // Remove files that are in the folder but not known from previous builds?
+ if (config_remove_unlisted_files) {
LOGI << "Adding all unlisted files into the remove list. (--remove-unlisted)" << std::endl;
- remove_list.insert(remove_list.begin(), unlisted_files.begin(), unlisted_files.end() );
- }
- else
- {
- //Only remove unlisted files that are mentioned in the old manifest.
- std::set_intersection( unlisted_files.begin(), unlisted_files.end(),
- old_manifest_file_list.begin(), old_manifest_file_list.end(),
- std::back_inserter(remove_list) );
+ remove_list.insert(remove_list.begin(), unlisted_files.begin(), unlisted_files.end());
+ } else {
+ // Only remove unlisted files that are mentioned in the old manifest.
+ std::set_intersection(unlisted_files.begin(), unlisted_files.end(),
+ old_manifest_file_list.begin(), old_manifest_file_list.end(),
+ std::back_inserter(remove_list));
}
- //If this passes i'm comfortable removing files.
- if( remove_list == unlisted_files || force_removes )
- {
- if( remove_list == unlisted_files )
- {
+ // If this passes i'm comfortable removing files.
+ if (remove_list == unlisted_files || force_removes) {
+ if (remove_list == unlisted_files) {
LOGI << "Unlisted files match old manifest, removing them" << std::endl;
- }
- else
- {
+ } else {
LOGI << "Dictated to forcefully remove all found items." << std::endl;
}
{
std::vector<std::string>::iterator missit;
- for(missit = remove_list.begin(); missit != remove_list.end(); missit++ )
- {
- std::string full_remove_path = AssemblePath(output_folder,*missit);
- if( perform_removes )
- {
+ for (missit = remove_list.begin(); missit != remove_list.end(); missit++) {
+ std::string full_remove_path = AssemblePath(output_folder, *missit);
+ if (perform_removes) {
LOGW << "Removing " << full_remove_path << std::endl;
- remove( full_remove_path.c_str() );
- }
- else
- {
+ remove(full_remove_path.c_str());
+ } else {
LOGI << "Pretending to remove (no --perform-removes): " << full_remove_path << std::endl;
}
}
}
- }
- else
- {
+ } else {
LOGF << "Unlisted files and old manifest files don't match, i refuse to try and remove anything because this is a hint that something isn't right in this fully managed directory." << std::endl;
ret = false;
}
- }
- else
- {
+ } else {
LOGE << "Skipping removal due to previous error(s)" << std::endl;
}
LOGI << "Removing temporary items..." << std::endl;
{
std::vector<Item>::iterator itemit;
- for( itemit = items.begin(); itemit != items.end(); itemit++ )
- {
- if( itemit->IsDeleteOnExit() )
- {
- if( perform_removes )
- {
- LOGD << "Removing " << *itemit << std::endl;
- std::string path = itemit->GetAbsPath();
- remove( path.c_str() );
- }
- else
- {
+ for (itemit = items.begin(); itemit != items.end(); itemit++) {
+ if (itemit->IsDeleteOnExit()) {
+ if (perform_removes) {
+ LOGD << "Removing " << *itemit << std::endl;
+ std::string path = itemit->GetAbsPath();
+ remove(path.c_str());
+ } else {
LOGD << "Skipping remove of " << *itemit << " as --perform-removes isn't specified" << std::endl;
}
-
- }
+ }
}
}
- if( !manifest_dest.empty() )
- {
+ if (!manifest_dest.empty()) {
LOGI << "Saving resulting manifest to disk: " << manifest_dest << std::endl;
result_manifest.Save(manifest_dest);
}
- if(!databasedir.empty() ) {
- if( config_save_to_database ) {
+ if (!databasedir.empty()) {
+ if (config_save_to_database) {
std::vector<ManifestResult>::const_iterator mareit = result_manifest.ResultsBegin();
BuilderFactory builder_factory;
- for(; mareit != result_manifest.ResultsEnd(); mareit++ ) {
- if( mareit->mr_type == ManifestResult::BUILT ) {
- if( mareit->items.size() == 1 ) {
- if( builder_factory.StoreResultInDatabase(mareit->name) ) {
-
+ for (; mareit != result_manifest.ResultsEnd(); mareit++) {
+ if (mareit->mr_type == ManifestResult::BUILT) {
+ if (mareit->items.size() == 1) {
+ if (builder_factory.StoreResultInDatabase(mareit->name)) {
LOGI << "Storing " << *mareit << " in database for future use." << std::endl;
- std::string result_source_path = AssemblePath(output_folder,mareit->dest);
- std::string result_dest_path = AssemblePath(databasedir,AssemblePath("files",AssemblePath(mareit->items[0].hash,mareit->dest_hash)));
+ std::string result_source_path = AssemblePath(output_folder, mareit->dest);
+ std::string result_dest_path = AssemblePath(databasedir, AssemblePath("files", AssemblePath(mareit->items[0].hash, mareit->dest_hash)));
CreateParentDirs(result_dest_path);
- copyfile(result_source_path,result_dest_path);
-
+ copyfile(result_source_path, result_dest_path);
+
database_manifest.AddResult(DatabaseManifestResult(
- mareit->items[0],
- mareit->dest_hash,
+ mareit->items[0],
+ mareit->dest_hash,
mareit->dest,
- mareit->name,
+ mareit->name,
mareit->version,
- mareit->type
- ));
+ mareit->type));
}
- } else {
+ } else {
LOGW << "Database doesn't support multi item sources" << std::endl;
}
}
}
CreateParentDirs(database_file);
- database_manifest.Save(database_file);
+ database_manifest.Save(database_file);
}
- }
+ }
return ret;
}
-void JobHandler::RunRecursiveSearchOn( const Item& item )
-{
+void JobHandler::RunRecursiveSearchOn(const Item& item) {
std::vector<Item> foundSum;
- if( std::find(searchedItems.begin(),searchedItems.end(),item) == searchedItems.end() )
- {
+ if (std::find(searchedItems.begin(), searchedItems.end(), item) == searchedItems.end()) {
std::vector<Searcher>::iterator searcherit;
int count = 0;
- for( searcherit = searchers.begin(); searcherit != searchers.end(); searcherit++ )
- {
- std::vector<Item> f = searcherit->TrySearch(*this,item,&count);
+ for (searcherit = searchers.begin(); searcherit != searchers.end(); searcherit++) {
+ std::vector<Item> f = searcherit->TrySearch(*this, item, &count);
- foundSum.insert(foundSum.end(),f.begin(),f.end());
+ foundSum.insert(foundSum.end(), f.begin(), f.end());
}
assert((count > 0 && foundSum.size() > 0) || foundSum.size() == 0);
- if( count == 0 )
- {
+ if (count == 0) {
LOGW << item << " has no assigned searcher" << std::endl;
}
- if( count > typeSearcherCount[item.type] )
+ if (count > typeSearcherCount[item.type])
typeSearcherCount[item.type] = count;
searchedItems.push_back(item);
std::vector<Item>::iterator foundSumIt;
- for( foundSumIt = foundSum.begin(); foundSumIt != foundSum.end(); foundSumIt++ )
- {
- //We sometimes get broken paths from the files (bad case etc)
+ for (foundSumIt = foundSum.begin(); foundSumIt != foundSum.end(); foundSumIt++) {
+ // We sometimes get broken paths from the files (bad case etc)
foundSumIt->VerifyPath();
- RunRecursiveSearchOn( *foundSumIt );
+ RunRecursiveSearchOn(*foundSumIt);
}
- if( foundSum.size() > 0 )
+ if (foundSum.size() > 0)
LOGD << "Found " << foundSum.size() << " in " << item << std::endl;
foundItems.insert(foundSum.begin(), foundSum.end());
}
}
-void JobHandler::AddItem(const std::string& input_folder, const std::string& path, const std::string& type, const JobXMLParser::Item& source)
-{
- LOGD << "Adding " << type << ": " << path << std::endl;
- items.push_back(Item(input_folder,path,type,source));
+void JobHandler::AddItem(const std::string& input_folder, const std::string& path, const std::string& type, const JobXMLParser::Item& source) {
+ LOGD << "Adding " << type << ": " << path << std::endl;
+ items.push_back(Item(input_folder, path, type, source));
}
-std::vector<Item>::const_iterator JobHandler::ItemsBegin() const
-{
+std::vector<Item>::const_iterator JobHandler::ItemsBegin() const {
return items.begin();
}
-std::vector<Item>::const_iterator JobHandler::ItemsEnd() const
-{
+std::vector<Item>::const_iterator JobHandler::ItemsEnd() const {
return items.end();
}
-bool JobHandler::HasItemWithPath( const std::string& path )
-{
+bool JobHandler::HasItemWithPath(const std::string& path) {
std::vector<Item>::iterator itemit = items.begin();
- for( ; itemit != items.end(); itemit++ )
- {
- if( itemit->path == path )
- {
+ for (; itemit != items.end(); itemit++) {
+ if (itemit->path == path) {
return true;
}
}
diff --git a/Source/Ogda/jobhandler.h b/Source/Ogda/jobhandler.h
index 1fef0822..f7be55a7 100644
--- a/Source/Ogda/jobhandler.h
+++ b/Source/Ogda/jobhandler.h
@@ -26,16 +26,14 @@
#include <set>
#include <vector>
-
#include "item.h"
#include <Ogda/Builders/builder.h>
#include <Ogda/Searchers/searcher.h>
#include <Ogda/Generators/generator.h>
-class JobHandler
-{
- std::map<std::string,int> typeSearcherCount;
- std::map<std::string,int> typeBuilderCount;
+class JobHandler {
+ std::map<std::string, int> typeSearcherCount;
+ std::map<std::string, int> typeBuilderCount;
std::vector<Item> items;
std::vector<Item> searchedItems;
@@ -47,8 +45,9 @@ class JobHandler
int threads;
- void RunRecursiveSearchOn( const Item& item );
-public:
+ void RunRecursiveSearchOn(const Item& item);
+
+ public:
std::vector<std::string> input_folders;
std::string output_folder, manifest_dest, manifest_source, databasedir;
bool perform_removes;
@@ -61,5 +60,5 @@ public:
std::vector<Item>::const_iterator ItemsBegin() const;
std::vector<Item>::const_iterator ItemsEnd() const;
- bool HasItemWithPath( const std::string& path );
+ bool HasItemWithPath(const std::string& path);
};
diff --git a/Source/Ogda/jobhandlerthreadpool.cpp b/Source/Ogda/jobhandlerthreadpool.cpp
index 05a64de2..66661854 100644
--- a/Source/Ogda/jobhandlerthreadpool.cpp
+++ b/Source/Ogda/jobhandlerthreadpool.cpp
@@ -33,87 +33,74 @@
#include <unistd.h>
#endif
-struct ItemJob
-{
+struct ItemJob {
Item* item;
int step;
int count;
volatile int performed;
};
-static void* CalculateItemHash( void* item )
-{
- ItemJob* ij = static_cast<ItemJob*>(item);
+static void* CalculateItemHash(void* item) {
+ ItemJob* ij = static_cast<ItemJob*>(item);
ij->performed = 0;
- for( int i = 0; i < ij->count; i++ )
- {
- ij->item[i*ij->step].CalculateHash();
+ for (int i = 0; i < ij->count; i++) {
+ ij->item[i * ij->step].CalculateHash();
ij->performed++;
}
return 0;
}
-JobHandlerThreadPool::JobHandlerThreadPool( int thread_count ) : thread_count(thread_count)
-{
- threads = static_cast<pthread_t*>(OG_MALLOC( sizeof(pthread_t) * thread_count ));
+JobHandlerThreadPool::JobHandlerThreadPool(int thread_count) : thread_count(thread_count) {
+ threads = static_cast<pthread_t*>(OG_MALLOC(sizeof(pthread_t) * thread_count));
}
-JobHandlerThreadPool::~JobHandlerThreadPool()
-{
+JobHandlerThreadPool::~JobHandlerThreadPool() {
OG_FREE(threads);
}
-void JobHandlerThreadPool::RunHashCalculation(std::vector<Item>& arr)
-{
- ItemJob* itemjobs = static_cast<ItemJob*>(OG_MALLOC(sizeof(ItemJob)*thread_count));
-
- int step = arr.size()/thread_count;
+void JobHandlerThreadPool::RunHashCalculation(std::vector<Item>& arr) {
+ ItemJob* itemjobs = static_cast<ItemJob*>(OG_MALLOC(sizeof(ItemJob) * thread_count));
- for( int i = 0; i < thread_count; i++ )
- {
+ int step = arr.size() / thread_count;
+
+ for (int i = 0; i < thread_count; i++) {
itemjobs[i].item = &arr[i];
itemjobs[i].step = thread_count;
itemjobs[i].count = step;
- int err = pthread_create( &threads[i], NULL, CalculateItemHash, &itemjobs[i]);
+ int err = pthread_create(&threads[i], NULL, CalculateItemHash, &itemjobs[i]);
- if( err != 0 )
- {
+ if (err != 0) {
LOGE << "Thread create failed" << std::endl;
}
}
- //Do the remaining items in our main thread.
- for( int i = step*thread_count; i < arr.size(); i++ )
- {
+ // Do the remaining items in our main thread.
+ for (int i = step * thread_count; i < arr.size(); i++) {
arr[i].CalculateHash();
}
int count = 0;
- while( count < arr.size() )
- {
+ while (count < arr.size()) {
#ifdef PLATFORM_LINUX
sleep(1);
#endif
std::stringstream ss;
- count = arr.size()-step*thread_count;
- for( int i = 0; i < thread_count; i++ )
- {
+ count = arr.size() - step * thread_count;
+ for (int i = 0; i < thread_count; i++) {
count += itemjobs[i].performed;
ss << ((itemjobs[i].performed == itemjobs[i].count) ? "d" : ".");
}
- SetPercent(ss.str().c_str(), (int)(100.0f*((float)count/(float)arr.size())));
+ SetPercent(ss.str().c_str(), (int)(100.0f * ((float)count / (float)arr.size())));
}
- for( int i = 0; i < thread_count; i++ )
- {
- void* retval;
- int err = pthread_join( threads[i], &retval );
+ for (int i = 0; i < thread_count; i++) {
+ void* retval;
+ int err = pthread_join(threads[i], &retval);
- if( err != 0 )
- {
+ if (err != 0) {
LOGE << "Thread join failed" << std::endl;
}
}
- OG_FREE( itemjobs );
+ OG_FREE(itemjobs);
}
diff --git a/Source/Ogda/jobhandlerthreadpool.h b/Source/Ogda/jobhandlerthreadpool.h
index a49a8081..c1eb451e 100644
--- a/Source/Ogda/jobhandlerthreadpool.h
+++ b/Source/Ogda/jobhandlerthreadpool.h
@@ -27,13 +27,13 @@
#include <vector>
#include "item.h"
-class JobHandlerThreadPool
-{
-private:
+class JobHandlerThreadPool {
+ private:
pthread_t* threads;
int thread_count;
-public:
- JobHandlerThreadPool(int thread_count);
+
+ public:
+ JobHandlerThreadPool(int thread_count);
~JobHandlerThreadPool();
void RunHashCalculation(std::vector<Item>& arr);
diff --git a/Source/Ogda/levelreader.h b/Source/Ogda/levelreader.h
index 44a1ef8c..6745a581 100644
--- a/Source/Ogda/levelreader.h
+++ b/Source/Ogda/levelreader.h
@@ -24,7 +24,5 @@
#include "readerbase.h"
-class LevelReader: public ReaderBase
-{
-
+class LevelReader : public ReaderBase {
};
diff --git a/Source/Ogda/main.cpp b/Source/Ogda/main.cpp
index fb973994..1dbeeb3d 100644
--- a/Source/Ogda/main.cpp
+++ b/Source/Ogda/main.cpp
@@ -36,21 +36,18 @@
#include <cstdlib>
#include <cstdarg>
-void SetPercent( const char* message, int percent )
-{
- if( !config_hide_progress )
- {
+void SetPercent(const char* message, int percent) {
+ if (!config_hide_progress) {
#ifdef PLATFORM_LINUX
- printf( "%c[2K", 27 );
+ printf("%c[2K", 27);
#endif
- printf( "[%d%%]:%s\r", percent, message );
- fflush( stdout );
+ printf("[%d%%]:%s\r", percent, message);
+ fflush(stdout);
}
}
-//Replacement for the main program version of the same fucntion
-void FatalError(const char* title, const char* fmt, ...)
-{
+// Replacement for the main program version of the same fucntion
+void FatalError(const char* title, const char* fmt, ...) {
static const int kBufSize = 1024;
char err_buf[kBufSize];
va_list args;
@@ -61,18 +58,17 @@ void FatalError(const char* title, const char* fmt, ...)
exit(10);
}
-ErrorResponse DisplayError(const char* title, const char* contents, ErrorType type, bool allow_repetition)
-{
+ErrorResponse DisplayError(const char* title, const char* contents, ErrorType type, bool allow_repetition) {
LOGF << title << ", " << contents << std::endl;
exit(1);
return _continue;
}
ErrorResponse DisplayFormatError(ErrorType type,
- bool allow_repetition,
- const char* title,
- const char* fmtcontents,
- ... ) {
+ bool allow_repetition,
+ const char* title,
+ const char* fmtcontents,
+ ...) {
static const int kBufSize = 2048;
char err_buf[kBufSize];
va_list args;
@@ -84,41 +80,47 @@ ErrorResponse DisplayFormatError(ErrorType type,
Allocation alloc;
-int main( int argc, const char** argv )
-{
+int main(int argc, const char** argv) {
alloc.Init();
-
- TCLAP::CmdLine cmd("Ogda", ' ', GetBuildVersion());
- TCLAP::ValueArg<std::string> inputArg("i", "input-dir", "Input Directory", true, "", "string"); cmd.add(inputArg);
- TCLAP::ValueArg<std::string> outputArg("o", "output-dir", "Output directory", true, "", "string"); cmd.add(outputArg);
- TCLAP::ValueArg<std::string> jobfileArg("j", "job-file", "job file", true, "", "string"); cmd.add(jobfileArg);
- TCLAP::ValueArg<std::string> manifestOutArg("", "manifest-output", "Manifest output file, destionation to store a complete manifest of the generated files.", false, "","string"); cmd.add(manifestOutArg);
- TCLAP::ValueArg<std::string> manifestInArg("", "manifest-input", "Manifest input file containing a manifest from the previous build, allows the program to skip converstion of some files.", false, "","string"); cmd.add(manifestInArg);
- TCLAP::ValueArg<std::string> databaseDirArg("", "database-dir", "Path to database storage for auxiliary storage of shared files.", false, "","string"); cmd.add(databaseDirArg);
+ TCLAP::CmdLine cmd("Ogda", ' ', GetBuildVersion());
- TCLAP::SwitchArg debugOutput("d","debug-output","Start game with debug output", cmd, false);
- TCLAP::SwitchArg performRemoves("","perform-removes","Actually do removes that the program intend, instead of faking them", cmd, false);
+ TCLAP::ValueArg<std::string> inputArg("i", "input-dir", "Input Directory", true, "", "string");
+ cmd.add(inputArg);
+ TCLAP::ValueArg<std::string> outputArg("o", "output-dir", "Output directory", true, "", "string");
+ cmd.add(outputArg);
+ TCLAP::ValueArg<std::string> jobfileArg("j", "job-file", "job file", true, "", "string");
+ cmd.add(jobfileArg);
+ TCLAP::ValueArg<std::string> manifestOutArg("", "manifest-output", "Manifest output file, destionation to store a complete manifest of the generated files.", false, "", "string");
+ cmd.add(manifestOutArg);
+ TCLAP::ValueArg<std::string> manifestInArg("", "manifest-input", "Manifest input file containing a manifest from the previous build, allows the program to skip converstion of some files.", false, "", "string");
+ cmd.add(manifestInArg);
+ TCLAP::ValueArg<std::string> databaseDirArg("", "database-dir", "Path to database storage for auxiliary storage of shared files.", false, "", "string");
+ cmd.add(databaseDirArg);
+
+ TCLAP::SwitchArg debugOutput("d", "debug-output", "Start game with debug output", cmd, false);
+ TCLAP::SwitchArg performRemoves("", "perform-removes", "Actually do removes that the program intend, instead of faking them", cmd, false);
TCLAP::SwitchArg forceRemove("", "force-removes", "Always perform removes, even if there is an error in execution or the destination folder contains files which aren't listed in the manifest.", cmd, false);
TCLAP::SwitchArg removeUnlisted("", "remove-unlisted", "Remove files in dest folder that aren't mentioned in the manifest. (Requires --force-removes)", cmd, false);
- TCLAP::SwitchArg printMissing("", "print-missing", "List all files which aren't mentioned in the manifest",cmd,false);
+ TCLAP::SwitchArg printMissing("", "print-missing", "List all files which aren't mentioned in the manifest", cmd, false);
TCLAP::SwitchArg muteMissing("", "mute-missing", "", cmd, false);
TCLAP::SwitchArg hideProgress("", "hide-progress", "", cmd, false);
TCLAP::SwitchArg dateModifiedHash("", "date-modified-hash", "Use the date modified as check for file change, less reliable but faster (BROKEN)", cmd, false);
- TCLAP::SwitchArg printDuplicates("", "print-duplicates", "Give warnings about duplicate references and print a line number list of unnecessary references to items that are recursively referenced from elsewhere", cmd, false);
+ TCLAP::SwitchArg printDuplicates("", "print-duplicates", "Give warnings about duplicate references and print a line number list of unnecessary references to items that are recursively referenced from elsewhere", cmd, false);
TCLAP::SwitchArg printItemList("", "print-item-list", "Print all items initially included via the deployment file", cmd, false);
TCLAP::SwitchArg loadFromDatabase("", "load-from-database", "Load files from a shared auxiliary database", cmd, false);
- TCLAP::SwitchArg saveToDatabase("", "save-to-database", "Save files to a shared auxiliary database", cmd, false);
+ TCLAP::SwitchArg saveToDatabase("", "save-to-database", "Save files to a shared auxiliary database", cmd, false);
- TCLAP::ValueArg<int> threadArg("", "threads", "thread count", false, 8, "int"); cmd.add(threadArg);
+ TCLAP::ValueArg<int> threadArg("", "threads", "thread count", false, 8, "int");
+ cmd.add(threadArg);
- cmd.parse( argc, argv );
+ cmd.parse(argc, argv);
std::string jobfile = jobfileArg.getValue();
std::string outputfolder = outputArg.getValue();
@@ -140,40 +142,36 @@ int main( int argc, const char** argv )
config_save_to_database = saveToDatabase.getValue();
int threads = threadArg.getValue();
-
int ret = 0;
ConsoleHandler consoleHandler;
- LogTypeMask level =
- LogSystem::info
- | LogSystem::warning
- | LogSystem::error
- | LogSystem::fatal;
+ LogTypeMask level =
+ LogSystem::info | LogSystem::warning | LogSystem::error | LogSystem::fatal;
- if( debug_output )
+ if (debug_output)
level |= LogSystem::debug;
- LogSystem::RegisterLogHandler( level, &consoleHandler );
+ LogSystem::RegisterLogHandler(level, &consoleHandler);
- LOGI << "Starting Ogda "<< GetBuildVersion() << std::endl;
+ LOGI << "Starting Ogda " << GetBuildVersion() << std::endl;
- if( ( config_load_from_database || config_load_from_database ) && databasedir.empty() ) {
+ if ((config_load_from_database || config_load_from_database) && databasedir.empty()) {
LOGW << "Asked to load or/and save database, but missing the --database-dir flag, ignoring these two other flags." << std::endl;
}
std::vector<std::string> input_folders;
input_folders.push_back(inputfolder);
- JobHandler jobhandler(outputfolder,manifestout,manifestin,databasedir,perform_removes,force_removes,threads);
+ JobHandler jobhandler(outputfolder, manifestout, manifestin, databasedir, perform_removes, force_removes, threads);
bool run_was_clean = jobhandler.Run(jobfile);
ret = run_was_clean ? 0 : 1;
- if( ret != 0 )
+ if (ret != 0)
LOGE << "One or more error(s) caused unwanted execution, see log for more information" << std::endl;
- LogSystem::DeregisterLogHandler( &consoleHandler );
+ LogSystem::DeregisterLogHandler(&consoleHandler);
alloc.Dispose();
-
+
return ret;
}
diff --git a/Source/Ogda/main.h b/Source/Ogda/main.h
index 8edf52a5..42a18482 100644
--- a/Source/Ogda/main.h
+++ b/Source/Ogda/main.h
@@ -21,4 +21,4 @@
//
//-----------------------------------------------------------------------------
#pragma once
-void SetPercent( const char* message, int percent );
+void SetPercent(const char* message, int percent);
diff --git a/Source/Ogda/manifest.cpp b/Source/Ogda/manifest.cpp
index bc5ebb87..fe21d8f7 100644
--- a/Source/Ogda/manifest.cpp
+++ b/Source/Ogda/manifest.cpp
@@ -34,198 +34,173 @@
#include "jobhandler.h"
#include "manifestthreadpool.h"
-Manifest::Manifest(int thread): thread(thread)
-{
+Manifest::Manifest(int thread) : thread(thread) {
}
-bool Manifest::Load(const std::string& manifest)
-{
+bool Manifest::Load(const std::string& manifest) {
results.clear();
CommonRegex cr;
- TiXmlDocument doc( manifest.c_str() );
+ TiXmlDocument doc(manifest.c_str());
doc.LoadFile();
- if( !doc.Error() )
- {
+ if (!doc.Error()) {
TiXmlElement* pRoot = doc.RootElement();
- if( pRoot )
- {
+ if (pRoot) {
TiXmlHandle hRoot(pRoot);
TiXmlNode* nResult = hRoot.FirstChild().ToNode();
- while( nResult )
- {
+ while (nResult) {
TiXmlElement* eResult = nResult->ToElement();
-
- if( eResult )
- {
- if( strcmp(eResult->Value(), "Result") == 0 //Result is a backwards compatible name, never generated.
- || strcmp(eResult->Value(), "BuilderResult") == 0 )
- {
-
- const char* dest = eResult->Attribute("dest");
- const char* dest_hash = eResult->Attribute("dest_hash");
- const char* builder = eResult->Attribute("builder");
- const char* builder_version = eResult->Attribute("builder_version");
- const char* type = eResult->Attribute("type");
- bool success = cr.saysTrue(eResult->Attribute("success"));
+
+ if (eResult) {
+ if (strcmp(eResult->Value(), "Result") == 0 // Result is a backwards compatible name, never generated.
+ || strcmp(eResult->Value(), "BuilderResult") == 0) {
+ const char* dest = eResult->Attribute("dest");
+ const char* dest_hash = eResult->Attribute("dest_hash");
+ const char* builder = eResult->Attribute("builder");
+ const char* builder_version = eResult->Attribute("builder_version");
+ const char* type = eResult->Attribute("type");
+ bool success = cr.saysTrue(eResult->Attribute("success"));
std::string dest_s;
- if( dest )
- dest_s = std::string( dest );
+ if (dest)
+ dest_s = std::string(dest);
std::string dest_hash_s;
- if( dest_hash )
- dest_hash_s = std::string( dest_hash );
+ if (dest_hash)
+ dest_hash_s = std::string(dest_hash);
std::string builder_s;
- if( builder )
- builder_s = std::string( builder );
+ if (builder)
+ builder_s = std::string(builder);
std::string builder_version_s;
- if( builder_version )
+ if (builder_version)
builder_version_s = std::string(builder_version);
std::string type_s;
- if( type )
+ if (type)
type_s = std::string(type);
std::vector<Item> items;
TiXmlElement* eItem = nResult->FirstChild("Item")->ToElement();
-
- while( eItem )
- {
+
+ while (eItem) {
const char* item_path = eItem->Attribute("path");
const char* item_type = eItem->Attribute("type");
const char* item_hash = eItem->Attribute("hash");
std::string item_path_s;
- if( item_path )
- item_path_s = std::string( item_path );
+ if (item_path)
+ item_path_s = std::string(item_path);
std::string item_type_s;
- if( item_type )
- item_type_s = std::string( item_type );
+ if (item_type)
+ item_type_s = std::string(item_type);
std::string item_hash_s;
- if( item_hash )
- item_hash_s = std::string( item_hash );
+ if (item_hash)
+ item_hash_s = std::string(item_hash);
items.push_back(Item("", item_path_s, item_type_s, item_hash_s, JobXMLParser::Item()));
eItem = eItem->NextSiblingElement("Item");
}
- results.push_back( ManifestResult( dest_hash_s, items, dest_s, success, builder_s, builder_version_s, ManifestResult::BUILT, type_s ) );
- }
- else if( strcmp(eResult->Value(), "DatabaseResult") == 0 )
- {
-
- const char* dest = eResult->Attribute("dest");
- const char* dest_hash = eResult->Attribute("dest_hash");
- const char* builder = eResult->Attribute("builder");
- const char* builder_version = eResult->Attribute("builder_version");
- const char* type = eResult->Attribute("type");
+ results.push_back(ManifestResult(dest_hash_s, items, dest_s, success, builder_s, builder_version_s, ManifestResult::BUILT, type_s));
+ } else if (strcmp(eResult->Value(), "DatabaseResult") == 0) {
+ const char* dest = eResult->Attribute("dest");
+ const char* dest_hash = eResult->Attribute("dest_hash");
+ const char* builder = eResult->Attribute("builder");
+ const char* builder_version = eResult->Attribute("builder_version");
+ const char* type = eResult->Attribute("type");
std::string dest_s;
- if( dest )
- dest_s = std::string( dest );
+ if (dest)
+ dest_s = std::string(dest);
std::string dest_hash_s;
- if( dest_hash )
- dest_hash_s = std::string( dest_hash );
+ if (dest_hash)
+ dest_hash_s = std::string(dest_hash);
std::string builder_s;
- if( builder )
- builder_s = std::string( builder );
+ if (builder)
+ builder_s = std::string(builder);
std::string builder_version_s;
- if( builder_version )
+ if (builder_version)
builder_version_s = std::string(builder_version);
std::string type_s;
- if( type )
+ if (type)
type_s = std::string(type);
std::vector<Item> items;
TiXmlElement* eItem = nResult->FirstChild("Item")->ToElement();
-
- while( eItem )
- {
+
+ while (eItem) {
const char* item_path = eItem->Attribute("path");
const char* item_type = eItem->Attribute("type");
const char* item_hash = eItem->Attribute("hash");
std::string item_path_s;
- if( item_path )
- item_path_s = std::string( item_path );
+ if (item_path)
+ item_path_s = std::string(item_path);
std::string item_type_s;
- if( item_type )
- item_type_s = std::string( item_type );
+ if (item_type)
+ item_type_s = std::string(item_type);
std::string item_hash_s;
- if( item_hash )
- item_hash_s = std::string( item_hash );
+ if (item_hash)
+ item_hash_s = std::string(item_hash);
items.push_back(Item("", item_path_s, item_type_s, item_hash_s, JobXMLParser::Item()));
eItem = eItem->NextSiblingElement("Item");
}
- results.push_back( ManifestResult( dest_hash_s, items, dest_s, true, builder_s, builder_version_s, ManifestResult::DATABASE, type_s ) );
- }
- else if(strcmp(eResult->Value(), "GeneratorResult") == 0 )
- {
- const char* dest = eResult->Attribute("dest");
- const char* dest_hash = eResult->Attribute("dest_hash");
- const char* generator = eResult->Attribute("generator");
+ results.push_back(ManifestResult(dest_hash_s, items, dest_s, true, builder_s, builder_version_s, ManifestResult::DATABASE, type_s));
+ } else if (strcmp(eResult->Value(), "GeneratorResult") == 0) {
+ const char* dest = eResult->Attribute("dest");
+ const char* dest_hash = eResult->Attribute("dest_hash");
+ const char* generator = eResult->Attribute("generator");
const char* generator_version = eResult->Attribute("generator_version");
- const char* type = eResult->Attribute("type");
- bool success = cr.saysTrue(eResult->Attribute("success"));
-
+ const char* type = eResult->Attribute("type");
+ bool success = cr.saysTrue(eResult->Attribute("success"));
+
std::string dest_s;
- if( dest )
- dest_s = std::string( dest );
+ if (dest)
+ dest_s = std::string(dest);
std::string dest_hash_s;
- if( dest_hash )
- dest_hash_s = std::string( dest_hash );
+ if (dest_hash)
+ dest_hash_s = std::string(dest_hash);
std::string generator_s;
- if( generator )
- generator_s = std::string( generator );
+ if (generator)
+ generator_s = std::string(generator);
std::string generator_version_s;
- if( generator_version )
+ if (generator_version)
generator_version_s = std::string(generator_version);
std::string type_s;
- if( type )
+ if (type)
type_s = std::string(type);
- results.push_back( ManifestResult( dest_hash_s, dest_s, success, generator_s, generator_version_s, ManifestResult::GENERATED, type_s ) );
+ results.push_back(ManifestResult(dest_hash_s, dest_s, success, generator_s, generator_version_s, ManifestResult::GENERATED, type_s));
- }
- else
- {
+ } else {
LOGE << "Unknown element name: " << eResult->Value() << std::endl;
}
+ } else {
+ LOGE << "Malformed element in manifest" << std::endl;
}
- else
- {
- LOGE << "Malformed element in manifest" << std::endl;
- }
-
- nResult = nResult->NextSibling();
+
+ nResult = nResult->NextSibling();
}
- }
- else
- {
+ } else {
LOGE << "Problem loading manifest file" << manifest << std::endl;
return false;
}
- }
- else
- {
+ } else {
LOGE << "Error parsing manifest file: \"" << doc.ErrorDesc() << "\"" << std::endl;
return false;
}
std::vector<ManifestResult>::const_iterator mrit;
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
std::vector<Item>::const_iterator itemit;
- for( itemit = mrit->items.begin(); itemit != mrit->items.end(); itemit++ )
- {
+ for (itemit = mrit->items.begin(); itemit != mrit->items.end(); itemit++) {
hash_set.insert(itemit->GetSubHash());
}
}
@@ -233,13 +208,12 @@ bool Manifest::Load(const std::string& manifest)
return true;
}
-bool Manifest::Save(const std::string& manifest)
-{
+bool Manifest::Save(const std::string& manifest) {
TiXmlDocument doc;
- TiXmlDeclaration * decl = new TiXmlDeclaration( "2.0", "", "" );
- TiXmlElement * root = new TiXmlElement( "Manifest" );
+ TiXmlDeclaration* decl = new TiXmlDeclaration("2.0", "", "");
+ TiXmlElement* root = new TiXmlElement("Manifest");
- TiXmlElement* builder_info = new TiXmlElement( "ProgramInfo" );
+ TiXmlElement* builder_info = new TiXmlElement("ProgramInfo");
builder_info->SetAttribute("name", "Ogda");
builder_info->SetAttribute("build_version", GetBuildVersion());
builder_info->SetAttribute("build_date", GetBuildTimestamp());
@@ -247,157 +221,133 @@ bool Manifest::Save(const std::string& manifest)
builder_info->SetAttribute("arch", GetArch());
root->LinkEndChild(builder_info);
- TiXmlElement* execution_info = new TiXmlElement( "ExecutionInfo" );
- //Add timestamp when it was run in here.
- //Add how long it took here.
+ TiXmlElement* execution_info = new TiXmlElement("ExecutionInfo");
+ // Add timestamp when it was run in here.
+ // Add how long it took here.
root->LinkEndChild(execution_info);
std::vector<ManifestResult>::const_iterator mrit;
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
- if( mrit->mr_type == ManifestResult::BUILT )
- {
- TiXmlElement* eResult = new TiXmlElement( "BuilderResult" );
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
+ if (mrit->mr_type == ManifestResult::BUILT) {
+ TiXmlElement* eResult = new TiXmlElement("BuilderResult");
std::vector<Item>::const_iterator itemit;
- for( itemit = mrit->items.begin(); itemit != mrit->items.end(); itemit++ )
- {
- TiXmlElement* eItem = new TiXmlElement( "Item" );
+ for (itemit = mrit->items.begin(); itemit != mrit->items.end(); itemit++) {
+ TiXmlElement* eItem = new TiXmlElement("Item");
- eItem->SetAttribute( "path", itemit->GetPath().c_str() );
- eItem->SetAttribute( "type", itemit->type.c_str() );
- eItem->SetAttribute( "hash", itemit->hash.c_str() );
+ eItem->SetAttribute("path", itemit->GetPath().c_str());
+ eItem->SetAttribute("type", itemit->type.c_str());
+ eItem->SetAttribute("hash", itemit->hash.c_str());
- eResult->LinkEndChild( eItem );
+ eResult->LinkEndChild(eItem);
}
-
- eResult->SetAttribute( "dest", mrit->dest.c_str() );
- eResult->SetAttribute( "dest_hash", mrit->dest_hash.c_str() );
- eResult->SetAttribute( "builder", mrit->name.c_str() );
- eResult->SetAttribute( "builder_version", mrit->version.c_str() );
- eResult->SetAttribute( "type", mrit->type.c_str() );
- eResult->SetAttribute( "success", mrit->success ? "true" : "false" );
- eResult->SetAttribute( "fresh_built", mrit->fresh_built ? "true" : "false" );
-
- root->LinkEndChild( eResult );
- }
- else if( mrit->mr_type == ManifestResult::DATABASE )
- {
- TiXmlElement* eResult = new TiXmlElement( "DatabaseResult" );
+
+ eResult->SetAttribute("dest", mrit->dest.c_str());
+ eResult->SetAttribute("dest_hash", mrit->dest_hash.c_str());
+ eResult->SetAttribute("builder", mrit->name.c_str());
+ eResult->SetAttribute("builder_version", mrit->version.c_str());
+ eResult->SetAttribute("type", mrit->type.c_str());
+ eResult->SetAttribute("success", mrit->success ? "true" : "false");
+ eResult->SetAttribute("fresh_built", mrit->fresh_built ? "true" : "false");
+
+ root->LinkEndChild(eResult);
+ } else if (mrit->mr_type == ManifestResult::DATABASE) {
+ TiXmlElement* eResult = new TiXmlElement("DatabaseResult");
std::vector<Item>::const_iterator itemit;
- for( itemit = mrit->items.begin(); itemit != mrit->items.end(); itemit++ )
- {
- TiXmlElement* eItem = new TiXmlElement( "Item" );
+ for (itemit = mrit->items.begin(); itemit != mrit->items.end(); itemit++) {
+ TiXmlElement* eItem = new TiXmlElement("Item");
- eItem->SetAttribute( "path", itemit->GetPath().c_str() );
- eItem->SetAttribute( "type", itemit->type.c_str() );
- eItem->SetAttribute( "hash", itemit->hash.c_str() );
+ eItem->SetAttribute("path", itemit->GetPath().c_str());
+ eItem->SetAttribute("type", itemit->type.c_str());
+ eItem->SetAttribute("hash", itemit->hash.c_str());
- eResult->LinkEndChild( eItem );
+ eResult->LinkEndChild(eItem);
}
-
- eResult->SetAttribute( "dest", mrit->dest.c_str() );
- eResult->SetAttribute( "dest_hash", mrit->dest_hash.c_str() );
- eResult->SetAttribute( "builder", mrit->name.c_str() );
- eResult->SetAttribute( "builder_version", mrit->version.c_str() );
- eResult->SetAttribute( "type", mrit->type.c_str() );
-
- root->LinkEndChild( eResult );
- }
- else if( mrit->mr_type == ManifestResult::GENERATED )
- {
- TiXmlElement* eResult = new TiXmlElement( "GeneratorResult" );
-
- eResult->SetAttribute( "dest", mrit->dest.c_str() );
- eResult->SetAttribute( "dest_hash", mrit->dest_hash.c_str() );
- eResult->SetAttribute( "generator", mrit->name.c_str() );
- eResult->SetAttribute( "generator_version", mrit->version.c_str() );
- eResult->SetAttribute( "typ", mrit->type.c_str() );
- eResult->SetAttribute( "success", mrit->success ? "true" : "false" );
- eResult->SetAttribute( "fresh_built", mrit->fresh_built ? "true" : "false" );
-
- root->LinkEndChild( eResult );
- }
- else
- {
+
+ eResult->SetAttribute("dest", mrit->dest.c_str());
+ eResult->SetAttribute("dest_hash", mrit->dest_hash.c_str());
+ eResult->SetAttribute("builder", mrit->name.c_str());
+ eResult->SetAttribute("builder_version", mrit->version.c_str());
+ eResult->SetAttribute("type", mrit->type.c_str());
+
+ root->LinkEndChild(eResult);
+ } else if (mrit->mr_type == ManifestResult::GENERATED) {
+ TiXmlElement* eResult = new TiXmlElement("GeneratorResult");
+
+ eResult->SetAttribute("dest", mrit->dest.c_str());
+ eResult->SetAttribute("dest_hash", mrit->dest_hash.c_str());
+ eResult->SetAttribute("generator", mrit->name.c_str());
+ eResult->SetAttribute("generator_version", mrit->version.c_str());
+ eResult->SetAttribute("typ", mrit->type.c_str());
+ eResult->SetAttribute("success", mrit->success ? "true" : "false");
+ eResult->SetAttribute("fresh_built", mrit->fresh_built ? "true" : "false");
+
+ root->LinkEndChild(eResult);
+ } else {
LOGE << "Unknown ManifestResult type" << std::endl;
}
}
- doc.LinkEndChild( decl );
- doc.LinkEndChild( root );
- doc.SaveFile( manifest.c_str() );
+ doc.LinkEndChild(decl);
+ doc.LinkEndChild(root);
+ doc.SaveFile(manifest.c_str());
return !doc.Error();
}
-void Manifest::AddResult( const ManifestResult& a ) {
+void Manifest::AddResult(const ManifestResult& a) {
results.push_back(a);
std::vector<Item>::const_iterator itemit;
- for( itemit = a.items.begin(); itemit != a.items.end(); itemit++ ) {
+ for (itemit = a.items.begin(); itemit != a.items.end(); itemit++) {
hash_set.insert(itemit->GetSubHash());
}
}
-bool Manifest::HasError()
-{
+bool Manifest::HasError() {
std::vector<ManifestResult>::const_iterator mrit;
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
- if( mrit->success == false )
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
+ if (mrit->success == false)
return true;
}
return false;
}
-std::vector<std::string> Manifest::GetDestinationFiles()
-{
+std::vector<std::string> Manifest::GetDestinationFiles() {
std::vector<std::string> values;
std::vector<ManifestResult>::const_iterator mrit;
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
- values.push_back( mrit->dest );
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
+ values.push_back(mrit->dest);
}
- return values;
+ return values;
}
-bool Manifest::IsUpToDate( JobHandler& jh, const Item& item, const Builder& builder )
-{
+bool Manifest::IsUpToDate(JobHandler& jh, const Item& item, const Builder& builder) {
std::vector<ManifestResult>::iterator mrit;
- if( hash_set.find(item.GetSubHash()) != hash_set.end() )
- {
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
- if( mrit->items.size() == 1 )
- {
- //First, check that it's the same item.
- //This "magically" includes the hash as item contains the hash value
- if( mrit->items[0] == item )
- {
- //Check that it's the same builder, one builder, one type of possible output file
- if( mrit->name == builder.GetBuilderName() )
- {
- //Check the builder version, to verify that the expected output wouldn't change.
- if( mrit->version == builder.GetBuilderVersion() )
- {
- //Check if the claimed destination file from the manifest differs from the file on disk according to hash
- //and that the hash isn't invalid
- if( mrit->GetCurrentDestHash(jh.output_folder) == mrit->dest_hash && mrit->dest_hash != std::string("") )
- {
+ if (hash_set.find(item.GetSubHash()) != hash_set.end()) {
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
+ if (mrit->items.size() == 1) {
+ // First, check that it's the same item.
+ // This "magically" includes the hash as item contains the hash value
+ if (mrit->items[0] == item) {
+ // Check that it's the same builder, one builder, one type of possible output file
+ if (mrit->name == builder.GetBuilderName()) {
+ // Check the builder version, to verify that the expected output wouldn't change.
+ if (mrit->version == builder.GetBuilderVersion()) {
+ // Check if the claimed destination file from the manifest differs from the file on disk according to hash
+ // and that the hash isn't invalid
+ if (mrit->GetCurrentDestHash(jh.output_folder) == mrit->dest_hash && mrit->dest_hash != std::string("")) {
return true;
}
}
- }
- }
- }
- else if( mrit->items.size() > 1 )
- {
+ }
+ }
+ } else if (mrit->items.size() > 1) {
LOGW << "System is not currently built to handle matching ManifestResults with more than one item" << std::endl;
}
}
@@ -405,52 +355,40 @@ bool Manifest::IsUpToDate( JobHandler& jh, const Item& item, const Builder& buil
return false;
}
-ManifestResult Manifest::GetPreviouslyBuiltResult(const Item& item, const Builder& builder)
-{
+ManifestResult Manifest::GetPreviouslyBuiltResult(const Item& item, const Builder& builder) {
std::vector<ManifestResult>::const_iterator mrit;
- for( mrit = results.begin(); mrit != results.end(); mrit++ )
- {
- if( mrit->items.size() == 1 )
- {
- //First, check that it's the same item.
- //This "magically" includes the hash as item contains the hash value
- if( mrit->items[0] == item )
- {
- //Check that it's the same builder, one builder, one type of possible output file
- if( mrit->name == builder.GetBuilderName() )
- {
- //This is mostly for sanity, but should never really evaluate to false as we already found the right builder and there is only one per name.
- //If this was false, that would mean we have changed the version of the builder and the asset we're looking for is actually outdated.
- //Meaning that previous checks and evalutation should have lead us to the conclusion to rebuild this item.
- if( mrit->version == builder.GetBuilderVersion() )
- {
+ for (mrit = results.begin(); mrit != results.end(); mrit++) {
+ if (mrit->items.size() == 1) {
+ // First, check that it's the same item.
+ // This "magically" includes the hash as item contains the hash value
+ if (mrit->items[0] == item) {
+ // Check that it's the same builder, one builder, one type of possible output file
+ if (mrit->name == builder.GetBuilderName()) {
+ // This is mostly for sanity, but should never really evaluate to false as we already found the right builder and there is only one per name.
+ // If this was false, that would mean we have changed the version of the builder and the asset we're looking for is actually outdated.
+ // Meaning that previous checks and evalutation should have lead us to the conclusion to rebuild this item.
+ if (mrit->version == builder.GetBuilderVersion()) {
return *mrit;
}
- }
- }
- }
- else if( mrit->items.size() > 1 )
- {
+ }
+ }
+ } else if (mrit->items.size() > 1) {
LOGW << "System is not currently built to handle matching ManifestResults with more than one item" << std::endl;
}
}
throw "Big error";
}
-
-void Manifest::PrecalculateCurrentDestinationHashes( const std::string& dest_path )
-{
+void Manifest::PrecalculateCurrentDestinationHashes(const std::string& dest_path) {
ManifestThreadPool mtp(thread);
mtp.RunHashCalculation(dest_path, results);
}
-std::vector<ManifestResult>::const_iterator Manifest::ResultsBegin() const
-{
+std::vector<ManifestResult>::const_iterator Manifest::ResultsBegin() const {
return results.begin();
}
-std::vector<ManifestResult>::const_iterator Manifest::ResultsEnd() const
-{
+std::vector<ManifestResult>::const_iterator Manifest::ResultsEnd() const {
return results.end();
}
diff --git a/Source/Ogda/manifest.h b/Source/Ogda/manifest.h
index 4b9f747b..4dd22c53 100644
--- a/Source/Ogda/manifest.h
+++ b/Source/Ogda/manifest.h
@@ -30,25 +30,25 @@ class JobHandler;
class Builder;
class Item;
-class Manifest
-{
+class Manifest {
int thread;
std::vector<ManifestResult> results;
std::set<uint64_t> hash_set;
-public:
+
+ public:
Manifest(int thread);
bool Load(const std::string& manifest);
bool Save(const std::string& manifest);
- void AddResult( const ManifestResult& results );
+ void AddResult(const ManifestResult& results);
bool HasError();
std::vector<std::string> GetDestinationFiles();
- bool IsUpToDate( JobHandler& jh, const Item& item, const Builder& builder );
- ManifestResult GetPreviouslyBuiltResult( const Item& item, const Builder& builder);
+ bool IsUpToDate(JobHandler& jh, const Item& item, const Builder& builder);
+ ManifestResult GetPreviouslyBuiltResult(const Item& item, const Builder& builder);
- void PrecalculateCurrentDestinationHashes( const std::string& dest_path );
+ void PrecalculateCurrentDestinationHashes(const std::string& dest_path);
- std::vector<ManifestResult>::const_iterator ResultsBegin() const;
- std::vector<ManifestResult>::const_iterator ResultsEnd() const;
+ std::vector<ManifestResult>::const_iterator ResultsBegin() const;
+ std::vector<ManifestResult>::const_iterator ResultsEnd() const;
};
diff --git a/Source/Ogda/manifestresult.cpp b/Source/Ogda/manifestresult.cpp
index fd84111d..e91112c1 100644
--- a/Source/Ogda/manifestresult.cpp
+++ b/Source/Ogda/manifestresult.cpp
@@ -30,55 +30,47 @@
#include <Ogda/Generators/creatorbase.h>
#include <Ogda/ogda_hash.h>
-ManifestResult::ManifestResult( const JobHandler& jh, const std::string& dest, bool success, const CreatorBase& creator, const std::string& type )
-: dest(dest), success(success), name(creator.GetName()), version(creator.GetVersion()), fresh_built(true), mr_type(GENERATED), type(type)
-{
+ManifestResult::ManifestResult(const JobHandler& jh, const std::string& dest, bool success, const CreatorBase& creator, const std::string& type)
+ : dest(dest), success(success), name(creator.GetName()), version(creator.GetVersion()), fresh_built(true), mr_type(GENERATED), type(type) {
std::string full_dest_path = AssemblePath(jh.output_folder, dest);
dest_hash = OgdaGetFileHash(full_dest_path.c_str());
}
-ManifestResult::ManifestResult( const JobHandler& jh, const Item& item, const std::string& dest, bool success, const ActionBase& action, const std::string& type )
-: dest(dest), success(success), name(action.GetName()), version(action.GetVersion()), fresh_built(true), mr_type(BUILT), type(type)
-{
+ManifestResult::ManifestResult(const JobHandler& jh, const Item& item, const std::string& dest, bool success, const ActionBase& action, const std::string& type)
+ : dest(dest), success(success), name(action.GetName()), version(action.GetVersion()), fresh_built(true), mr_type(BUILT), type(type) {
items.push_back(item);
std::string full_dest_path = AssemblePath(jh.output_folder, dest);
dest_hash = OgdaGetFileHash(full_dest_path.c_str());
}
-ManifestResult::ManifestResult( const std::string& dest_hash, const std::vector<Item>& items, const std::string& dest, bool success, const std::string& name, const std::string& version, const ManifestResultType mr_type, const std::string& type )
-: items(items), dest(dest), success(success), dest_hash(dest_hash), name(name), version(version), fresh_built(false), mr_type(mr_type), type(type)
-{
+ManifestResult::ManifestResult(const std::string& dest_hash, const std::vector<Item>& items, const std::string& dest, bool success, const std::string& name, const std::string& version, const ManifestResultType mr_type, const std::string& type)
+ : items(items), dest(dest), success(success), dest_hash(dest_hash), name(name), version(version), fresh_built(false), mr_type(mr_type), type(type) {
}
-ManifestResult::ManifestResult( const std::string& dest_hash, Item& item, const std::string& dest, bool success, const std::string& name, const std::string& version, const ManifestResultType mr_type, const std::string& type )
-: dest(dest), success(success), dest_hash(dest_hash), name(name), version(version), fresh_built(false), mr_type(mr_type), type(type)
-{
+ManifestResult::ManifestResult(const std::string& dest_hash, Item& item, const std::string& dest, bool success, const std::string& name, const std::string& version, const ManifestResultType mr_type, const std::string& type)
+ : dest(dest), success(success), dest_hash(dest_hash), name(name), version(version), fresh_built(false), mr_type(mr_type), type(type) {
items.push_back(item);
}
-ManifestResult::ManifestResult( const std::string& dest_hash, const std::string& dest, bool success, const std::string& name, const std::string& version, const ManifestResultType mr_type, const std::string& type )
-: dest(dest), success(success), dest_hash(dest_hash), name(name), version(version), fresh_built(false), mr_type(mr_type), type(type)
-{
+ManifestResult::ManifestResult(const std::string& dest_hash, const std::string& dest, bool success, const std::string& name, const std::string& version, const ManifestResultType mr_type, const std::string& type)
+ : dest(dest), success(success), dest_hash(dest_hash), name(name), version(version), fresh_built(false), mr_type(mr_type), type(type) {
}
-void ManifestResult::CalculateHash(const char* base_path)
-{
- current_dest_hash = GetFileHash(AssemblePath(std::string(base_path),dest).c_str()).ToString();
+void ManifestResult::CalculateHash(const char* base_path) {
+ current_dest_hash = GetFileHash(AssemblePath(std::string(base_path), dest).c_str()).ToString();
}
-const std::string& ManifestResult::GetCurrentDestHash(const std::string& base_path)
-{
- if( current_dest_hash.empty() )
+const std::string& ManifestResult::GetCurrentDestHash(const std::string& base_path) {
+ if (current_dest_hash.empty())
CalculateHash(base_path.c_str());
return current_dest_hash;
}
std::ostream& operator<<(std::ostream& out, const ManifestResult& mr) {
-
out << "ManifestResult( items { ";
- for(const auto & item : mr.items) {
- out << item << ",";
- }
+ for (const auto& item : mr.items) {
+ out << item << ",";
+ }
out << "}," << mr.dest << "," << mr.dest_hash << "," << mr.name << "," << mr.version << "," << mr.type << ")";
return out;
}
diff --git a/Source/Ogda/manifestresult.h b/Source/Ogda/manifestresult.h
index a73ea0cd..2d11f053 100644
--- a/Source/Ogda/manifestresult.h
+++ b/Source/Ogda/manifestresult.h
@@ -29,25 +29,23 @@ class ActionBase;
class CreatorBase;
class JobHandler;
-class ManifestResult
-{
-private:
+class ManifestResult {
+ private:
std::string current_dest_hash;
-public:
- enum ManifestResultType
- {
+ public:
+ enum ManifestResultType {
GENERATED,
BUILT,
DATABASE
} mr_type;
- ManifestResult( const JobHandler& jh, const std::string& dest, bool success, const CreatorBase& creator, const std::string& type );
- ManifestResult( const JobHandler& jh, const Item& item, const std::string& dest, bool success, const ActionBase& action, const std::string& type );
+ ManifestResult(const JobHandler& jh, const std::string& dest, bool success, const CreatorBase& creator, const std::string& type);
+ ManifestResult(const JobHandler& jh, const Item& item, const std::string& dest, bool success, const ActionBase& action, const std::string& type);
- ManifestResult( const std::string& dest_hash, const std::vector<Item>& items, const std::string& dest, bool success, const std::string& builder, const std::string& builder_version, const ManifestResultType mr_type, const std::string& type );
- ManifestResult( const std::string& dest_hash, Item& item, const std::string& dest, bool success, const std::string& name, const std::string& version, const ManifestResultType mr_type, const std::string& type );
- ManifestResult( const std::string& dest_hash, const std::string& dest, bool success, const std::string& builder, const std::string& builder_version, const ManifestResultType mr_type, const std::string& type );
+ ManifestResult(const std::string& dest_hash, const std::vector<Item>& items, const std::string& dest, bool success, const std::string& builder, const std::string& builder_version, const ManifestResultType mr_type, const std::string& type);
+ ManifestResult(const std::string& dest_hash, Item& item, const std::string& dest, bool success, const std::string& name, const std::string& version, const ManifestResultType mr_type, const std::string& type);
+ ManifestResult(const std::string& dest_hash, const std::string& dest, bool success, const std::string& builder, const std::string& builder_version, const ManifestResultType mr_type, const std::string& type);
void CalculateHash(const char* base_path);
const std::string& GetCurrentDestHash(const std::string& base_path);
@@ -55,18 +53,18 @@ public:
std::string dest;
std::string dest_hash;
- std::string name; //Either creator or action
- std::string version; //Either creator or action
+ std::string name; // Either creator or action
+ std::string version; // Either creator or action
std::string type;
- //Only in built data does this come in as relevant.
- //And even then, we don't have support for more than one source at this time.
+ // Only in built data does this come in as relevant.
+ // And even then, we don't have support for more than one source at this time.
std::vector<Item> items;
bool success;
bool fresh_built;
- friend std::ostream& operator<<(std::ostream& out, const ManifestResult& item);
+ friend std::ostream& operator<<(std::ostream& out, const ManifestResult& item);
};
-std::ostream& operator<<(std::ostream& out, const ManifestResult& item);
+std::ostream& operator<<(std::ostream& out, const ManifestResult& item);
diff --git a/Source/Ogda/manifestthreadpool.cpp b/Source/Ogda/manifestthreadpool.cpp
index c89d8e3d..ec06c7ed 100644
--- a/Source/Ogda/manifestthreadpool.cpp
+++ b/Source/Ogda/manifestthreadpool.cpp
@@ -33,8 +33,7 @@
#include <unistd.h>
#endif
-struct ManifestResultJob
-{
+struct ManifestResultJob {
const char* base_path;
ManifestResult* item;
int step;
@@ -42,80 +41,68 @@ struct ManifestResultJob
volatile int performed;
};
-static void* CalculateManifestResultHash( void* item )
-{
- ManifestResultJob* ij = static_cast<ManifestResultJob*>(item);
+static void* CalculateManifestResultHash(void* item) {
+ ManifestResultJob* ij = static_cast<ManifestResultJob*>(item);
ij->performed = 0;
- for( int i = 0; i < ij->count; i++ )
- {
- ij->item[i*ij->step].CalculateHash(ij->base_path);
+ for (int i = 0; i < ij->count; i++) {
+ ij->item[i * ij->step].CalculateHash(ij->base_path);
ij->performed++;
}
return 0;
}
-ManifestThreadPool::ManifestThreadPool( int thread_count ) : thread_count(thread_count)
-{
- threads = static_cast<pthread_t*>(OG_MALLOC( sizeof(pthread_t) * thread_count ));
+ManifestThreadPool::ManifestThreadPool(int thread_count) : thread_count(thread_count) {
+ threads = static_cast<pthread_t*>(OG_MALLOC(sizeof(pthread_t) * thread_count));
}
-ManifestThreadPool::~ManifestThreadPool()
-{
+ManifestThreadPool::~ManifestThreadPool() {
OG_FREE(threads);
}
-void ManifestThreadPool::RunHashCalculation(const std::string& base_path, std::vector<ManifestResult>& arr)
-{
- ManifestResultJob* itemjobs = static_cast<ManifestResultJob*>(OG_MALLOC(sizeof(ManifestResultJob)*thread_count));
-
- int step = arr.size()/thread_count;
+void ManifestThreadPool::RunHashCalculation(const std::string& base_path, std::vector<ManifestResult>& arr) {
+ ManifestResultJob* itemjobs = static_cast<ManifestResultJob*>(OG_MALLOC(sizeof(ManifestResultJob) * thread_count));
- for( int i = 0; i < thread_count; i++ )
- {
+ int step = arr.size() / thread_count;
+
+ for (int i = 0; i < thread_count; i++) {
itemjobs[i].item = &arr[i];
itemjobs[i].step = thread_count;
itemjobs[i].count = step;
itemjobs[i].base_path = base_path.c_str();
- int err = pthread_create( &threads[i], NULL, CalculateManifestResultHash, &itemjobs[i]);
+ int err = pthread_create(&threads[i], NULL, CalculateManifestResultHash, &itemjobs[i]);
- if( err != 0 )
- {
+ if (err != 0) {
LOGE << "Thread create failed" << std::endl;
}
}
- //Do the remaining items in our main thread.
- for( int i = step*thread_count; i < arr.size(); i++ )
- {
+ // Do the remaining items in our main thread.
+ for (int i = step * thread_count; i < arr.size(); i++) {
arr[i].CalculateHash(base_path.c_str());
}
int count = 0;
- while( count < arr.size() )
- {
+ while (count < arr.size()) {
#ifdef PLATFORM_LINUX
sleep(1);
#endif
std::stringstream ss;
- count = arr.size()-step*thread_count;
- for( int i = 0; i < thread_count; i++ )
- {
+ count = arr.size() - step * thread_count;
+ for (int i = 0; i < thread_count; i++) {
count += itemjobs[i].performed;
ss << ((itemjobs[i].performed == itemjobs[i].count) ? "d" : ".");
}
- SetPercent(ss.str().c_str(), (int)(100.0f*((float)count/(float)arr.size())));
+ SetPercent(ss.str().c_str(), (int)(100.0f * ((float)count / (float)arr.size())));
}
- for( int i = 0; i < thread_count; i++ )
- {
- void* retval;
- int err = pthread_join( threads[i], &retval );
+ for (int i = 0; i < thread_count; i++) {
+ void* retval;
+ int err = pthread_join(threads[i], &retval);
- if( err != 0 )
- {
+ if (err != 0) {
LOGE << "Thread join failed" << std::endl;
}
}
- OG_FREE( itemjobs );
+ OG_FREE(itemjobs);
}
diff --git a/Source/Ogda/manifestthreadpool.h b/Source/Ogda/manifestthreadpool.h
index ff8da984..aa85adfe 100644
--- a/Source/Ogda/manifestthreadpool.h
+++ b/Source/Ogda/manifestthreadpool.h
@@ -27,13 +27,13 @@
#include <vector>
#include "manifestresult.h"
-class ManifestThreadPool
-{
-private:
+class ManifestThreadPool {
+ private:
pthread_t* threads;
int thread_count;
-public:
- ManifestThreadPool(int thread_count);
+
+ public:
+ ManifestThreadPool(int thread_count);
~ManifestThreadPool();
void RunHashCalculation(const std::string& base_path, std::vector<ManifestResult>& arr);
diff --git a/Source/Ogda/ogda_hash.cpp b/Source/Ogda/ogda_hash.cpp
index ef045ee3..b0fd3bd8 100644
--- a/Source/Ogda/ogda_hash.cpp
+++ b/Source/Ogda/ogda_hash.cpp
@@ -29,16 +29,12 @@
#include <Internal/datemodified.h>
#include <Ogda/ogda_config.h>
-std::string OgdaGetFileHash(std::string path)
-{
- if( config_use_date_modified_as_hash )
- {
+std::string OgdaGetFileHash(std::string path) {
+ if (config_use_date_modified_as_hash) {
std::stringstream ss;
ss << GetDateModifiedInt64(path.c_str());
return ss.str();
- }
- else
- {
+ } else {
return GetFileHash(path.c_str()).ToString();
}
}
diff --git a/Source/Ogda/readerbase.h b/Source/Ogda/readerbase.h
index 20f6514e..a7064508 100644
--- a/Source/Ogda/readerbase.h
+++ b/Source/Ogda/readerbase.h
@@ -22,7 +22,5 @@
//-----------------------------------------------------------------------------
#pragma once
-class ReaderBase
-{
-
+class ReaderBase {
};