Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
d2bfb99a
Commit
d2bfb99a
authored
Jul 01, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
8196be59
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
52 additions
and
36 deletions
+52
-36
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+48
-36
FactMetaData.h
src/FactSystem/FactMetaData.h
+4
-0
No files found.
src/FactSystem/FactMetaData.cc
View file @
d2bfb99a
...
@@ -84,6 +84,40 @@ const FactMetaData::AppSettingsTranslation_s FactMetaData::_rgAppSettingsTransla
...
@@ -84,6 +84,40 @@ const FactMetaData::AppSettingsTranslation_s FactMetaData::_rgAppSettingsTransla
{
"g"
,
"lbs"
,
FactMetaData
::
UnitWeight
,
UnitsSettings
::
WeightUnitsLbs
,
FactMetaData
::
_gramsToPunds
,
FactMetaData
::
_poundsToGrams
},
{
"g"
,
"lbs"
,
FactMetaData
::
UnitWeight
,
UnitsSettings
::
WeightUnitsLbs
,
FactMetaData
::
_gramsToPunds
,
FactMetaData
::
_poundsToGrams
},
};
};
const
char
*
FactMetaData
::
_rgKnownTypeStrings
[]
=
{
"Uint8"
,
"Int8"
,
"Uint16"
,
"Int16"
,
"Uint32"
,
"Int32"
,
"Uint64"
,
"Int64"
,
"Float"
,
"Double"
,
"String"
,
"Bool"
,
"ElapsedSeconds"
,
"Custom"
,
};
const
FactMetaData
::
ValueType_t
FactMetaData
::
_rgKnownValueTypes
[]
=
{
valueTypeUint8
,
valueTypeInt8
,
valueTypeUint16
,
valueTypeInt16
,
valueTypeUint32
,
valueTypeInt32
,
valueTypeUint64
,
valueTypeInt64
,
valueTypeFloat
,
valueTypeDouble
,
valueTypeString
,
valueTypeBool
,
valueTypeElapsedTimeInSeconds
,
valueTypeCustom
,
};
const
char
*
FactMetaData
::
_decimalPlacesJsonKey
=
"decimalPlaces"
;
const
char
*
FactMetaData
::
_decimalPlacesJsonKey
=
"decimalPlaces"
;
const
char
*
FactMetaData
::
_nameJsonKey
=
"name"
;
const
char
*
FactMetaData
::
_nameJsonKey
=
"name"
;
const
char
*
FactMetaData
::
_typeJsonKey
=
"type"
;
const
char
*
FactMetaData
::
_typeJsonKey
=
"type"
;
...
@@ -880,44 +914,11 @@ void FactMetaData::setRawUnits(const QString& rawUnits)
...
@@ -880,44 +914,11 @@ void FactMetaData::setRawUnits(const QString& rawUnits)
FactMetaData
::
ValueType_t
FactMetaData
::
stringToType
(
const
QString
&
typeString
,
bool
&
unknownType
)
FactMetaData
::
ValueType_t
FactMetaData
::
stringToType
(
const
QString
&
typeString
,
bool
&
unknownType
)
{
{
QStringList
knownTypeStrings
;
QList
<
ValueType_t
>
knownTypes
;
unknownType
=
false
;
unknownType
=
false
;
knownTypeStrings
<<
QStringLiteral
(
"Uint8"
)
for
(
size_t
i
=
0
;
i
<
sizeof
(
_rgKnownTypeStrings
)
/
sizeof
(
_rgKnownTypeStrings
[
0
]);
i
++
)
{
<<
QStringLiteral
(
"Int8"
)
if
(
typeString
.
compare
(
_rgKnownTypeStrings
[
i
],
Qt
::
CaseInsensitive
)
==
0
)
{
<<
QStringLiteral
(
"Uint16"
)
return
_rgKnownValueTypes
[
i
];
<<
QStringLiteral
(
"Int16"
)
<<
QStringLiteral
(
"Uint32"
)
<<
QStringLiteral
(
"Int32"
)
<<
QStringLiteral
(
"Uint64"
)
<<
QStringLiteral
(
"Int64"
)
<<
QStringLiteral
(
"Float"
)
<<
QStringLiteral
(
"Double"
)
<<
QStringLiteral
(
"String"
)
<<
QStringLiteral
(
"Bool"
)
<<
QStringLiteral
(
"ElapsedSeconds"
)
<<
QStringLiteral
(
"Custom"
);
knownTypes
<<
valueTypeUint8
<<
valueTypeInt8
<<
valueTypeUint16
<<
valueTypeInt16
<<
valueTypeUint32
<<
valueTypeInt32
<<
valueTypeUint64
<<
valueTypeInt64
<<
valueTypeFloat
<<
valueTypeDouble
<<
valueTypeString
<<
valueTypeBool
<<
valueTypeElapsedTimeInSeconds
<<
valueTypeCustom
;
for
(
int
i
=
0
;
i
<
knownTypeStrings
.
count
();
i
++
)
{
if
(
knownTypeStrings
[
i
].
compare
(
typeString
,
Qt
::
CaseInsensitive
)
==
0
)
{
return
knownTypes
[
i
];
}
}
}
}
...
@@ -926,6 +927,17 @@ FactMetaData::ValueType_t FactMetaData::stringToType(const QString& typeString,
...
@@ -926,6 +927,17 @@ FactMetaData::ValueType_t FactMetaData::stringToType(const QString& typeString,
return
valueTypeDouble
;
return
valueTypeDouble
;
}
}
QString
FactMetaData
::
typeToString
(
ValueType_t
type
)
{
for
(
size_t
i
=
0
;
i
<
sizeof
(
_rgKnownTypeStrings
)
/
sizeof
(
_rgKnownTypeStrings
[
0
]);
i
++
)
{
if
(
type
==
_rgKnownValueTypes
[
i
])
{
return
_rgKnownTypeStrings
[
i
];
}
}
return
QStringLiteral
(
"UnknownType%1"
).
arg
(
type
);
}
size_t
FactMetaData
::
typeToSize
(
ValueType_t
type
)
size_t
FactMetaData
::
typeToSize
(
ValueType_t
type
)
{
{
switch
(
type
)
{
switch
(
type
)
{
...
...
src/FactSystem/FactMetaData.h
View file @
d2bfb99a
...
@@ -194,6 +194,7 @@ public:
...
@@ -194,6 +194,7 @@ public:
static
const
int
kUnknownDecimalPlaces
=
-
1
;
///< Number of decimal places to specify is not known
static
const
int
kUnknownDecimalPlaces
=
-
1
;
///< Number of decimal places to specify is not known
static
ValueType_t
stringToType
(
const
QString
&
typeString
,
bool
&
unknownType
);
static
ValueType_t
stringToType
(
const
QString
&
typeString
,
bool
&
unknownType
);
static
QString
typeToString
(
ValueType_t
type
);
static
size_t
typeToSize
(
ValueType_t
type
);
static
size_t
typeToSize
(
ValueType_t
type
);
static
const
char
*
qgcFileType
;
static
const
char
*
qgcFileType
;
...
@@ -342,6 +343,9 @@ private:
...
@@ -342,6 +343,9 @@ private:
static
const
AppSettingsTranslation_s
_rgAppSettingsTranslations
[];
static
const
AppSettingsTranslation_s
_rgAppSettingsTranslations
[];
static
const
char
*
_rgKnownTypeStrings
[];
static
const
ValueType_t
_rgKnownValueTypes
[];
static
const
char
*
_nameJsonKey
;
static
const
char
*
_nameJsonKey
;
static
const
char
*
_decimalPlacesJsonKey
;
static
const
char
*
_decimalPlacesJsonKey
;
static
const
char
*
_typeJsonKey
;
static
const
char
*
_typeJsonKey
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment