Liblinphone  5.5.0
Linphone.Config Class Reference
Inheritance diagram for Linphone.Config:
Linphone.LinphoneObject

Public Member Functions

void CleanEntry (string section, string key)
 
void CleanSection (string section)
 
void CleanSectionSuite (string section)
 
string Dump ()
 
string DumpAsXml ()
 
bool GetBool (string section, string key, bool defaultValue)
 
float GetDefaultFloat (string section, string key, float defaultValue)
 
int GetDefaultInt (string section, string key, int defaultValue)
 
int GetDefaultInt64 (string section, string key, int defaultValue)
 
string GetDefaultString (string section, string key, string defaultValue)
 
float GetFloat (string section, string key, float defaultValue)
 
int GetInt (string section, string key, int defaultValue)
 
int GetInt64 (string section, string key, int defaultValue)
 
IEnumerable< string > GetKeysNamesList (string section)
 
bool GetOverwriteFlagForEntry (string section, string key)
 
bool GetOverwriteFlagForSection (string section)
 
bool GetRange (string section, string key, int min, int max, int defaultMin, int defaultMax)
 
string GetSectionParamString (string section, string key, string defaultValue)
 
bool GetSkipFlagForEntry (string section, string key)
 
bool GetSkipFlagForSection (string section)
 
string GetString (string section, string key, string defaultString)
 
IEnumerable< string > GetStringList (string section, string key, IEnumerable< string > defaultList)
 
int HasEntry (string section, string key)
 
int HasSection (string section)
 
string LoadFromXmlFile (string filename)
 
void LoadFromXmlString (string buffer)
 
void ReadFile (string filename)
 
bool RelativeFileExists (string filename)
 
void Reload ()
 
void SetBool (string section, string key, bool val)
 
void SetFloat (string section, string key, float val)
 
void SetInt (string section, string key, int val)
 
void SetInt64 (string section, string key, int val)
 
void SetIntHex (string section, string key, int val)
 
void SetOverwriteFlagForEntry (string section, string key, bool val)
 
void SetOverwriteFlagForSection (string section, bool val)
 
void SetRange (string section, string key, int minValue, int maxValue)
 
void SetSkipFlagForEntry (string section, string key, bool val)
 
void SetSkipFlagForSection (string section, bool val)
 
void SetString (string section, string key, string val)
 
void SetStringList (string section, string key, IEnumerable< string > val)
 
void Sync ()
 
void WriteRelativeFile (string filename, string data)
 

Static Public Member Functions

static Linphone.Config NewFromBuffer (string buffer)
 
static Linphone.Config NewWithFactory (string configFilename, string factoryConfigFilename)
 

Properties

bool IsReadonly [get]
 
IEnumerable< string > SectionsNamesList [get]
 

Additional Inherited Members

- Protected Member Functions inherited from Linphone.LinphoneObject
static String linphone_pointer_to_string (IntPtr ptr)
 
static IntPtr linphone_string_to_pointer ([MarshalAs(LinphoneWrapper.ByteStringMarshalling)] String str)
 
IntPtr StringArrayToBctbxList (IEnumerable< string > stringlist)
 
void CleanStringArrayPtrs (IntPtr l)
 

Detailed Description

This object is used to manipulate a configuration file.

The format of the configuration file is a .ini like format: -sections are defined in [] -each section contains a sequence of key=value pairs -each line starting by a # is a comment Various types can be used: strings and lists of strings, integers, floats, booleans (written as 0 or 1) and range of integers. Usually a Linphone.Core is initialized using two Linphone.Config, one default (where configuration changes through API calls will be saved) and one named 'factory' which is read-only and overwrites any setting that may exists in the default one. It is also possible to use only one (either default or factory) or even none.

Member Function Documentation

void Linphone.Config.CleanEntry ( string  section,
string  key 
)
inline

Removes entries for key,value in a section.

Parameters
sectionthe section for which to clean the key entry
keythe key to clean
void Linphone.Config.CleanSection ( string  section)
inline

Removes every pair of key,value in a section and remove the section.

Parameters
sectionthe section to clean
void Linphone.Config.CleanSectionSuite ( string  section)
inline

Removes a suite of sections whose name is derived from section argument, suffixed with _0, _1, _2 etc.

This is a common representation for configuration objects that can have multiple instances.

string Linphone.Config.Dump ( )
inline

Dumps the Linphone.Config as INI into a buffer.

Returns
The buffer that contains the config dump
string Linphone.Config.DumpAsXml ( )
inline

Dumps the Linphone.Config as XML into a buffer.

Returns
The buffer that contains the XML dump
bool Linphone.Config.GetBool ( string  section,
string  key,
bool  defaultValue 
)
inline

Retrieves a configuration item as a boolean, given its section, key, and default value.

The default boolean value is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found
Returns
the found value or default_value if not found.
float Linphone.Config.GetDefaultFloat ( string  section,
string  key,
float  defaultValue 
)
inline

Retrieves a default configuration item as a float, given its section, key, and default value.

