mirror of
https://github.com/jakcron/nstool.git
synced 2024-12-22 10:45:28 +00:00
[nstool] Add SdkApiString
This commit is contained in:
parent
926e494fd7
commit
7a09be650f
87
programs/nstool/source/SdkApiString.cpp
Normal file
87
programs/nstool/source/SdkApiString.cpp
Normal file
|
@ -0,0 +1,87 @@
|
|||
#include <sstream>
|
||||
#include "SdkApiString.h"
|
||||
|
||||
SdkApiString::SdkApiString(const std::string& full_str) :
|
||||
SdkApiString(API_MIDDLEWARE, "", "")
|
||||
{
|
||||
resolveApiString(full_str);
|
||||
}
|
||||
|
||||
SdkApiString::SdkApiString(ApiType type, const std::string& vender_name, const std::string& module_name) :
|
||||
mApiType(type),
|
||||
mVenderName(vender_name),
|
||||
mModuleName(module_name)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void SdkApiString::operator=(const SdkApiString& other)
|
||||
{
|
||||
mApiType = other.mApiType;
|
||||
mVenderName = other.mVenderName;
|
||||
mModuleName = other.mModuleName;
|
||||
}
|
||||
|
||||
SdkApiString::ApiType SdkApiString::getApiType() const
|
||||
{
|
||||
return mApiType;
|
||||
}
|
||||
|
||||
void SdkApiString::setApiType(ApiType type)
|
||||
{
|
||||
mApiType = type;
|
||||
}
|
||||
|
||||
const std::string& SdkApiString::getVenderName() const
|
||||
{
|
||||
return mVenderName;
|
||||
}
|
||||
|
||||
void SdkApiString::setVenderName(const std::string& name)
|
||||
{
|
||||
mVenderName = name;
|
||||
}
|
||||
|
||||
const std::string& SdkApiString::getModuleName() const
|
||||
{
|
||||
return mModuleName;
|
||||
}
|
||||
|
||||
void SdkApiString::setModuleName(const std::string& name)
|
||||
{
|
||||
mModuleName = name;
|
||||
}
|
||||
|
||||
void SdkApiString::resolveApiString(const std::string& full_str)
|
||||
{
|
||||
std::stringstream list_stream(full_str);
|
||||
std::string api_type, vender, module;
|
||||
|
||||
std::getline(list_stream, api_type, kSplitChar);
|
||||
std::getline(list_stream, vender, kSplitChar);
|
||||
std::getline(list_stream, module);
|
||||
|
||||
|
||||
if (api_type == kSdkMiddleWareApiString)
|
||||
{
|
||||
if (vender == kVenderNintendo && module.find(kSdkVersionString) != std::string::npos)
|
||||
{
|
||||
mApiType = API_SDK_VERSION;
|
||||
}
|
||||
else
|
||||
{
|
||||
mApiType = API_MIDDLEWARE;
|
||||
}
|
||||
}
|
||||
else if (api_type == kSdkDebugApiString)
|
||||
{
|
||||
mApiType = API_DEBUG;
|
||||
}
|
||||
else if (api_type == kSdkPrivateApiString)
|
||||
{
|
||||
mApiType = API_PRIVATE;
|
||||
}
|
||||
|
||||
mVenderName = vender;
|
||||
mModuleName = module;
|
||||
}
|
43
programs/nstool/source/SdkApiString.h
Normal file
43
programs/nstool/source/SdkApiString.h
Normal file
|
@ -0,0 +1,43 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
|
||||
class SdkApiString
|
||||
{
|
||||
public:
|
||||
enum ApiType
|
||||
{
|
||||
API_MIDDLEWARE,
|
||||
API_DEBUG,
|
||||
API_PRIVATE,
|
||||
API_SDK_VERSION
|
||||
};
|
||||
|
||||
SdkApiString(const std::string& full_str);
|
||||
SdkApiString(ApiType type, const std::string& vender_name, const std::string& module_name);
|
||||
|
||||
void operator=(const SdkApiString& other);
|
||||
|
||||
ApiType getApiType() const;
|
||||
void setApiType(ApiType type);
|
||||
|
||||
const std::string& getVenderName() const;
|
||||
void setVenderName(const std::string& name);
|
||||
|
||||
const std::string& getModuleName() const;
|
||||
void setModuleName(const std::string& name);
|
||||
private:
|
||||
const std::string kModuleName = "SdkApiString";
|
||||
|
||||
const char kSplitChar = '+';
|
||||
const std::string kSdkMiddleWareApiString = "SDK MW";
|
||||
const std::string kSdkDebugApiString = "SDK Debug";
|
||||
const std::string kSdkPrivateApiString = "SDK Private";
|
||||
const std::string kVenderNintendo = "Nintendo";
|
||||
const std::string kSdkVersionString = "NintendoSdk_nnSdk-";
|
||||
|
||||
ApiType mApiType;
|
||||
std::string mVenderName;
|
||||
std::string mModuleName;
|
||||
|
||||
void resolveApiString(const std::string& full_str);
|
||||
};
|
Loading…
Reference in a new issue