Utils: Rename ListHelper to ArrayHelper

This commit is contained in:
tt2468 2021-12-18 21:54:29 -08:00
parent 5cd1af426a
commit 1e6a60f545
12 changed files with 30 additions and 30 deletions

View File

@ -126,7 +126,7 @@ set(obs-websocket_SOURCES
src/utils/Obs_StringHelper.cpp
src/utils/Obs_EnumHelper.cpp
src/utils/Obs_NumberHelper.cpp
src/utils/Obs_ListHelper.cpp
src/utils/Obs_ArrayHelper.cpp
src/utils/Obs_ObjectHelper.cpp
src/utils/Obs_SearchHelper.cpp
src/utils/Obs_ActionHelper.cpp

View File

@ -80,7 +80,7 @@ void EventHandler::HandleCurrentSceneCollectionChanged()
void EventHandler::HandleSceneCollectionListChanged()
{
json eventData;
eventData["sceneCollections"] = Utils::Obs::ListHelper::GetSceneCollectionList();
eventData["sceneCollections"] = Utils::Obs::ArrayHelper::GetSceneCollectionList();
BroadcastEvent(EventSubscription::Config, "SceneCollectionListChanged", eventData);
}
@ -140,6 +140,6 @@ void EventHandler::HandleCurrentProfileChanged()
void EventHandler::HandleProfileListChanged()
{
json eventData;
eventData["profiles"] = Utils::Obs::ListHelper::GetProfileList();
eventData["profiles"] = Utils::Obs::ArrayHelper::GetProfileList();
BroadcastEvent(EventSubscription::Config, "ProfileListChanged", eventData);
}

View File

@ -70,7 +70,7 @@ void EventHandler::HandleSceneItemListReindexed(void *param, calldata_t *data)
json eventData;
eventData["sceneName"] = obs_source_get_name(obs_scene_get_source(scene));
eventData["sceneItems"] = Utils::Obs::ListHelper::GetSceneItemList(scene, true);
eventData["sceneItems"] = Utils::Obs::ArrayHelper::GetSceneItemList(scene, true);
eventHandler->BroadcastEvent(EventSubscription::SceneItems, "SceneItemListReindexed", eventData);
}

View File

@ -68,6 +68,6 @@ void EventHandler::HandleCurrentPreviewSceneChanged()
void EventHandler::HandleSceneListChanged()
{
json eventData;
eventData["scenes"] = Utils::Obs::ListHelper::GetSceneList();
eventData["scenes"] = Utils::Obs::ArrayHelper::GetSceneList();
BroadcastEvent(EventSubscription::Scenes, "SceneListChanged", eventData);
}

View File

@ -124,7 +124,7 @@ RequestResult RequestHandler::GetSceneCollectionList(const Request&)
{
json responseData;
responseData["currentSceneCollectionName"] = Utils::Obs::StringHelper::GetCurrentSceneCollection();
responseData["sceneCollections"] = Utils::Obs::ListHelper::GetSceneCollectionList();
responseData["sceneCollections"] = Utils::Obs::ArrayHelper::GetSceneCollectionList();
return RequestResult::Success(responseData);
}
@ -151,7 +151,7 @@ RequestResult RequestHandler::SetCurrentSceneCollection(const Request& request)
std::string sceneCollectionName = request.RequestData["sceneCollectionName"];
auto sceneCollections = Utils::Obs::ListHelper::GetSceneCollectionList();
auto sceneCollections = Utils::Obs::ArrayHelper::GetSceneCollectionList();
if (std::find(sceneCollections.begin(), sceneCollections.end(), sceneCollectionName) == sceneCollections.end())
return RequestResult::Error(RequestStatus::ResourceNotFound);
@ -189,7 +189,7 @@ RequestResult RequestHandler::CreateSceneCollection(const Request& request)
std::string sceneCollectionName = request.RequestData["sceneCollectionName"];
auto sceneCollections = Utils::Obs::ListHelper::GetSceneCollectionList();
auto sceneCollections = Utils::Obs::ArrayHelper::GetSceneCollectionList();
if (std::find(sceneCollections.begin(), sceneCollections.end(), sceneCollectionName) != sceneCollections.end())
return RequestResult::Error(RequestStatus::ResourceAlreadyExists);
@ -219,7 +219,7 @@ RequestResult RequestHandler::GetProfileList(const Request&)
{
json responseData;
responseData["currentProfileName"] = Utils::Obs::StringHelper::GetCurrentProfile();
responseData["profiles"] = Utils::Obs::ListHelper::GetProfileList();
responseData["profiles"] = Utils::Obs::ArrayHelper::GetProfileList();
return RequestResult::Success(responseData);
}
@ -244,7 +244,7 @@ RequestResult RequestHandler::SetCurrentProfile(const Request& request)
std::string profileName = request.RequestData["profileName"];
auto profiles = Utils::Obs::ListHelper::GetProfileList();
auto profiles = Utils::Obs::ArrayHelper::GetProfileList();
if (std::find(profiles.begin(), profiles.end(), profileName) == profiles.end())
return RequestResult::Error(RequestStatus::ResourceNotFound);
@ -280,7 +280,7 @@ RequestResult RequestHandler::CreateProfile(const Request& request)
std::string profileName = request.RequestData["profileName"];
auto profiles = Utils::Obs::ListHelper::GetProfileList();
auto profiles = Utils::Obs::ArrayHelper::GetProfileList();
if (std::find(profiles.begin(), profiles.end(), profileName) != profiles.end())
return RequestResult::Error(RequestStatus::ResourceAlreadyExists);
@ -311,7 +311,7 @@ RequestResult RequestHandler::RemoveProfile(const Request& request)
std::string profileName = request.RequestData["profileName"];
auto profiles = Utils::Obs::ListHelper::GetProfileList();
auto profiles = Utils::Obs::ArrayHelper::GetProfileList();
if (std::find(profiles.begin(), profiles.end(), profileName) == profiles.end())
return RequestResult::Error(RequestStatus::ResourceNotFound);