The default float value is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve the default value
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found
Returns
the found default value or default_value if not found.
int Linphone.Config.GetDefaultInt ( string  section,
string  key,
int  defaultValue 
)
inline

Retrieves a default configuration item as an integer, given its section, key, and default value.

The default integer value is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve the default value
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found
Returns
the found default value or default_value if not found.
int Linphone.Config.GetDefaultInt64 ( string  section,
string  key,
int  defaultValue 
)
inline

Retrieves a default configuration item as a 64 bit integer, given its section, key, and default value.

The default integer value is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve the default value
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found
Returns
the found default value or default_value if not found.
string Linphone.Config.GetDefaultString ( string  section,
string  key,
string  defaultValue 
)
inline

Retrieves a default configuration item as a string, given its section, key, and default value.

The default value string is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve the default value
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found
Returns
the found default value or default_value if not found.
float Linphone.Config.GetFloat ( string  section,
string  key,
float  defaultValue 
)
inline

Retrieves a configuration item as a float, given its section, key, and default value.

The default float value is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found
Returns
the found value or default_value if not found.
int Linphone.Config.GetInt ( string  section,
string  key,
int  defaultValue 
)
inline

Retrieves a configuration item as an integer, given its section, key, and default value.

The default integer value is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found
Returns
the found value or default_value if not found.
int Linphone.Config.GetInt64 ( string  section,
string  key,
int  defaultValue 
)
inline

Retrieves a configuration item as a 64 bit integer, given its section, key, and default value.

The default integer value is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found
Returns
the found value or default_value if not found.
IEnumerable<string> Linphone.Config.GetKeysNamesList ( string  section)
inline

Returns the list of keys' names for a section in the LinphoneConfig.

Parameters
sectionThe section name
Returns
A list of strings. A list of char * objects.
bool Linphone.Config.GetOverwriteFlagForEntry ( string  section,
string  key 
)
inline

Retrieves the overwrite flag for a config item.

Parameters
sectionThe section from which to retrieve the overwrite flag
keyThe name of the configuration item to retrieve the overwrite flag from.
Returns
true if overwrite flag is set, false otherwise.
bool Linphone.Config.GetOverwriteFlagForSection ( string  section)
inline

Retrieves the overwrite flag for a config section.

Parameters
sectionThe section from which to retrieve the overwrite flag
Returns
true if overwrite flag is set, false otherwise.
bool Linphone.Config.GetRange ( string  section,
string  key,
int  min,
int  max,
int  defaultMin,
int  defaultMax 
)
inline

Retrieves a configuration item as a range, given its section, key, and default min and max values.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
minThe min value found or default_min
maxThe max value found or default_max
defaultMinthe default min value to return if not found
defaultMaxthe default max value to return if not found.
Returns
true if the value is successfully parsed as a range, false otherwise. If false is returned, min and max are filled respectively with default_min and default_max values.
string Linphone.Config.GetSectionParamString ( string  section,
string  key,
string  defaultValue 
)
inline

Retrieves a section parameter item as a string, given its section and key.

The default value string is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve the default value
keyThe name of the configuration item to retrieve
defaultValueThe default value to return if not found.
Returns
the found default value or default_value if not found.
bool Linphone.Config.GetSkipFlagForEntry ( string  section,
string  key 
)
inline

Retrieves the skip flag for a config item.

Parameters
sectionThe section from which to retrieve the skip flag
keyThe name of the configuration item to retrieve the skip flag from
Returns
true if skip flag is set, false otherwise.
bool Linphone.Config.GetSkipFlagForSection ( string  section)
inline

Retrieves the skip flag for a config section.

Parameters
sectionThe section from which to retrieve the skip flag
Returns
true if skip flag is set, false otherwise.
string Linphone.Config.GetString ( string  section,
string  key,
string  defaultString 
)
inline

Retrieves a configuration item as a string, given its section, key, and default value.

The default value string is returned if the config item isn't found.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
defaultStringThe default value to return if not found.
Returns
the found value or the default one if not found.
IEnumerable<string> Linphone.Config.GetStringList ( string  section,
string  key,
IEnumerable< string >  defaultList 
)
inline

Retrieves a configuration item as a list of strings, given its section, key, and default value.

The default value is returned if the config item is not found.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
defaultListThe list to return when the key doesn't exist. A list of const char * objects.
Returns
A list of strings. A list of const char * objects.
int Linphone.Config.HasEntry ( string  section,
string  key 
)
inline

Returns if a given section with a given key is present in the configuration.

Parameters
sectionto check if the given entry exists
keyto check if it exists
Returns
1 if it exists, 0 otherwise
int Linphone.Config.HasSection ( string  section)
inline

Returns if a given section is present in the configuration.

Parameters
sectionthe section to check if exists
Returns
1 if it exists, 0 otherwise
string Linphone.Config.LoadFromXmlFile ( string  filename)
inline

Reads a xml config file and fill the Linphone.Config with the read config dynamic values.

Parameters
filenameThe filename of the config file to read to fill the Linphone.Config
void Linphone.Config.LoadFromXmlString ( string  buffer)
inline

Reads a xml config string and fill the Linphone.Config with the read config dynamic values.

