NDEVR
API Documentation
StateLookup.h
1#pragma once
2#include "DLLInfo.h"
3#include "Base/Headers/String.h"
4#include "Base/Headers/TranslatedString.h"
5#include "Design/Headers/DatasetManager.h"
6namespace NDEVR
7{
11 struct USState : public Dataset
12 {
15 virtual String name() const override
16 {
17 return String(m_abreviation);
18 }
19
21 virtual TranslatedString title() const override
22 {
23 return m_name;
24 }
25
28 USState(const TranslatedString& name, const char(&abv)[3])
29 : m_abreviation{abv[0], abv[1], abv[2]}
30 , m_name(name)
31 {
32 }
33 const char m_abreviation[3];
35 };
36
39 class USStateLookup : public Dataset
40 {
41 public:
46 virtual String name() const override
47 {
49 }
50
52 virtual Buffer<Dataset*> children() override;
56 virtual Dataset* child(const String& name) override;
59 virtual uint04 childCount() const override;
60 public:
64 protected:
67 };
68}
The equivelent of std::vector but with a bit more control.
Definition Buffer.hpp:58
Forward declaration of the Model class.
A hash-based key-value store, useful for quick associative lookups.
Definition Dictionary.h:64
The core String class for the NDEVR API.
Definition String.h:95
Any text displayed to the user should be defined as a TranslatedString which allows the program to lo...
virtual String name() const override
Returns the dataset name identifier.
Definition StateLookup.h:46
Buffer< Dataset * > m_state_sorted
The sorted list of state Dataset pointers.
Definition StateLookup.h:66
virtual Dataset * child(const String &name) override
Returns the child dataset matching the given name.
static Buffer< USState > & StateList()
Returns the static list of all US states.
virtual Buffer< Dataset * > children() override
Returns the list of child state datasets.
virtual uint04 childCount() const override
Returns the number of states in the lookup.
Dictionary< String, Dataset * > m_state_lookup
Maps state abbreviations to Dataset pointers.
Definition StateLookup.h:65
USStateLookup()
Constructs the USStateLookup and populates the state list.
The primary namespace for the NDEVR SDK.
uint32_t uint04
-Defines an alias representing a 4 byte, unsigned integer -Can represent exact integer values 0 throu...
constexpr StringView US_STATE_DATASET
Dataset name constant for US state boundary data.
USState(const TranslatedString &name, const char(&abv)[3])
Constructs a USState with a name and abbreviation.
Definition StateLookup.h:28
const char m_abreviation[3]
The two-letter state abbreviation (e.g., "CA").
Definition StateLookup.h:33
virtual TranslatedString title() const override
Returns the full translated state name.
Definition StateLookup.h:21
virtual String name() const override
Returns the state abbreviation as the dataset name.
Definition StateLookup.h:15
TranslatedString m_name
The full translated state name.
Definition StateLookup.h:34