View File

@ -195,7 +195,7 @@ RequestResult RequestHandler::CallVendorRequest(const Request& request)
RequestResult RequestHandler::GetHotkeyList(const Request&)
{
json responseData;
responseData["hotkeys"] = Utils::Obs::ListHelper::GetHotkeyNameList();
responseData["hotkeys"] = Utils::Obs::ArrayHelper::GetHotkeyNameList();
return RequestResult::Success(responseData);
}

View File

@ -47,7 +47,7 @@ RequestResult RequestHandler::GetInputList(const Request& request)
}
json responseData;
responseData["inputs"] = Utils::Obs::ListHelper::GetInputList(inputKind);
responseData["inputs"] = Utils::Obs::ArrayHelper::GetInputList(inputKind);
return RequestResult::Success(responseData);
}
@ -79,7 +79,7 @@ RequestResult RequestHandler::GetInputKindList(const Request& request)
}
json responseData;
responseData["inputKinds"] = Utils::Obs::ListHelper::GetInputKindList(unversioned);
responseData["inputKinds"] = Utils::Obs::ArrayHelper::GetInputKindList(unversioned);
return RequestResult::Success(responseData);
}
@ -115,7 +115,7 @@ RequestResult RequestHandler::CreateInput(const Request& request)
return RequestResult::Error(RequestStatus::ResourceAlreadyExists, "A source already exists by that input name.");
std::string inputKind = request.RequestData["inputKind"];
auto kinds = Utils::Obs::ListHelper::GetInputKindList();
auto kinds = Utils::Obs::ArrayHelper::GetInputKindList();
if (std::find(kinds.begin(), kinds.end(), inputKind) == kinds.end())
return RequestResult::Error(RequestStatus::InvalidInputKind, "Your specified input kind is not supported by OBS. Check that your specified kind is properly versioned and that any necessary plugins are loaded.");

View File

@ -44,7 +44,7 @@ RequestResult RequestHandler::GetSceneItemList(const Request& request)
return RequestResult::Error(statusCode, comment);
json responseData;
responseData["sceneItems"] = Utils::Obs::ListHelper::GetSceneItemList(obs_scene_from_source(scene));
responseData["sceneItems"] = Utils::Obs::ArrayHelper::GetSceneItemList(obs_scene_from_source(scene));
return RequestResult::Success(responseData);
}
@ -76,7 +76,7 @@ RequestResult RequestHandler::GetGroupSceneItemList(const Request& request)
return RequestResult::Error(statusCode, comment);
json responseData;
responseData["sceneItems"] = Utils::Obs::ListHelper::GetSceneItemList(obs_group_from_source(scene));
responseData["sceneItems"] = Utils::Obs::ArrayHelper::GetSceneItemList(obs_group_from_source(scene));
return RequestResult::Success(responseData);
}

View File

@ -49,7 +49,7 @@ RequestResult RequestHandler::GetSceneList(const Request&)
else
responseData["currentPreviewSceneName"] = nullptr;
responseData["scenes"] = Utils::Obs::ListHelper::GetSceneList();
responseData["scenes"] = Utils::Obs::ArrayHelper::GetSceneList();
return RequestResult::Success(responseData);
}

View File

@ -111,7 +111,7 @@ namespace Utils {
size_t GetSceneCount();
}
namespace ListHelper {
namespace ArrayHelper {
std::vector<std::string> GetSceneCollectionList();
std::vector<std::string> GetProfileList();
std::vector<obs_hotkey_t *> GetHotkeyList();

View File

@ -40,7 +40,7 @@ static std::vector<std::string> ConvertStringArray(char **array)
return ret;
}
std::vector<std::string> Utils::Obs::ListHelper::GetSceneCollectionList()
std::vector<std::string> Utils::Obs::ArrayHelper::GetSceneCollectionList()
{
char** sceneCollections = obs_frontend_get_scene_collections();
auto ret = ConvertStringArray(sceneCollections);
@ -48,7 +48,7 @@ std::vector<std::string> Utils::Obs::ListHelper::GetSceneCollectionList()
return ret;
}
std::vector<std::string> Utils::Obs::ListHelper::GetProfileList()
std::vector<std::string> Utils::Obs::ArrayHelper::GetProfileList()
{
char** profiles = obs_frontend_get_profiles();
auto ret = ConvertStringArray(profiles);
@ -56,7 +56,7 @@ std::vector<std::string> Utils::Obs::ListHelper::GetProfileList()
return ret;
}
std::vector<obs_hotkey_t *> Utils::Obs::ListHelper::GetHotkeyList()
std::vector<obs_hotkey_t *> Utils::Obs::ArrayHelper::GetHotkeyList()
{
std::vector<obs_hotkey_t *> ret;
@ -71,7 +71,7 @@ std::vector<obs_hotkey_t *> Utils::Obs::ListHelper::GetHotkeyList()
return ret;
}
std::vector<std::string> Utils::Obs::ListHelper::GetHotkeyNameList()
std::vector<std::string> Utils::Obs::ArrayHelper::GetHotkeyNameList()
{
auto hotkeys = GetHotkeyList();
@ -82,7 +82,7 @@ std::vector<std::string> Utils::Obs::ListHelper::GetHotkeyNameList()
return ret;
}
std::vector<json> Utils::Obs::ListHelper::GetSceneList()
std::vector<json> Utils::Obs::ArrayHelper::GetSceneList()
{
obs_frontend_source_list sceneList = {};
obs_frontend_get_scenes(&sceneList);
@ -109,7 +109,7 @@ std::vector<json> Utils::Obs::ListHelper::GetSceneList()
return ret;
}
std::vector<json> Utils::Obs::ListHelper::GetSceneItemList(obs_scene_t *scene, bool basic)
std::vector<json> Utils::Obs::ArrayHelper::GetSceneItemList(obs_scene_t *scene, bool basic)
{
std::pair<std::vector<json>, bool> enumData;
enumData.second = basic;
@ -143,7 +143,7 @@ std::vector<json> Utils::Obs::ListHelper::GetSceneItemList(obs_scene_t *scene, b
return enumData.first;
}
std::vector<json> Utils::Obs::ListHelper::GetTransitionList()
std::vector<json> Utils::Obs::ArrayHelper::GetTransitionList()
{
obs_frontend_source_list transitionList = {};
obs_frontend_get_transitions(&transitionList);
@ -168,7 +168,7 @@ struct EnumInputInfo {
std::vector<json> inputs;
};
std::vector<json> Utils::Obs::ListHelper::GetInputList(std::string inputKind)
std::vector<json> Utils::Obs::ArrayHelper::GetInputList(std::string inputKind)
{
EnumInputInfo inputInfo;
inputInfo.inputKind = inputKind;
@ -199,7 +199,7 @@ std::vector<json> Utils::Obs::ListHelper::GetInputList(std::string inputKind)
return inputInfo.inputs;
}
std::vector<std::string> Utils::Obs::ListHelper::GetInputKindList(bool unversioned, bool includeDisabled)
std::vector<std::string> Utils::Obs::ArrayHelper::GetInputKindList(bool unversioned, bool includeDisabled)
{
std::vector<std::string> ret;

View File

@ -24,7 +24,7 @@ obs_hotkey_t *Utils::Obs::SearchHelper::GetHotkeyByName(std::string name)
if (name.empty())
return nullptr;
auto hotkeys = ListHelper::GetHotkeyList();
auto hotkeys = ArrayHelper::GetHotkeyList();
for (auto hotkey : hotkeys) {
if (obs_hotkey_get_name(hotkey) == name)