Parameters
bufferThe string of the config file to fill the Linphone.Config
Returns
0 in case of success
static Linphone.Config Linphone.Config.NewFromBuffer ( string  buffer)
inlinestatic

Instantiates a Linphone.Config object from a user provided buffer.

The caller of this constructor owns a reference. linphone_config_unref must be called when this object is no longer needed.

Parameters
bufferthe buffer from which the Linphone.Config will be retrieved. We expect the buffer to be null-terminated.

See : Linphone.Config.NewWithFactory()

See : linphone_config_new

Returns
a Linphone.Config object
static Linphone.Config Linphone.Config.NewWithFactory ( string  configFilename,
string  factoryConfigFilename 
)
inlinestatic

Instantiates a Linphone.Config object from a user config file and a factory config file.

The caller of this constructor owns a reference. linphone_config_unref must be called when this object is no longer needed.

Parameters
configFilenamethe filename of the user config file to read to fill the instantiated Linphone.Config
factoryConfigFilenamethe filename of the factory config file to read to fill the instantiated Linphone.Config

See : linphone_config_new

Returns
a Linphone.Config object

The user config file is read first to fill the Linphone.Config and then the factory config file is read. Therefore the configuration parameters defined in the user config file will be overwritten by the parameters defined in the factory config file.

void Linphone.Config.ReadFile ( string  filename)
inline

Reads a user config file and fill the Linphone.Config with the read config values.

Parameters
filenameThe filename of the config file to read to fill the Linphone.Config
bool Linphone.Config.RelativeFileExists ( string  filename)
inline

Check if given file name exists relatively to the current location.

Parameters
filenameThe file name to check if exists
Returns
true if file exists relative to the to the current location
void Linphone.Config.Reload ( )
inline

Reload the config from the file.

void Linphone.Config.SetBool ( string  section,
string  key,
bool  val 
)
inline

Sets a boolean config item.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
valthe value to set
void Linphone.Config.SetFloat ( string  section,
string  key,
float  val 
)
inline

Sets a float config item.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
valthe value to set
void Linphone.Config.SetInt ( string  section,
string  key,
int  val 
)
inline

Sets an integer config item.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
valthe value to set
void Linphone.Config.SetInt64 ( string  section,
string  key,
int  val 
)
inline

Sets a 64 bits integer config item.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
valthe value to set
void Linphone.Config.SetIntHex ( string  section,
string  key,
int  val 
)
inline

Sets an integer config item, but store it as hexadecimal.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
valthe value to set
void Linphone.Config.SetOverwriteFlagForEntry ( string  section,
string  key,
bool  val 
)
inline

Sets the overwrite flag for a config item (used when dumping config as xml)

Parameters
sectionThe section from which to set the overwrite flag
keyThe name of the configuration item to set the overwrite flag from
valThe overwrite flag value to set
void Linphone.Config.SetOverwriteFlagForSection ( string  section,
bool  val 
)
inline

Sets the overwrite flag for a config section (used when dumping config as xml)

Parameters
sectionThe section from which to set the overwrite flag
valThe overwrite flag value to set
void Linphone.Config.SetRange ( string  section,
string  key,
int  minValue,
int  maxValue 
)
inline

Sets a range config item.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
minValuethe min value to set
maxValuethe max value to set
void Linphone.Config.SetSkipFlagForEntry ( string  section,
string  key,
bool  val 
)
inline

Sets the skip flag for a config item (used when dumping config as xml)

Parameters
sectionThe section from which to set the skip flag
keyThe name of the configuration item to set the skip flag from
valThe skip flag value to set
void Linphone.Config.SetSkipFlagForSection ( string  section,
bool  val 
)
inline

Sets the skip flag for a config section (used when dumping config as xml)

Parameters
sectionThe section from which to set the skip flag
valThe skip flag value to set
void Linphone.Config.SetString ( string  section,
string  key,
string  val 
)
inline

Sets a string config item.

Parameters
sectionThe section from which to retrieve a configuration item
keyThe name of the configuration item to retrieve
valThe value to set
void Linphone.Config.SetStringList ( string  section,
string  key,
IEnumerable< string >  val 
)
inline

Sets a string list config item.

Parameters
sectionThe name of the section to put the configuration item into
keyThe name of the configuration item to set
valThe value to set. A list of const char * objects.
void Linphone.Config.Sync ( )
inline

Writes the config file to disk.

Returns
0 if successful, -1 otherwise
void Linphone.Config.WriteRelativeFile ( string  filename,
string  data 
)
inline

Write a string in a file placed relatively with the Linphone configuration file.

Parameters
filenameName of the file where to write data. The name is relative to the place of the config file
dataString to write

Property Documentation

bool Linphone.Config.IsReadonly
get

Indicates whether the LinphoneConfig object is readonly, in other words it has no file backend or file is opened without write permission.

Returns
a boolean.
IEnumerable<string> Linphone.Config.SectionsNamesList
get

Returns the list of sections' names in the LinphoneConfig.

Returns
A list of strings. A list of char * objects.

The documentation for this class was generated from the following file: