nsCSSTextAttr::nsCSSTextAttr(PRUint32 aIndex, nsIContent *aRootContent, nsIContent *aContent) : nsTextAttr<nsAutoString>(aContent == nsnull), mIndex(aIndex) { mIsRootDefined = GetValueFor(aRootContent, &mRootNativeValue); if (aContent) mIsDefined = GetValueFor(aContent, &mNativeValue); }
nsCSSTextAttr::nsCSSTextAttr(PRUint32 aIndex, nsIDOMElement *aRootElm, nsIDOMElement *aElm) : nsTextAttr<nsAutoString>(aElm == nsnull), mIndex(aIndex) { mIsRootDefined = GetValueFor(aRootElm, &mRootNativeValue); if (aElm) mIsDefined = GetValueFor(aElm, &mNativeValue); }
bool RelayConfigs::GetValueFor( const char* key, vector<int>& ints ) { char str[256]; bool found = GetValueFor( key, str, sizeof(str) ); int len = strlen(str); char buf[len+1]; strcpy( buf, str ); char* port = buf; for ( ; ; ) { char* end = strstr( port, "," ); if ( !!end ) { *end = '\0'; } fprintf( stderr, "adding %s to ports\n", port ); ints.push_back( atoi(port) ); if ( !end ) { break; } port = end + 1; } return found; }
bool RelayConfigs::GetValueFor( const char* key, time_t* value ) { int val; bool success = GetValueFor( key, &val ); if ( success ) { *value = val; } return success; }
bool RelayConfigs::GetValueFor( const char* key, int* value ) { char buf[32]; bool found = GetValueFor( key, buf, sizeof(buf) ); if ( found ) { *value = atoi( buf ); } return found; }