[C++] minor improvements (#5319)

* minor code format, make sure cpp samples updated

* add new files
This commit is contained in:
William Cheng
2020-02-14 17:58:15 +08:00
committed by GitHub
parent 3f490ea7ee
commit 118b5e7747
44 changed files with 101 additions and 71 deletions

View File

@@ -0,0 +1,23 @@
# OpenAPI Generator Ignore
# Generated by openapi-generator https://github.com/openapitools/openapi-generator
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

View File

@@ -0,0 +1 @@
4.3.0-SNAPSHOT

View File

@@ -11,6 +11,7 @@
*/
#include <QDebug>
#include <QJsonParseError>
#include "OAIHelpers.h"
@@ -230,6 +231,18 @@ fromStringValue(const QString &inStr, double &value){
return ok;
}
bool
fromStringValue(const QString &inStr, OAIObject &value)
{
QJsonParseError err;
QJsonDocument::fromJson(inStr.toUtf8(),&err);
if ( err.error == QJsonParseError::NoError ){
value.fromJson(inStr);
return true;
}
return false;
}
bool
fromStringValue(const QString &inStr, OAIEnum &value){
value.fromJson(inStr);