GetResourceType -> GetClass, GetResourceType -> GetType

This commit is contained in:
casey langen 2017-10-01 15:59:45 -07:00
parent fddb7ca114
commit d87d3f3f2c
7 changed files with 22 additions and 16 deletions

View File

@ -56,13 +56,13 @@ namespace {
SdkWrapper(MetadataMapPtr wrapped) { this->wrapped = wrapped; }; SdkWrapper(MetadataMapPtr wrapped) { this->wrapped = wrapped; };
virtual void Release() { this->wrapped.reset(); } virtual void Release() { this->wrapped.reset(); }
virtual int64_t GetId() { return this->wrapped->GetId(); } virtual int64_t GetId() { return this->wrapped->GetId(); }
virtual ResourceType GetResourceType() { return this->wrapped->GetResourceType(); } virtual IResource::Class GetClass() { return this->wrapped->GetClass(); }
virtual int GetString(const char* key, char* dst, int size) { return this->wrapped->GetString(key, dst, size); } virtual int GetString(const char* key, char* dst, int size) { return this->wrapped->GetString(key, dst, size); }
virtual long long GetInt64(const char* key, long long defaultValue) { return this->wrapped->GetInt64(key, defaultValue); } virtual long long GetInt64(const char* key, long long defaultValue) { return this->wrapped->GetInt64(key, defaultValue); }
virtual int GetInt32(const char* key, unsigned int defaultValue) { return this->wrapped->GetInt32(key, defaultValue); } virtual int GetInt32(const char* key, unsigned int defaultValue) { return this->wrapped->GetInt32(key, defaultValue); }
virtual double GetDouble(const char* key, double defaultValue) { return this->wrapped->GetDouble(key, defaultValue); } virtual double GetDouble(const char* key, double defaultValue) { return this->wrapped->GetDouble(key, defaultValue); }
virtual int GetValue(char* dst, size_t size) { return this->wrapped->GetValue(dst, size); } virtual int GetValue(char* dst, size_t size) { return this->wrapped->GetValue(dst, size); }
virtual const char* GetDataType() { return this->wrapped->GetDataType(); } virtual const char* GetType() { return this->wrapped->GetType(); }
MetadataMapPtr wrapped; MetadataMapPtr wrapped;
}; };
} }
@ -89,8 +89,8 @@ int64_t MetadataMap::GetId() {
return this->id; return this->id;
} }
ResourceType MetadataMap::GetResourceType() { musik::core::sdk::IResource::Class MetadataMap::GetClass() {
return ResourceType::Map; return musik::core::sdk::IResource::Class::Map;
} }
int MetadataMap::GetString(const char* key, char* dst, int size) { int MetadataMap::GetString(const char* key, char* dst, int size) {
@ -154,7 +154,7 @@ int MetadataMap::GetValue(char* dst, size_t size) {
return CopyString(this->value, dst, size); return CopyString(this->value, dst, size);
} }
const char* MetadataMap::GetDataType() { const char* MetadataMap::GetType() {
return this->type.c_str(); return this->type.c_str();
} }

View File

@ -55,7 +55,8 @@ namespace musik { namespace core {
/* IResource */ /* IResource */
virtual int64_t GetId(); virtual int64_t GetId();
virtual musik::core::sdk::ResourceType GetResourceType(); virtual musik::core::sdk::IResource::Class GetClass();
virtual const char* GetType();
/* IValue */ /* IValue */
virtual int GetValue(char* dst, size_t size); virtual int GetValue(char* dst, size_t size);
@ -66,7 +67,6 @@ namespace musik { namespace core {
virtual long long GetInt64(const char* key, long long defaultValue = 0LL); virtual long long GetInt64(const char* key, long long defaultValue = 0LL);
virtual int GetInt32(const char* key, unsigned int defaultValue = 0); virtual int GetInt32(const char* key, unsigned int defaultValue = 0);
virtual double GetDouble(const char* key, double defaultValue = 0.0f); virtual double GetDouble(const char* key, double defaultValue = 0.0f);
virtual const char* GetDataType();
/* implementation specific */ /* implementation specific */
void SetValue(const char* key, const std::string& value); void SetValue(const char* key, const std::string& value);

View File

@ -204,6 +204,7 @@ bool CategoryListQuery::OnRun(Connection& db) {
std::shared_ptr<Result> row(new Result()); std::shared_ptr<Result> row(new Result());
row->id = stmt.ColumnInt64(0); row->id = stmt.ColumnInt64(0);
row->displayValue = stmt.ColumnText(1); row->displayValue = stmt.ColumnText(1);
row->type = this->trackField;
result->push_back(row); result->push_back(row);
} }

View File

@ -51,8 +51,12 @@ namespace musik { namespace core { namespace db { namespace local {
return this->id; return this->id;
} }
virtual musik::core::sdk::ResourceType GetResourceType() { virtual musik::core::sdk::IResource::Class GetClass() {
return musik::core::sdk::ResourceType::Value; return musik::core::sdk::IResource::Class::Value;
}
virtual const char* GetType() {
return this->type.c_str();
} }
virtual int GetValue(char* dst, size_t size) { virtual int GetValue(char* dst, size_t size) {
@ -60,6 +64,7 @@ namespace musik { namespace core { namespace db { namespace local {
} }
std::string displayValue; std::string displayValue;
std::string type;
int64_t id; int64_t id;
}; };

View File

@ -45,7 +45,6 @@ namespace musik { namespace core { namespace sdk {
virtual long long GetInt64(const char* key, long long defaultValue = 0LL) = 0; virtual long long GetInt64(const char* key, long long defaultValue = 0LL) = 0;
virtual int GetInt32(const char* key, unsigned int defaultValue = 0) = 0; virtual int GetInt32(const char* key, unsigned int defaultValue = 0) = 0;
virtual double GetDouble(const char* key, double defaultValue = 0.0f) = 0; virtual double GetDouble(const char* key, double defaultValue = 0.0f) = 0;
virtual const char* GetDataType() = 0;
}; };
} } } } } }

View File

@ -41,8 +41,14 @@ namespace musik { namespace core { namespace sdk {
class IResource { class IResource {
public: public:
enum class Class {
Value,
Map
};
virtual int64_t GetId() = 0; virtual int64_t GetId() = 0;
virtual ResourceType GetResourceType() = 0; virtual Class GetClass() = 0;
virtual const char* GetType() = 0;
}; };
} } } } } }

View File

@ -101,11 +101,6 @@ namespace musik {
ScanRollback ScanRollback
}; };
enum class ResourceType {
Value,
Map
};
namespace category { namespace category {
static const char* Album = "album"; static const char* Album = "album";
static const char* Artist = "artist"; static const char* Artist = "artist";