Renamed from 'help' to 'description' for ParserKeyword and ParserItem
This commit is contained in:
@@ -30,8 +30,8 @@ void printKeyword(Opm::ParserKeywordConstPtr keyword)
|
||||
{
|
||||
std::string indent = " ";
|
||||
std::cout << keyword->getName() << std::endl;
|
||||
if (keyword->getHelpText().length() > 0) {
|
||||
std::cout << indent << "Help text: " << keyword->getHelpText() << std::endl;
|
||||
if (keyword->getDescription().length() > 0) {
|
||||
std::cout << indent << "Description: " << keyword->getDescription() << std::endl;
|
||||
}
|
||||
std::cout << indent << "Number of items: " << keyword->numItems() << std::endl;
|
||||
std::cout << indent << "Has dimension information: " << keyword->hasDimension() << std::endl;
|
||||
@@ -56,8 +56,8 @@ void printKeyword(Opm::ParserKeywordConstPtr keyword)
|
||||
void printItem(Opm::ParserItemConstPtr item, std::string indent)
|
||||
{
|
||||
std::cout << indent << item->name() << std::endl;
|
||||
if (item->getHelpText().length() > 0) {
|
||||
std::cout << indent << "Help text: " << item->getHelpText() << std::endl;
|
||||
if (item->getDescription().length() > 0) {
|
||||
std::cout << indent << "Description: " << item->getDescription() << std::endl;
|
||||
}
|
||||
std::cout << indent << "SizeType: " << ParserItemSizeEnum2String(item->sizeType()) << std::endl;
|
||||
std::cout << indent << "Has dimension information: " << item->hasDimension() << std::endl;
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace Opm {
|
||||
m_name.assign(itemName);
|
||||
m_sizeType = sizeType;
|
||||
m_defaultSet = false;
|
||||
m_helpText = "";
|
||||
m_description = "";
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace Opm {
|
||||
m_name.assign(itemName);
|
||||
m_sizeType = SINGLE;
|
||||
m_defaultSet = false;
|
||||
m_helpText = "";
|
||||
m_description = "";
|
||||
}
|
||||
|
||||
bool ParserItem::hasDimension() const {
|
||||
@@ -68,8 +68,8 @@ namespace Opm {
|
||||
} else
|
||||
m_sizeType = SINGLE;
|
||||
|
||||
if (jsonConfig.has_item("help")) {
|
||||
m_helpText = jsonConfig.get_string("help");
|
||||
if (jsonConfig.has_item("description")) {
|
||||
m_description = jsonConfig.get_string("description");
|
||||
}
|
||||
|
||||
m_defaultSet = false;
|
||||
@@ -83,12 +83,12 @@ namespace Opm {
|
||||
return m_sizeType;
|
||||
}
|
||||
|
||||
std::string ParserItem::getHelpText() const {
|
||||
return m_helpText;
|
||||
std::string ParserItem::getDescription() const {
|
||||
return m_description;
|
||||
}
|
||||
|
||||
void ParserItem::setHelpText(std::string helpText) {
|
||||
m_helpText = helpText;
|
||||
void ParserItem::setDescription(std::string description) {
|
||||
m_description = description;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -49,8 +49,8 @@ namespace Opm {
|
||||
virtual size_t numDimensions() const;
|
||||
const std::string& name() const;
|
||||
ParserItemSizeEnum sizeType() const;
|
||||
std::string getHelpText() const;
|
||||
void setHelpText(std::string helpText);
|
||||
std::string getDescription() const;
|
||||
void setDescription(std::string helpText);
|
||||
|
||||
static int defaultInt();
|
||||
static std::string defaultString();
|
||||
@@ -70,7 +70,7 @@ namespace Opm {
|
||||
private:
|
||||
std::string m_name;
|
||||
ParserItemSizeEnum m_sizeType;
|
||||
std::string m_helpText;
|
||||
std::string m_description;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<const ParserItem> ParserItemConstPtr;
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace Opm {
|
||||
m_action = action;
|
||||
m_record = ParserRecordPtr(new ParserRecord);
|
||||
m_keywordSizeType = sizeType;
|
||||
m_helpText = "";
|
||||
m_Description = "";
|
||||
}
|
||||
|
||||
ParserKeyword::ParserKeyword(const std::string& name, ParserKeywordSizeEnum sizeType, ParserKeywordActionEnum action) {
|
||||
@@ -79,12 +79,12 @@ namespace Opm {
|
||||
return m_isTableCollection;
|
||||
}
|
||||
|
||||
std::string ParserKeyword::getHelpText() const {
|
||||
return m_helpText;
|
||||
std::string ParserKeyword::getDescription() const {
|
||||
return m_Description;
|
||||
}
|
||||
|
||||
void ParserKeyword::setHelpText(const std::string& helpText) {
|
||||
m_helpText = helpText;
|
||||
void ParserKeyword::setDescription(const std::string& description) {
|
||||
m_Description = description;
|
||||
}
|
||||
|
||||
void ParserKeyword::initSize(const Json::JsonObject& jsonConfig) {
|
||||
@@ -141,8 +141,8 @@ namespace Opm {
|
||||
if (jsonConfig.has_item("data"))
|
||||
initData(jsonConfig);
|
||||
|
||||
if (jsonConfig.has_item("help")) {
|
||||
m_helpText = jsonConfig.get_string("help");
|
||||
if (jsonConfig.has_item("description")) {
|
||||
m_Description = jsonConfig.get_string("description");
|
||||
}
|
||||
|
||||
if ((m_fixedSize == 0 && m_keywordSizeType == FIXED) || (m_action != INTERNALIZE))
|
||||
@@ -446,7 +446,7 @@ namespace Opm {
|
||||
break;
|
||||
}
|
||||
}
|
||||
os << indent << lhs << "->setHelpText(\"" << m_helpText << "\");" << std::endl;
|
||||
os << indent << lhs << "->setDescription(\"" << getDescription() << "\");" << std::endl;
|
||||
|
||||
for (size_t i = 0; i < m_record->size(); i++) {
|
||||
os << indent << "{" << std::endl;
|
||||
@@ -456,7 +456,7 @@ namespace Opm {
|
||||
os << local_indent << "ParserItemPtr item(";
|
||||
item->inlineNew(os);
|
||||
os << ");" << std::endl;
|
||||
os << local_indent << "item->setHelpText(\"" << item->getHelpText() << "\");" << std::endl;
|
||||
os << local_indent << "item->setDescription(\"" << item->getDescription() << "\");" << std::endl;
|
||||
for (size_t idim=0; idim < item->numDimensions(); idim++)
|
||||
os << local_indent << "item->push_backDimension(\"" << item->getDimension( idim ) << "\");" << std::endl;
|
||||
{
|
||||
|
||||
@@ -55,8 +55,8 @@ namespace Opm {
|
||||
size_t getFixedSize() const;
|
||||
bool hasFixedSize() const;
|
||||
bool isTableCollection() const;
|
||||
std::string getHelpText() const;
|
||||
void setHelpText(const std::string &helpText);
|
||||
std::string getDescription() const;
|
||||
void setDescription(const std::string &description);
|
||||
|
||||
size_t numItems() const;
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace Opm {
|
||||
bool m_isDataKeyword;
|
||||
bool m_isTableCollection;
|
||||
ParserKeywordActionEnum m_action;
|
||||
std::string m_helpText;
|
||||
std::string m_Description;
|
||||
|
||||
static bool validNameStart(const std::string& name);
|
||||
void initData( const Json::JsonObject& jsonConfig );
|
||||
|
||||
@@ -78,12 +78,12 @@ BOOST_AUTO_TEST_CASE(scan_PreMatureTerminator_defaultUsed) {
|
||||
BOOST_CHECK_EQUAL(ParserItem::defaultInt(), defaulted->getInt(0));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(InitializeIntItem_setHelpText_canReadBack) {
|
||||
BOOST_AUTO_TEST_CASE(InitializeIntItem_setDescription_canReadBack) {
|
||||
ParserIntItem itemInt(std::string("ITEM1"));
|
||||
std::string helpText("This is the help text");
|
||||
itemInt.setHelpText(helpText);
|
||||
std::string description("This is the description");
|
||||
itemInt.setDescription(description);
|
||||
|
||||
BOOST_CHECK_EQUAL( helpText, itemInt.getHelpText() );
|
||||
BOOST_CHECK_EQUAL( description, itemInt.getDescription() );
|
||||
}
|
||||
|
||||
|
||||
@@ -126,19 +126,20 @@ BOOST_AUTO_TEST_CASE(InitializeIntItem_FromJsonObject_withDefaultInvalid_throws)
|
||||
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(InitializeIntItem_WithHelpText_HelpTextPropertyShouldBePopulated) {
|
||||
Json::JsonObject jsonConfig("{\"name\": \"ITEM1\" , \"help\" : \"Help text goes here\"}");
|
||||
BOOST_AUTO_TEST_CASE(InitializeIntItem_WithDescription_DescriptionPropertyShouldBePopulated) {
|
||||
std::string description("Description goes here");
|
||||
Json::JsonObject jsonConfig("{\"name\": \"ITEM1\" , \"description\" : \"Description goes here\"}");
|
||||
ParserIntItem item(jsonConfig);
|
||||
|
||||
BOOST_CHECK_EQUAL( "Help text goes here", item.getHelpText() );
|
||||
BOOST_CHECK_EQUAL( "Description goes here", item.getDescription() );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(InitializeIntItem_WithoutHelpText_HelpTextPropertyShouldBeEmpty) {
|
||||
BOOST_AUTO_TEST_CASE(InitializeIntItem_WithoutDescription_DescriptionPropertyShouldBeEmpty) {
|
||||
Json::JsonObject jsonConfig("{\"name\": \"ITEM1\"}");
|
||||
ParserIntItem item(jsonConfig);
|
||||
|
||||
BOOST_CHECK_EQUAL( "", item.getHelpText() );
|
||||
BOOST_CHECK_EQUAL( "", item.getDescription() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -146,11 +146,11 @@ BOOST_AUTO_TEST_CASE(MixingDataAndItems_throws2) {
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(DefaultConstructur_setHelpText_canReadBack) {
|
||||
BOOST_AUTO_TEST_CASE(DefaultConstructur_setDescription_canReadBack) {
|
||||
ParserKeyword parserKeyword("BPR");
|
||||
std::string helpText("This is the help text");
|
||||
parserKeyword.setHelpText(helpText);
|
||||
BOOST_CHECK_EQUAL( helpText, parserKeyword.getHelpText());
|
||||
std::string description("This is the description");
|
||||
parserKeyword.setDescription(description);
|
||||
BOOST_CHECK_EQUAL( description, parserKeyword.getDescription());
|
||||
}
|
||||
|
||||
|
||||
@@ -335,19 +335,19 @@ BOOST_AUTO_TEST_CASE(ConstructFromJsonObject_SizeUNKNOWN_OK) {
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ConstructFromJsonObject_WithHelpText_HelpTextPropertyShouldBePopulated) {
|
||||
Json::JsonObject jsonObject("{\"name\": \"BPR\", \"help\" : \"Help text\"}");
|
||||
BOOST_AUTO_TEST_CASE(ConstructFromJsonObject_WithDescription_DescriptionPropertyShouldBePopulated) {
|
||||
Json::JsonObject jsonObject("{\"name\": \"BPR\", \"description\" : \"Description\"}");
|
||||
ParserKeyword parserKeyword(jsonObject);
|
||||
|
||||
BOOST_CHECK_EQUAL( "Help text", parserKeyword.getHelpText() );
|
||||
BOOST_CHECK_EQUAL( "Description", parserKeyword.getDescription() );
|
||||
}
|
||||
|
||||
|
||||
BOOST_AUTO_TEST_CASE(ConstructFromJsonObject_WithoutHelpText_HelpTextPropertyShouldBeEmpty) {
|
||||
BOOST_AUTO_TEST_CASE(ConstructFromJsonObject_WithoutDescription_DescriptionPropertyShouldBeEmpty) {
|
||||
Json::JsonObject jsonObject("{\"name\": \"BPR\"}");
|
||||
ParserKeyword parserKeyword(jsonObject);
|
||||
|
||||
BOOST_CHECK_EQUAL( "", parserKeyword.getHelpText() );
|
||||
BOOST_CHECK_EQUAL( "", parserKeyword.getDescription() );
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
{"name" : "EQUIL" , "size" : {"keyword":"EQLDIMS" , "item":"NTEQUL"},
|
||||
"help": "The EQUIL item is used when equilibrationg the model. The item should consist of one record for each PVT region",
|
||||
"description": "The EQUIL item is used when equilibrationg the model. The item should consist of one record for each PVT region",
|
||||
"items" :
|
||||
[{"name" : "DATUM_DEPTH" , "value_type" : "FLOAT" , "default" : 0.0 , "dimension" : "L"},
|
||||
{"name" : "DATUM_PRESSURE" , "value_type" : "FLOAT" , "dimension" : "P"} ,
|
||||
{"name" : "OWC" , "value_type" : "FLOAT" , "default" : 0.0 , "dimension" : "L",
|
||||
"help" : "The OWC item is depth of the OIL Water contact. This should ..."} ,
|
||||
"description" : "The OWC item is depth of the OIL Water contact. This should ..."} ,
|
||||
{"name" : "PC_OWC" , "value_type" : "FLOAT" , "default" : 0.0 , "dimension" : "P"} ,
|
||||
{"name" : "GOC" , "value_type" : "FLOAT" , "default" : 0.0 , "dimension" : "L"} ,
|
||||
{"name" : "PC_GOC" , "value_type" : "FLOAT" , "default" : 0.0 , "dimension" : "P"} ,
|
||||
|
||||
Reference in New Issue
Block a user