Пример #1
0
NETWORK_API void NetworkUtility::GetIPAndPortFromString( const rString& input, rString& outIP, unsigned short& outPort )
{
	if ( input == "" )
		return;

	outIP	= "";
	outPort = INVALID_PORT;

	size_t colonCount = std::count( input.begin(), input.end(), ':' );

	if ( colonCount == 1 )
	{
		outIP = GetIPFromString( input );
		size_t colonPosition = input.find( ':' );
		rString portString = input.substr( colonPosition + 1 );
		if ( StringUtility::IsDigitsOnly( portString ) )
		{
			outPort = GetPortFromString( portString );
		}
	}
	else if ( StringUtility::IsDigitsOnly( input ) )
	{
		outPort = GetPortFromString( input );
	}
	else
	{
		outIP = GetIPFromString( input );
	}
}
Пример #2
0
GPIO_Pin::GPIO_Pin(const char* buf, GPIOMode_TypeDef mode, GPIOSpeed_TypeDef speed): Port(GetPortFromString(buf)), Pin(GetPinFromString(buf)), Mode(mode), Speed(speed) {
	ConfigInternal();
}
Пример #3
0
GPIO_Pin::GPIO_Pin(const char* buf): Port(GetPortFromString(buf)), Pin(GetPinFromString(buf)), Speed(GPIO_Speed_50MHz) {}