mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
Add format script which invokes clang-format on the C++ source code (#41)
On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
committed by
Peter Johnson
parent
68690643d2
commit
e14e45da76
@@ -14,37 +14,42 @@ static const std::string kOptions = "options";
|
||||
static const std::string kSelected = "selected";
|
||||
|
||||
/**
|
||||
* Adds the given object to the list of options. On the {@link SmartDashboard}
|
||||
* on the desktop,
|
||||
* the object will appear as the given name.
|
||||
* @param name the name of the option
|
||||
* Adds the given object to the list of options.
|
||||
*
|
||||
* On the {@link SmartDashboard} on the desktop, the object will appear as the
|
||||
* given name.
|
||||
*
|
||||
* @param name the name of the option
|
||||
* @param object the option
|
||||
*/
|
||||
void SendableChooser::AddObject(const std::string &name, void *object) {
|
||||
void SendableChooser::AddObject(const std::string& name, void* object) {
|
||||
m_choices[name] = object;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the given object to the list of options and marks it as the default.
|
||||
*
|
||||
* Functionally, this is very close to {@link SendableChooser#AddObject(const
|
||||
* char *name, void *object) AddObject(...)}
|
||||
* except that it will use this as the default option if none other is
|
||||
* explicitly selected.
|
||||
* @param name the name of the option
|
||||
* char *name, void *object) AddObject(...)} except that it will use this as
|
||||
* the default option if none other is explicitly selected.
|
||||
*
|
||||
* @param name the name of the option
|
||||
* @param object the option
|
||||
*/
|
||||
void SendableChooser::AddDefault(const std::string &name, void *object) {
|
||||
void SendableChooser::AddDefault(const std::string& name, void* object) {
|
||||
m_defaultChoice = name;
|
||||
AddObject(name, object);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the selected option. If there is none selected, it will return the
|
||||
* default. If there is none selected
|
||||
* and no default, then it will return {@code nullptr}.
|
||||
* Returns the selected option.
|
||||
*
|
||||
* If there is none selected, it will return the default. If there is none
|
||||
* selected and no default, then it will return {@code nullptr}.
|
||||
*
|
||||
* @return the option selected
|
||||
*/
|
||||
void *SendableChooser::GetSelected() {
|
||||
void* SendableChooser::GetSelected() {
|
||||
std::string selected = m_table->GetString(kSelected, m_defaultChoice);
|
||||
if (selected == "")
|
||||
return nullptr;
|
||||
@@ -56,7 +61,7 @@ void SendableChooser::InitTable(std::shared_ptr<ITable> subtable) {
|
||||
std::vector<std::string> keys;
|
||||
m_table = subtable;
|
||||
if (m_table != nullptr) {
|
||||
std::map<std::string, void *>::iterator iter;
|
||||
std::map<std::string, void*>::iterator iter;
|
||||
for (iter = m_choices.begin(); iter != m_choices.end(); iter++) {
|
||||
keys.push_back(iter->first);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user