Esempio n. 1
0
void XmlTextWriter::WriteCData(RCString text) {
	if (strstr(text.c_str(), "]]"))
		throw logic_error("Not allowed \"]]\" in CDATA"); //!!! XmlException
	CloseElement(false);
	m_os << "<![CDATA[" << text << "]]>";
	m_bEoled = false;
}
Esempio n. 2
0
IPAddress IPAddress::Parse(RCString ipString) {
	byte buf[16];
	if (CCheck(::inet_pton(AF_INET, ipString, buf)))
		return IPAddress(ConstBuf(buf, 4));
	if (CCheck(::inet_pton(AF_INET6, ipString, buf)))
		return IPAddress(ConstBuf(buf, 16));
#if UCFG_USE_REGEX
#	if UCFG_WIN32
	if (regex_search(ipString, *s_reDomainName)) {
#	else
	if (regex_search(ipString.c_str(), s_reDomainName)) {
#	endif
		IPAddress r;
		r.AddressFamily = Ext::AddressFamily(AF_DOMAIN_NAME);
		r.m_domainname = ipString;
		return r;
	}
#endif
	Throw(HRESULT_FROM_WIN32(DNS_ERROR_INVALID_IP_ADDRESS));
}

bool IPAddress::TryParse(RCString s, IPAddress& ip) {
	byte buf[16];
	if (CCheck(::inet_pton(AF_INET, s, buf))) {
		ip = IPAddress(ConstBuf(buf, 4));
		return true;
	}
	if (CCheck(::inet_pton(AF_INET6, s, buf))) {
		ip = IPAddress(ConstBuf(buf, 16));
		return true;
	}
	return false;
}
Esempio n. 3
0
void XmlTextWriter::WriteStartElement(RCString name) {
	CloseElement();
	if (!m_bEoled)
		Eol();
	Indent();
	m_os << '<' << name;
	m_elements.push(name.c_str()); //!!!
	m_bOpenedElement = true;
	m_bEoled = false;
}
Esempio n. 4
0
Version::Version(RCString s) {
	cmatch m;
	if (regex_search(s.c_str(), m, *s_reVersion)) {
		Major = atoi(String(m[1]));
		Minor = atoi(String(m[2]));
		Build = m[4].matched ? atoi(String(m[4])) : -1;
		Revision = m[6].matched ? atoi(String(m[6])) : -1;
	} else
		Throw(E_INVALIDARG);
}
Esempio n. 5
0
Version::Version(RCString s) {
	cmatch m;
	if (regex_search(s.c_str(), m, *s_reVersion)) {
		Major = atoi(String(m[1]));
		Minor = atoi(String(m[2]));
		Build = m[4].matched ? atoi(String(m[4])) : -1;
		Revision = m[6].matched ? atoi(String(m[6])) : -1;
	} else
		Throw(errc::invalid_argument);
}
Esempio n. 6
0
XmlTextReader::XmlTextReader(RCString uri) {
	Init(xmlReaderForFile(uri.c_str(), 0, XML_PARSE_NOBLANKS));
}