Ejemplo n.º 1
0
pugi::xml_node appendValue(pugi::xml_document & doc, string tag, string attribute, string newValue, bool overwriteMultiple){

    if (overwriteMultiple == true){
        // find the existing node...
        char xpathExpression[1024];
        sprintf(xpathExpression, "//%s[@%s='%s']", tag.c_str(), attribute.c_str(), newValue.c_str());
        pugi::xpath_node node = doc.select_single_node(xpathExpression);
        if(string(node.node().attribute(attribute.c_str()).value()).size() > 0){ // for some reason we get nulls here?
            // ...delete the existing node
            cout << "DELETING: " << node.node().name() << ": " << " " << node.node().attribute(attribute.c_str()).value() << endl;
            node.node().parent().remove_child(node.node());
        }
    }

    if (!doesTagAndAttributeExist(doc, tag, attribute, newValue)){
        // otherwise, add it please:
        char xpathExpression[1024];
        sprintf(xpathExpression, "//%s[@%s]", tag.c_str(), attribute.c_str());
        //cout << xpathExpression << endl;
        pugi::xpath_node_set add = doc.select_nodes(xpathExpression);
        pugi::xml_node node = add[add.size()-1].node();
        pugi::xml_node nodeAdded = node.parent().append_copy(node);
        nodeAdded.attribute(attribute.c_str()).set_value(newValue.c_str());
        return nodeAdded;
    }else{
    	return pugi::xml_node();
    }

}
Ejemplo n.º 2
0
void
docEdit::repaint( const pugi::xml_document& doc )
{
    if ( const pugi::xpath_node node = doc.select_single_node( "/article|/book" ) ) {
        try {
            detail::text_writer writer( *this );
            writer( node );
            auto cursor = textCursor();
            cursor.movePosition( QTextCursor::Start );
            ensureCursorVisible();
        } catch ( pugi::xpath_exception& ex ) {
            QMessageBox::warning( this, "adpublisher::docEdit", ex.what() );
        }
    }
    else if ( const pugi::xpath_node node = doc.select_single_node( "/qtplatz_document" ) ) {
        // do nothing
    }
    else {
        try {
            detail::xhtml_writer writer( *this );
            writer( doc.select_single_node( "/" ) );
            auto cursor = textCursor();
            cursor.movePosition( QTextCursor::Start );
            ensureCursorVisible();
        }
        catch ( pugi::xpath_exception& ex ) {
            QMessageBox::warning( this, "adpublisher::docEdit", ex.what() );
        }
    }
}
Ejemplo n.º 3
0
BOOL SApplication::_LoadXmlDocment( LPCTSTR pszXmlName ,LPCTSTR pszType ,pugi::xml_document & xmlDoc,IResProvider *pResProvider/* = NULL*/)
{
    if(!pResProvider) 
    {
        if(IsFileType(pszType))
        {
            pugi::xml_parse_result result= xmlDoc.load_file(pszXmlName,pugi::parse_default,pugi::encoding_utf8);
            SASSERT_FMTW(result,L"parse xml error! xmlName=%s,desc=%s,offset=%d",pszXmlName,result.description(),result.offset);
            return result;
        }else
        {
            pResProvider = GetMatchResProvider(pszType,pszXmlName);
        }
    }
    if(!pResProvider) return FALSE;
    
    DWORD dwSize=pResProvider->GetRawBufferSize(pszType,pszXmlName);
    if(dwSize==0) return FALSE;

    CMyBuffer<char> strXml;
    strXml.Allocate(dwSize);
    pResProvider->GetRawBuffer(pszType,pszXmlName,strXml,dwSize);

    pugi::xml_parse_result result= xmlDoc.load_buffer(strXml,strXml.size(),pugi::parse_default,pugi::encoding_utf8);
    SASSERT_FMTW(result,L"parse xml error! xmlName=%s,desc=%s,offset=%d",pszXmlName,result.description(),result.offset);
    return result;
}
Ejemplo n.º 4
0
void
docTree::repaint( const pugi::xml_document& doc )
{
    QStandardItemModel& model = *model_;

    std::string xml;
    doc_->save( xml );

    model.clear();
    model.setColumnCount( 2 );

    if ( const pugi::xpath_node node = doc.select_single_node( "/article|/book" ) ) {
        try {
            detail::model_writer writer( *model_ );
            writer( node, QModelIndex() );
            expandAll();
        }
        catch ( pugi::xpath_exception& ex ) {
            QMessageBox::warning( this, "adpublisher::docTree", ex.what() );
        }
    }
    else if ( const pugi::xpath_node node = doc.select_single_node( "/qtplatz_document" ) ) {
        try {
            detail::model_writer writer( *model_ );
            writer( node, QModelIndex() );
            expandAll();
        }
        catch ( pugi::xpath_exception& ex ) {
            QMessageBox::warning( this, "adpublisher::docTree", ex.what() );
        }
    }

}
bool XCScheme::initFromXML(const pugi::xml_document& doc)
{
  // Create an error reporter for parsing
  ErrorReporter reporter(SB_INFO, "Error parsing \"" + m_name + "\" scheme for \"" + m_parentProject->getName() + "\" project. ");
  
  // Find and process all BuildActionEntry nodes
  pugi::xpath_node_set baSet = doc.select_nodes("/Scheme/BuildAction/BuildActionEntries/BuildActionEntry");
  for (pugi::xpath_node_set::const_iterator it = baSet.begin(); it != baSet.end(); ++it)
    parseBuildAction(it->node(), reporter);
    
  // Find and process all ArchiveAction nodes
  pugi::xpath_node_set aaSet = doc.select_nodes("/Scheme/ArchiveAction");
  for (pugi::xpath_node_set::const_iterator it = aaSet.begin(); it != aaSet.end(); ++it)
    parseArchiveAction(it->node(), reporter);
  
  // Make sure we got enough information
  if (m_targets.empty()) {
    reporter.reportError("Failed to read any archiveable targets.");
    return false;
  } else if (m_configName.empty()) {
    reporter.reportError("Failed to read a valid build configuration name.");
    return false;
  } else {
    return true;
  }
}
Ejemplo n.º 6
0
void Device::create_readings_xml(pugi::xml_document &doc, int n_readings)
{
        doc.reset();
        
        // client base node
        pugi::xml_node node = doc.append_child("client");
        
        xml_header(doc);
        xml_readings(doc, false, n_readings);
}
Ejemplo n.º 7
0
void Device::create_confirm_xml(pugi::xml_document &doc, int n_readings)
{
        doc.reset();
        
        // client base node
        pugi::xml_node node = doc.append_child("server");
        
        xml_header(doc);
        xml_latest_readings(doc, true, n_readings);
}
Ejemplo n.º 8
0
	bool FontExportSerializer::deserialization(pugi::xml_document& _doc)
	{
		if (_doc.select_single_node("MyGUI[@type=\"Resource\"]").node().empty())
			return false;

		pugi::xpath_node_set nodes = _doc.select_nodes("MyGUI/Resource[@type=\"ResourceTrueTypeFont\"]");
		for (pugi::xpath_node_set::const_iterator node = nodes.begin(); node != nodes.end(); node ++)
			parseFont((*node).node());

		return true;
	}
