Beispiel #1
0
//First support classes and functions...
QString ListItem::formattedName(bool fullHtml, int charsAllowed){
    QString formatedStr;
    if(!getCustomString(OVERRIDE_FORMATTED_NAME_KEY).isEmpty()){
        formatedStr =getCustomString(OVERRIDE_FORMATTED_NAME_KEY);
        if(charsAllowed>-1){
            formatedStr = formatedStr.right(charsAllowed);
        }
    } else if(!m_useDisplayPathForNextKey){
        formatedStr = getName();
        //int offsetNextKeys = m_nextKeyIndex;
        if(charsAllowed>-1 && formatedStr.length() > charsAllowed ){
            //offsetNextKeys -= (formatedStr.length() - charsAllowed);
            formatedStr = formatedStr.left(charsAllowed);
        }
        QStringList l;
        l.append(formatedStr);
        l = highlightKey(l, m_nextKeyIndex);
        formatedStr = (l.join(" "));
        if(UI_LISTNAME_BOLD){
            formatedStr = QString("<b>") + formatedStr + "</b>";
        }
        formatedStr = QString("<p>") + formatedStr + "</p>";

    }
    if(fullHtml){
        formatedStr = htmlize(formatedStr);
    }

    return  formatedStr;
}
Beispiel #2
0
char* MyMessage::getString(char *buffer) const {
	uint8_t payloadType = miGetPayloadType();
	if (buffer != NULL) {
		if (payloadType == P_STRING) {
			strncpy(buffer, data, miGetLength());
			buffer[miGetLength()] = 0;
		} else if (payloadType == P_BYTE) {
			itoa(bValue, buffer, 10);
		} else if (payloadType == P_INT16) {
			itoa(iValue, buffer, 10);
		} else if (payloadType == P_UINT16) {
			utoa(uiValue, buffer, 10);
		} else if (payloadType == P_LONG32) {
			ltoa(lValue, buffer, 10);
		} else if (payloadType == P_ULONG32) {
			ultoa(ulValue, buffer, 10);
		} else if (payloadType == P_FLOAT32) {
			dtostrf(fValue,2,fPrecision,buffer);
		} else if (payloadType == P_CUSTOM) {
			return getCustomString(buffer);
		}
		return buffer;
	} else {
		return NULL;
	}
}
Beispiel #3
0
int main(){
    std::cout << '\n' << getCustomString() << '\n';
    std::cout << countChars("This is a sentence", 't') << '\n';
    std::cout << countCharsCustom('f') << '\n';

    return 0;
}
Beispiel #4
0
char* MyMessage::getStream(char *buffer) const {
	uint8_t cmd = miGetCommand();
	if ((cmd == C_STREAM) && (buffer != NULL)) {
		return getCustomString(buffer);
	} else {
		return NULL;
	}
}