KiCad PCB EDA Suite
Loading...
Searching...
No Matches
database_value.cpp File Reference
#include <database/database_value.h>
#include <fmt/format.h>

Go to the source code of this file.

Functions

std::string NormalizeDecimalText (const std::string &aText)
 Trim redundant trailing zeros and a dangling decimal point from decimal text, for example "4700000.0000" becomes "4700000", and add the missing zero to ".5".
 
std::string DatabaseValueToString (const DB_VALUE &aValue)
 Convert a database value to the text KiCad stores for it.
 

Function Documentation

◆ DatabaseValueToString()

std::string DatabaseValueToString ( const DB_VALUE & aValue)

Convert a database value to the text KiCad stores for it.

Doubles use the shortest text that reads back to the same value, booleans become "1" or "0" and NULL becomes an empty string. Strings are returned unchanged.

Definition at line 59 of file database_value.cpp.

Referenced by BOOST_AUTO_TEST_CASE(), BOOST_AUTO_TEST_CASE(), DATABASE_CONNECTION::makeRow(), and DATABASE_CONNECTION::readAndCache().

◆ NormalizeDecimalText()

std::string NormalizeDecimalText ( const std::string & aText)

Trim redundant trailing zeros and a dangling decimal point from decimal text, for example "4700000.0000" becomes "4700000", and add the missing zero to ".5".

A leading sign is kept except that a zero value with a decimal point becomes "0". Text without a decimal point or that is not plain decimal is returned unchanged.

Definition at line 25 of file database_value.cpp.

References result.

Referenced by BOOST_AUTO_TEST_CASE(), and decodeRow().