Ejemplo n.º 9
0
static bool saveXML(pugi::xml_document& document, const std::string& outputFile)
{
	pugi::xml_node decl = document.prepend_child(pugi::node_declaration);
	decl.append_attribute("version").set_value("1.0");
	decl.append_attribute("encoding").set_value("utf-8");
	if(!document.save_file(outputFile.c_str(), " ", 1U, pugi::encoding_utf8))
	{
		return false;
	}

	return true;
}
Ejemplo n.º 10
0
	bool ImageExportSerializer::deserialization(pugi::xml_document& _doc)
	{
		if (_doc.select_single_node("MyGUI[@type=\"Resource\"]").node().empty())
			return false;

		pugi::xpath_node_set nodes = _doc.select_nodes("MyGUI/Resource[@type=\"ResourceImageSet\"]");
		for (pugi::xpath_node_set::const_iterator node = nodes.begin(); node != nodes.end(); node ++)
			parseImage((*node).node());

		updateImageProperty(DataManager::getInstance().getRoot());
		return true;
	}
Ejemplo n.º 11
0
int HLR2::_exec(const char *url, const char *payload, unsigned short timeout, pugi::xml_document& doc, std::string& headers)
{
    const short maxTry = 3;
    short retry = 0;

    if (!url || !*url) {
        LOG_ERROR("%s::%s: Invalid URL!", __class__, __func__);
        return -1;
    }

    while (maxTry >= ++retry) {
        short status = _hc.httpPost(url, payload, "text/xml", timeout);
        LOG_INFO("%s::%s: url: %s, payload: %s, timeout: %d, status: %d, headers: %s, body: %s", __class__, __func__,
                url, payload, timeout, status, _hc.getResponseHeaders(), _hc.getResponseBody());

        if (200 != status && 307 != status) {
            return -1;
        }

        headers = _hc.getResponseHeaders();
        std::string body = _hc.getResponseBody();

        if (!doc.load(body.c_str())) {
            LOG_ERROR("%s::%s: Malformed XML response!: %s", __class__, __func__, body.c_str());
            return -1;
        }

        pugi::xml_node result = doc.find_node(_isResult);
        int resultCode = atoi(result.child("ResultCode").child_value());

        switch (resultCode) {
            case 0:
            case 3016:
            case 3810:
                //-- success, exit...
                return 0;
            case 5004:
                //-- invalid session, retry...
                LOG_INFO("%s::%s: Will retry: %d", __class__, __func__, retry);
                break;
            default:
                LOG_ERROR("%s::%s: ResultCode: %s, ResultDesc: %s", __class__, __func__,
                        result.child("ResultCode").child_value(), result.child("ResultDesc").child_value());
                return -1;
        }

        //-- wait for a while...
        sys_msleep(1000);
    }

    return -1;
}
Ejemplo n.º 12
0
int InitConfig(pugi::xml_document& config) {
	//check folders, create in dont exist
	wstring appDataPath = AppPath();

	wstring logPath;
	wstring rawCurrentPath;
	wstring logDailyPath;
	//config
	wstring configFile = appDataPath + L"\\etc\\sdr.xml";
	//because service runs at windows/System32 folder
	//we forced to use absolute path

	pugi::xml_parse_result result = config.load_file(configFile.data());
	if (result.status != pugi::status_ok) {
		return status_config_file_not_found;
	}
	//first install build directory tree

	logPath = L"\\log";
	rawCurrentPath = logPath + L"\\current\\";
	logDailyPath = logPath + L"\\daily\\";

	config.select_single_node(L"/sdr/recording/logs/base").node().attribute(
			L"path").set_value(logPath.data());
	config.select_single_node(L"/sdr/recording/logs/current").node().attribute(
			L"path").set_value(rawCurrentPath.data());
	config.select_single_node(L"/sdr/recording/logs/daily").node().attribute(
			L"path").set_value(logDailyPath.data());

	config.save_file(configFile.data());

	logPath = appDataPath + logPath;
	rawCurrentPath = appDataPath + rawCurrentPath;
	logDailyPath = appDataPath + logDailyPath;

	//create config folderst
	CreateDirectory(logPath.data(), 0);
	if (GetLastError() == ERROR_PATH_NOT_FOUND)
		return status_path_not_found;
	CreateDirectory(rawCurrentPath.data(), 0);
	if (GetLastError() == ERROR_PATH_NOT_FOUND)
		return status_path_not_found;
	CreateDirectory(logDailyPath.data(), 0);
	if (GetLastError() == ERROR_PATH_NOT_FOUND)
		return status_path_not_found;

	return status_ok;
}
Ejemplo n.º 13
0
bool program_data::read(const pugi::xml_document & doc)
{
    pugi::xml_node root_node = doc.child("program");
    if(root_node.empty())
        return false;

    pugi::xml_node vertex_node = root_node.child("shaders").child("vertex");
    if(vertex_node.text().empty())
        return false;
    pugi::xml_node fragment_node = root_node.child("shaders").child("fragment");
    if(fragment_node.text().empty())
        return false;

    v_shader_ = vertex_node.text().get();
    f_shader_ = fragment_node.text().get();

    pugi::xml_node a_locations_node = root_node.child("a_locations");
    for(const auto & value : a_locations_node.children("location"))
    {
        attribute_locations_.emplace_back(value.attribute("name").value(),
                                          value.attribute("index").as_int());
    }

    pugi::xml_node u_locations_node = root_node.child("u_locations");
    for(const auto & value : u_locations_node.children("location"))
    {
        uniform_locations_.emplace_back(value.attribute("name").value(),
                                        value.attribute("index").as_int());
    }

    return true;
}
Ejemplo n.º 14
0
void Patent::_init(const pugi::xml_document& doc, const bool& loadAbstract, const bool& loadDescription) {
	pugi::xml_node root = doc.child("patent");

	text.clear();
	source_tfvec.clear();
	target_tfvec.clear();

	// walk through nodes below the root node to collect abstracts and descriptions
	for (pugi::xml_node node = root.first_child(); node; node = node.next_sibling()) {

		if ( strcmp(node.name(), "ucid") == 0 )
			ucid = node.text().as_string();
		else if ( strcmp(node.name(), "lang") == 0 )
			lang = node.text().as_string();
		else if ( loadAbstract
			 && strcmp(node.name(), "abstract") == 0 )
			this->loadText(node);
		else if ( loadDescription
			 && strcmp(node.name(), "description") == 0 )
			this->loadText(node);

	}

	s_count = text.size();

	isParsed = true;
}
Ejemplo n.º 15
0
	void AppendDocumentCopy(pugi::xml_node& target, pugi::xml_document& doc) {
		auto doc_children = doc.children();

		for(auto doc_child : doc_children) {
			target.append_copy(doc_child);
		}
	}
