1
0
mirror of https://github.com/clangen/musikcube.git synced 2025-02-23 18:40:02 +00:00

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

@ -56,13 +56,13 @@ namespace {
SdkWrapper(MetadataMapPtr wrapped) { this->wrapped = wrapped; };
virtual void Release() { this->wrapped.reset(); }
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 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 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 const char* GetDataType() { return this->wrapped->GetDataType(); }
virtual const char* GetType() { return this->wrapped->GetType(); }
MetadataMapPtr wrapped;
};
}
@ -89,8 +89,8 @@ int64_t MetadataMap::GetId() {
return this->id;
}
ResourceType MetadataMap::GetResourceType() {
return ResourceType::Map;
musik::core::sdk::IResource::Class MetadataMap::GetClass() {
return musik::core::sdk::IResource::Class::Map;
}
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);
}
const char* MetadataMap::GetDataType() {
const char* MetadataMap::GetType() {
return this->type.c_str();
}

@ -55,7 +55,8 @@ namespace musik { namespace core {
/* IResource */
virtual int64_t GetId();
virtual musik::core::sdk::ResourceType GetResourceType();
virtual musik::core::sdk::IResource::Class GetClass();
virtual const char* GetType();
/* IValue */
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 int GetInt32(const char* key, unsigned int defaultValue = 0);
virtual double GetDouble(const char* key, double defaultValue = 0.0f);
virtual const char* GetDataType();
/* implementation specific */
void SetValue(const char* key, const std::string& value);

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

@ -51,8 +51,12 @@ namespace musik { namespace core { namespace db { namespace local {
return this->id;
}
virtual musik::core::sdk::ResourceType GetResourceType() {
return musik::core::sdk::ResourceType::Value;
virtual musik::core::sdk::IResource::Class GetClass() {
return musik::core::sdk::IResource::Class::Value;
}
virtual const char* GetType() {
return this->type.c_str();
}
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 type;
int64_t id;
};

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

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

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