---
name: "swconfig"
section: "3"
platform: "linux"
package: "libsword-dev"
version: "1.5.3-3woody2"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/swconfig"
---

# swconfig(3)

The class to read and save settings using a file on disk.

## NAME

SWConfig - The class to read and save settings using a file on disk.

## SYNOPSIS

`#include <swconfig.h>`

### Public Methods

**SWConfig** (const char \*ifilename)\
 *Constructor of SWConfig.* virtual **~SWConfig** ()\
 virtual void **Load** ()\
 *Load from disk Load the contzent from disk.* virtual void **Save** ()\
 *Save to disk Save the content of this config object to disk.* virtual SWConfig& **operator+=** (SWConfig &addFrom)\
 *Merges the values of addFrom.* virtual ConfigEntMap& **operator\[\]** (const char \*section)\
 *Get a section This is an easy way to get and store config values.*

### Public Attributes

string **filename**\
 *The filename used by this SWConfig object.* SectionMap **Sections**\
 *Map of available sections The map of available sections.*

### Private Methods

char **getline** (FILE \*fp, string &line)\

## DETAILED DESCRIPTION

The class to read and save settings using a file on disk.

Definition at line 56 of file swconfig.h.

## CONSTRUCTOR & DESTRUCTOR DOCUMENTATION

### SWConfig::SWConfig (const char \* ifilename)

Constructor of SWConfig.

**Parameters:**

- *ifilename*

  The file, which should be used for this config.

## MEMBER FUNCTION DOCUMENTATION

### SWConfig & SWConfig::operator+= (SWConfig & addFrom)` [virtual]`

Merges the values of addFrom.

**Parameters:**

- *The*

  config which values should be merged to this config object. Already existing values will be overwritten.

### ConfigEntMap & SWConfig::operator\[\] (const char \* section)` [virtual]`

Get a section This is an easy way to get and store config values.

The following will work:\

```
 SWConfig config("/home/user/.setttings");
 config["Colors"]["Background"] = "red";
```

## AUTHOR

Generated automatically by Doxygen for The Sword Project from the source code.