Ejemplo n.º 16
0
void shader_configuration::serialize_xml(pugi::xml_document& document, const std::string& path)
{
pugi::xpath_node node;
node = document.select_single_node((path + "/shader").c_str());
std::string filename = node.node().attribute("filename").as_string();
configuration::set_attribute("/shader/filename", std::make_shared<configuration_attribute>(filename));
}
Ejemplo n.º 17
0
void Device::xml_header(pugi::xml_document &doc)
{
        char uid_c[sizeof(int)];
        sprintf(uid_c, "%d", uid);
        char battery_c[sizeof(int)];
        sprintf(battery_c, "%d", battery);

        pugi::xml_node node = doc.first_child();
        
        // UID
        pugi::xml_node node_uid = node.append_child("uid");
        node_uid.append_child(pugi::node_pcdata).set_value(uid_c);
        
        // msg_version
        pugi::xml_node node_msg_version = node.append_child("msg_version");
        node_msg_version.append_child(pugi::node_pcdata).set_value(msg_version);
        
        // fw
        pugi::xml_node node_fw = node.append_child("fw");
        node_fw.append_child(pugi::node_pcdata).set_value(fw_version);
        
        // battery
        pugi::xml_node node_battery = node.append_child("battery");
        node_battery.append_child(pugi::node_pcdata).set_value(battery_c);
        
        pugi::xml_node node_shutdown = node.append_child("shut_down");
        
        // shutdown
        if(state == SHUTDOWN)
                node_shutdown.append_child(pugi::node_pcdata).set_value("true");
        else
                node_shutdown.append_child(pugi::node_pcdata).set_value("false");
}
Ejemplo n.º 18
0
// ---------------------------------------------
pugi::xml_node j1App::LoadConfig(pugi::xml_document& config_file) const
{
	pugi::xml_node ret;

	char* buf;
	int size = App->fs->Load("config.xml", &buf);
	pugi::xml_parse_result result = config_file.load_buffer(buf, size);
	RELEASE(buf);

	if(result == NULL)
		LOG("Could not load map xml file config.xml. pugi error: %s", result.description());
	else
		ret = config_file.child("config");

	return ret;
}
Ejemplo n.º 19
0
int Weather::getProperty(const char* str) {
	int count = 0; 
	int value = 0;


	//Parsing information, just there to get the condition code and temp. Takes in a char*, spits out the requested information it gets from parsing
	pugi::xml_node node = doc.child("query");
	pugi::xml_node channel = node.first_child().first_child();
	pugi::xml_node weath = channel.last_child().first_child().next_sibling();
	for(pugi::xml_node weathernode = weath;
		weathernode;
		weathernode = weathernode.next_sibling()){
			if(weathernode.attribute("date")){
				if(day + 1 == count){
					value = weathernode.attribute(str).as_int();
					//std::cout << weathernode.attribute(str).as_int();
					//std::cout << "Value"<< value;

				}
			count++;
			}

	}
	return value;
}			
Ejemplo n.º 20
0
pugi::xml_node SvgPrinter::writeHeader(pugi::xml_document &doc)
{
	pugi::xml_node rootNode = doc.append_child("svg");
	rootNode.append_attribute("xmlns") = "http://www.w3.org/2000/svg";
	rootNode.append_attribute("xmlns:xlink") = "http://www.w3.org/1999/xlink";
	rootNode.append_attribute("xmlns:ev") = "http://www.w3.org/2001/xml-events";
	rootNode.append_attribute("version") = "1.1";
	rootNode.append_attribute("baseProfile") = "full";

	if(!m_settings.width().empty()) {
		rootNode.append_attribute("width") = m_settings.width().c_str();
	}

	if(!m_settings.height().empty()) {
		rootNode.append_attribute("height") = m_settings.height().c_str();
	}

	DRect box = m_clsAttr ? m_clsAttr->boundingBox() : m_attr.boundingBox();

	double margin = m_settings.margin();
	std::stringstream is;
	is << (box.p1().m_x - margin);
	is << " " << (box.p1().m_y - margin);
	is << " " << (box.width() + 2*margin);
	is << " " << (box.height() + 2*margin);
	rootNode.append_attribute("viewBox") = is.str().c_str();

	pugi::xml_node style_node = rootNode.append_child("style");
	style_node.text() = (".font_style {font: " + std::to_string(m_settings.fontSize()) + "px monospace;}").c_str();


	return rootNode;
}
void ConvertStoryboard(pugi::xml_document& doc) {
    pugi::xml_node curNode = doc.first_child();

    //  Storyboard XIB file - get topmost controller, then export it
    const char* initialController = curNode.attribute("initialViewController").value();

    for (; curNode; curNode = curNode.next_sibling()) {
        if (curNode.type() == pugi::xml_node_type::node_element) {
            XIBArray* root = new XIBArray();
            root->ScanStoryObjects(curNode);
        }
    }

    XIBObject::ParseAllStoryMembers();

    // Print which XML nodes we did not handle during the parse for diagnostic purpose.
    XIBObject::getDocumentCoverage(doc);

    NIBWriter::ExportController(initialController);

    Plist::dictionary_type viewControllerInfo;
    viewControllerInfo[std::string("UIStoryboardDesignatedEntryPointIdentifier")] =
        std::string("UIViewController-") + std::string(initialController);
    viewControllerInfo[std::string("UIStoryboardVersion")] = (int)1;

    Plist::dictionary_type viewControllerMappings;
    for (auto curController : _g_exportedControllers) {
        viewControllerMappings[curController.first] = curController.second;
    }
    viewControllerInfo[std::string("UIViewControllerIdentifiersToNibNames")] = viewControllerMappings;

    printf("Writing %s\n", GetOutputFilename("Info.plist").c_str());
    Plist::writePlistBinary(GetOutputFilename("Info.plist").c_str(), viewControllerInfo);
}
Ejemplo n.º 22
0
//-----------------------------------------------------------------------------
void X3DFile::output_xml_header(pugi::xml_document& xml_doc,
                                const std::vector<double>& xpos)
{
  if (MPI::process_number() == 0)
  {
    xml_doc.append_child(pugi::node_doctype).set_value("X3D PUBLIC \"ISO//Web3D//DTD X3D 3.2//EN\" \"http://www.web3d.org/specifications/x3d-3.2.dtd\"");

    pugi::xml_node x3d = xml_doc.append_child("X3D");
    x3d.append_attribute("profile") = "Interchange";
    x3d.append_attribute("version") = "3.2";
    x3d.append_attribute("xmlns:xsd")
      = "http://www.w3.org/2001/XMLSchema-instance";
    x3d.append_attribute("xsd:noNamespaceSchemaLocation")
      = "http://www.web3d.org/specifications/x3d-3.2.xsd";

    pugi::xml_node scene = x3d.append_child("Scene");
    pugi::xml_node viewpoint = scene.append_child("Viewpoint");
    std::string xyz = boost::lexical_cast<std::string>(xpos[0]) + " "
      + boost::lexical_cast<std::string>(xpos[1]) + " "
      + boost::lexical_cast<std::string>(xpos[3]);
    viewpoint.append_attribute("position") = xyz.c_str();

    viewpoint.append_attribute("orientation") = "0 0 0 1";
    viewpoint.append_attribute("fieldOfView") = "0.785398";
    xyz = boost::lexical_cast<std::string>(xpos[0]) + " "
      + boost::lexical_cast<std::string>(xpos[1]) + " "
      + boost::lexical_cast<std::string>(xpos[2]);
    viewpoint.append_attribute("centerOfRotation") = xyz.c_str();

    viewpoint.append_attribute("zNear") = "-1";
    viewpoint.append_attribute("zFar") = "-1";
    pugi::xml_node background = scene.append_child("Background");
    background.append_attribute("skyColor") = "0.9 0.9 1.0";

    pugi::xml_node shape = scene.append_child("Shape");
    pugi::xml_node material
      = shape.append_child("Appearance").append_child("Material");
    material.append_attribute("ambientIntensity") = "0.05";
    material.append_attribute("shininess") = "0.5";
    material.append_attribute("diffuseColor") = "0.7 0.7 0.7";
    material.append_attribute("specularColor") = "0.9 0.9 0.9";
    material.append_attribute("emmisiveColor") = "0.7 0.7 0.7";

    shape.append_child(facet_type.c_str()).append_attribute("solid") = "false";
  }
}
Ejemplo n.º 23
0
	virtual void readable() override {
		doc.reset();
		
		this->read(doc);
		
		f.parse(doc);
		timeout();
	}
