hueplusplus
1.0.0
|
Handles a group list with the special group 0. More...
#include <hueplusplus/ResourceList.h>
Public Member Functions | |
Resource | get (const int &id) |
Get group, specially handles group 0. More... | |
bool | exists (int id) const |
Get group, specially handles group 0. More... | |
Public Member Functions inherited from hueplusplus::CreateableResourceList< ResourceList< Resource, int >, CreateType > | |
ResourceList< Resource, int > ::IdType | create (const CreateType ¶ms) |
Create a new resource. More... | |
Public Member Functions inherited from hueplusplus::ResourceList< Resource, int > | |
ResourceList (std::shared_ptr< APICache > baseCache, const std::string &cacheEntry, std::chrono::steady_clock::duration refreshDuration, bool sharedState=false, const std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> &factory=nullptr) | |
Construct ResourceList using a base cache and optional factory function. More... | |
ResourceList (const HueCommandAPI &commands, const std::string &path, std::chrono::steady_clock::duration refreshDuration, const std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> &factory=nullptr) | |
Construct ResourceList with a separate cache and optional factory function. More... | |
ResourceList (const ResourceList &)=delete | |
Deleted copy constructor. More... | |
ResourceList & | operator= (const ResourceList &)=delete |
Deleted copy assignment. More... | |
void | refresh () |
Refreshes internal state now. More... | |
void | setRefreshDuration (std::chrono::steady_clock::duration refreshDuration) |
Sets custom refresh interval for this list and all resources created. More... | |
std::vector< Resource > | getAll () |
Get all resources that exist. More... | |
Resource | get (const IdType &id) |
Get resource specified by id. More... | |
bool | exists (const IdType &id) |
Checks whether resource with id exists. More... | |
bool | exists (const IdType &id) const |
Checks whether resource with id exists. More... | |
bool | remove (const IdType &id) |
Removes the resource. More... | |
Protected Member Functions | |
GroupResourceList (GroupResourceList &&)=default | |
Protected defaulted move constructor. More... | |
GroupResourceList & | operator= (GroupResourceList &&)=default |
Protected defaulted move assignment. More... | |
Protected Member Functions inherited from hueplusplus::CreateableResourceList< ResourceList< Resource, int >, CreateType > | |
CreateableResourceList (CreateableResourceList &&)=default | |
Protected defaulted move constructor. More... | |
CreateableResourceList & | operator= (CreateableResourceList &&)=default |
Protected defaulted move assignment. More... | |
Protected Member Functions inherited from hueplusplus::ResourceList< Resource, int > | |
ResourceList (ResourceList &&)=default | |
Protected defaulted move constructor. More... | |
ResourceList & | operator= (ResourceList &&)=default |
Protected defaulted move assignment. More... | |
Resource | construct (const IdType &id, const nlohmann::json &state) |
Constructs resource using factory or constructor, if available. More... | |
Additional Inherited Members | |
Public Types inherited from hueplusplus::ResourceList< Resource, int > | |
using | ResourceType = Resource |
using | IdType = int |
Static Protected Member Functions inherited from hueplusplus::ResourceList< Resource, int > | |
static IdType | maybeStoi (const std::string &key) |
Calls std::stoi if IdType is int. More... | |
static std::string | maybeToString (const IdType &id) |
Calls std::to_string if IdType is int. More... | |
Protected Attributes inherited from hueplusplus::ResourceList< Resource, int > | |
std::shared_ptr< APICache > | stateCache |
std::function< Resource(IdType, const nlohmann::json &, const std::shared_ptr< APICache > &)> | factory |
std::string | path |
bool | sharedState |
Handles a group list with the special group 0.
Resource | Resource type that is in the list |
CreateType | Type that provides parameters for creation. Must have a const getRequest() function returning the JSON for the POST request. |
|
protecteddefault |
Protected defaulted move constructor.
|
inline |
Get group, specially handles group 0.
|
inline |
Get group, specially handles group 0.
|
protecteddefault |
Protected defaulted move assignment.