[wpilib] Add init methods to Preferences (#2443)

This commit is contained in:
Prateek Machiraju
2020-04-01 23:26:49 -04:00
committed by GitHub
parent b9ee3ae030
commit 8f33d21bc2
3 changed files with 136 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
/*----------------------------------------------------------------------------*/
/* Copyright (c) 2011-2018 FIRST. All Rights Reserved. */
/* Copyright (c) 2011-2020 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
@@ -121,6 +121,12 @@ class Preferences : public ErrorBase {
*/
void PutString(wpi::StringRef key, wpi::StringRef value);
/**
* Puts the given string into the preferences table if it doesn't
* already exist.
*/
void InitString(wpi::StringRef key, wpi::StringRef value);
/**
* Puts the given int into the preferences table.
*
@@ -131,6 +137,12 @@ class Preferences : public ErrorBase {
*/
void PutInt(wpi::StringRef key, int value);
/**
* Puts the given int into the preferences table if it doesn't
* already exist.
*/
void InitInt(wpi::StringRef key, int value);
/**
* Puts the given double into the preferences table.
*
@@ -141,6 +153,12 @@ class Preferences : public ErrorBase {
*/
void PutDouble(wpi::StringRef key, double value);
/**
* Puts the given double into the preferences table if it doesn't
* already exist.
*/
void InitDouble(wpi::StringRef key, double value);
/**
* Puts the given float into the preferences table.
*
@@ -151,6 +169,12 @@ class Preferences : public ErrorBase {
*/
void PutFloat(wpi::StringRef key, float value);
/**
* Puts the given float into the preferences table if it doesn't
* already exist.
*/
void InitFloat(wpi::StringRef key, float value);
/**
* Puts the given boolean into the preferences table.
*
@@ -161,6 +185,12 @@ class Preferences : public ErrorBase {
*/
void PutBoolean(wpi::StringRef key, bool value);
/**
* Puts the given boolean into the preferences table if it doesn't
* already exist.
*/
void InitBoolean(wpi::StringRef key, bool value);
/**
* Puts the given long (int64_t) into the preferences table.
*
@@ -171,6 +201,12 @@ class Preferences : public ErrorBase {
*/
void PutLong(wpi::StringRef key, int64_t value);
/**
* Puts the given long into the preferences table if it doesn't
* already exist.
*/
void InitLong(wpi::StringRef key, int64_t value);
/**
* Returns whether or not there is a key with the given name.
*