Ejemplo n.º 24
0
std::string save_narrow(const pugi::xml_document& doc, unsigned int flags, pugi::xml_encoding encoding)
{
	xml_writer_string writer;

	doc.save(writer, STR("\t"), flags, encoding);

	return writer.as_narrow();
}
Ejemplo n.º 25
0
void saveMap(pugi::xml_document& doc, std::map<K, V>& map, const char* type)
{
	for(auto iter = map.begin(); iter != map.end(); iter++)
	{
		pugi::xml_node node = doc.append_child(type);
		node.append_attribute("name").set_value(iter->first.c_str());
		node.append_attribute("value").set_value(iter->second);
	}
}
Ejemplo n.º 26
0
void parse_buffer(pugi::xml_document& doc, const char *xmlbuf, size_t buflen)
{
    pugi::xml_parse_result result = doc.load_buffer(xmlbuf, buflen);

    if (result.status != pugi::status_ok) {
        std::string errmsg = xml_error_string(result);
        throw ContentError(errmsg);
    }
}
template <typename T> void
setAllValuesXMLNodeMadrid(pugi::xml_document & doc, std::string xpath_query, T new_value)
{
    pugi::xpath_node_set nodes = doc.select_nodes(xpath_query.c_str());
    for (pugi::xpath_node_set::const_iterator it = nodes.begin(); it != nodes.end(); ++it)
    {
        pugi::xpath_node node = *it;
        node.node().first_child().set_value(std::to_string(new_value).c_str());
    }
}
Ejemplo n.º 28
0
	void FontExportSerializer::serialization(pugi::xml_document& _doc)
	{
		pugi::xml_node root = _doc.append_child("MyGUI");
		root.append_attribute("type").set_value("Resource");
		root.append_attribute("version").set_value("1.1");

		DataPtr data = DataManager::getInstance().getRoot();
		for (Data::VectorData::const_iterator child = data->getChilds().begin(); child != data->getChilds().end(); child ++)
			writeFont(root, (*child));
	}
Ejemplo n.º 29
0
void saveMap(pugi::xml_document &doc, std::map<K, V> &map, const char *type) {
    for (auto iter = map.begin(); iter != map.end(); iter++) {
        // key is on the "don't save" list, so don't save it
        if (std::find(settings_dont_save.begin(), settings_dont_save.end(), iter->first) != settings_dont_save.end())
            continue;

        pugi::xml_node node = doc.append_child(type);
        node.append_attribute("name").set_value(iter->first.c_str());
        node.append_attribute("value").set_value(iter->second);
    }
}
Ejemplo n.º 30
0
bool doesTagAndAttributeExist(pugi::xml_document & doc, string tag, string attribute, string newValue){
    char xpathExpressionExists[1024];
    sprintf(xpathExpressionExists, "//%s[@%s='%s']", tag.c_str(), attribute.c_str(), newValue.c_str());
    //cout <<xpathExpressionExists <<endl;
    pugi::xpath_node_set set = doc.select_nodes(xpathExpressionExists);
    if (set.size() != 0){
        return true;
    } else {
        return false;
    }
}