LPCTSTR GetLyricSI(FILE_INFO* info) { return GetValue(info, FIELD_LYRIC_SI); }
/* NumberTextCtrl::isDecrement * Returns true if the entered value is a decrement *******************************************************************/ bool NumberTextCtrl::isDecrement() { return GetValue().StartsWith("--"); }
/* NumberTextCtrl::isDivisor * Returns true if the entered value is a decrement *******************************************************************/ bool NumberTextCtrl::isDivisor() { return GetValue().StartsWith("/"); }
wxRect DimRect::GetValue(const wxSize& referenceSize) const { return GetValue(wxRect(0, 0, referenceSize.GetWidth(), referenceSize.GetHeight())); }
void wxSlider::SetValue( int value ) { if (GetValue() != value) GTKSetValue(value); }
string Message::GetMessageType() { return GetValue(MessageTag::Type); }
// ------------------------------------------------------------------------ double LABHistogram2D::GetValue(CvScalar bgr) { double lab[3]; RGB2Lab(bgr.val[2], bgr.val[1], bgr.val[0], lab); return GetValue(lab[1], lab[2]); }
LPCTSTR GetURLSI(FILE_INFO* info) { return GetValue(info, FIELD_URL_SI); }
LPCTSTR GetEncodest(FILE_INFO* info) { return GetValue(info, FIELD_ENCODEST); }
LPCTSTR GetAlbumArtistSI(FILE_INFO* info) { return GetValue(info, FIELD_ALBM_ARTIST_SI); }
LPCTSTR GetOrigArtistSI(FILE_INFO* info) { return GetValue(info, FIELD_ORIG_ARTIST_SI); }
LPCTSTR GetComposerSI(FILE_INFO* info) { return GetValue(info, FIELD_COMPOSER_SI); }
LPCTSTR GetWriterSI(FILE_INFO* info) { return GetValue(info, FIELD_WRITER_SI); }
LPCTSTR GetCommissionSI(FILE_INFO* info) { return GetValue(info, FIELD_COMMISSION_SI); }
MgReader* MgdFeatureNumericFunctions::Execute() { CHECKNULL((MgReader*)m_reader, L"MgdFeatureNumericFunctions.Execute"); CHECKNULL(m_customFunction, L"MgdFeatureNumericFunctions.Execute"); Ptr<MgReader> reader; MG_LOG_TRACE_ENTRY(L"MgdFeatureNumericFunctions::Execute"); // TODO: Can this be optimized to process them as they are read? // TODO: Should we put a limit on double buffer INT32 funcCode = -1; bool supported = MgdFeatureUtil::FindCustomFunction(m_customFunction, funcCode); if (supported) { // In case we have int64 but is a custom function use double to evaluate it. // Since we don't have a type which can make operations with big numbers we will fix only Unique/Min/Max functions // Even if we treat int64 different from double we don't solve the issue with truncation error. // If we emulate SUM adding two big numbers we will get overflow even we use int64, e.g.: // Int64 val1 = 9223372036854775806; // Int64 val2 = 9223372036854775807; // Int64 sum = val1 + val2; // the sum value will be -3 so is overflow error // In the future we will need to implement a type which can handle int64 numbers without getting overflow a sum/avg is calculated. // Since all other functions calculate a sum we will use double, at least to be able to get the right result for small numbers. if (!(m_type == MgPropertyType::Int64 && (funcCode == MINIMUM || funcCode == MAXIMUM || funcCode == UNIQUE))) { VECTOR values, distValues; while(m_reader->ReadNext()) { // TODO: Add support for Geometry extents double val = GetValue(); values.push_back(val); } // Calulate the distribution on the collected values CalculateDistribution(values, distValues); // Create FeatureReader from distribution values reader = GetReader(distValues); } else { VECTOR_INT64 values, distValues; while(m_reader->ReadNext()) { INT64 int64Val = 0; if (!m_reader->IsNull(m_propertyName)) int64Val = m_reader->GetInt64(m_propertyName); values.push_back(int64Val); } // Calulate the distribution on the collected values CalculateDistribution(values, distValues); // Create FeatureReader from distribution values Ptr<MgdInt64DataReaderCreator> drCreator = new MgdInt64DataReaderCreator(m_propertyAlias); reader = drCreator->Execute(distValues); } } else { // just return an emty reader VECTOR distValues; reader = GetReader(distValues); } return reader.Detach(); }
LPCTSTR GetOther(FILE_INFO* info) { return GetValue(info, FIELD_OTHER); }
inline void PushStatements(std::vector<Statement<REAL_T> > &storage) const { expr_m.PushStatements(storage); storage.push_back(Statement<REAL_T > (TANH, GetValue())); }
LPCTSTR GetFileTypeName(FILE_INFO* info) { return GetValue(info, FILED_FILE_TYPE_NAME); }
globle void SortFunction( void *theEnv, DATA_OBJECT_PTR returnValue) { long argumentCount, i, j, k = 0; DATA_OBJECT *theArguments, *theArguments2; DATA_OBJECT theArg; struct multifield *theMultifield, *tempMultifield; char *functionName; struct expr *functionReference; int argumentSize = 0; struct FunctionDefinition *fptr; #if DEFFUNCTION_CONSTRUCT DEFFUNCTION *dptr; #endif /*==================================*/ /* Set up the default return value. */ /*==================================*/ SetpType(returnValue,SYMBOL); SetpValue(returnValue,SymbolData(theEnv)->FalseSymbol); /*=============================================*/ /* The function expects at least one argument. */ /*=============================================*/ if ((argumentCount = EnvArgCountCheck(theEnv,"sort",AT_LEAST,1)) == -1) { return; } /*=============================================*/ /* Verify that the comparison function exists. */ /*=============================================*/ if (EnvArgTypeCheck(theEnv,"sort",1,SYMBOL,&theArg) == FALSE) { return; } functionName = DOToString(theArg); functionReference = FunctionReferenceExpression(theEnv,functionName); if (functionReference == NULL) { ExpectedTypeError1(theEnv,"sort",1,"function name, deffunction name, or defgeneric name"); return; } /*======================================*/ /* For an external function, verify the */ /* correct number of arguments. */ /*======================================*/ if (functionReference->type == FCALL) { fptr = (struct FunctionDefinition *) functionReference->value; if ((GetMinimumArgs(fptr) > 2) || (GetMaximumArgs(fptr) == 0) || (GetMaximumArgs(fptr) == 1)) { ExpectedTypeError1(theEnv,"sort",1,"function name expecting two arguments"); ReturnExpression(theEnv,functionReference); return; } } /*=======================================*/ /* For a deffunction, verify the correct */ /* number of arguments. */ /*=======================================*/ #if DEFFUNCTION_CONSTRUCT if (functionReference->type == PCALL) { dptr = (DEFFUNCTION *) functionReference->value; if ((dptr->minNumberOfParameters > 2) || (dptr->maxNumberOfParameters == 0) || (dptr->maxNumberOfParameters == 1)) { ExpectedTypeError1(theEnv,"sort",1,"deffunction name expecting two arguments"); ReturnExpression(theEnv,functionReference); return; } } #endif /*=====================================*/ /* If there are no items to be sorted, */ /* then return an empty multifield. */ /*=====================================*/ if (argumentCount == 1) { EnvSetMultifieldErrorValue(theEnv,returnValue); ReturnExpression(theEnv,functionReference); return; } /*=====================================*/ /* Retrieve the arguments to be sorted */ /* and determine how many there are. */ /*=====================================*/ theArguments = (DATA_OBJECT *) genalloc(theEnv,(argumentCount - 1) * sizeof(DATA_OBJECT)); for (i = 2; i <= argumentCount; i++) { EnvRtnUnknown(theEnv,i,&theArguments[i-2]); if (GetType(theArguments[i-2]) == MULTIFIELD) { argumentSize += GetpDOLength(&theArguments[i-2]); } else { argumentSize++; } } if (argumentSize == 0) { EnvSetMultifieldErrorValue(theEnv,returnValue); ReturnExpression(theEnv,functionReference); return; } /*====================================*/ /* Pack all of the items to be sorted */ /* into a data object array. */ /*====================================*/ theArguments2 = (DATA_OBJECT *) genalloc(theEnv,argumentSize * sizeof(DATA_OBJECT)); for (i = 2; i <= argumentCount; i++) { if (GetType(theArguments[i-2]) == MULTIFIELD) { tempMultifield = (struct multifield *) GetValue(theArguments[i-2]); for (j = GetDOBegin(theArguments[i-2]); j <= GetDOEnd(theArguments[i-2]); j++, k++) { SetType(theArguments2[k],GetMFType(tempMultifield,j)); SetValue(theArguments2[k],GetMFValue(tempMultifield,j)); } } else { SetType(theArguments2[k],GetType(theArguments[i-2])); SetValue(theArguments2[k],GetValue(theArguments[i-2])); k++; } } genfree(theEnv,theArguments,(argumentCount - 1) * sizeof(DATA_OBJECT)); functionReference->nextArg = SortFunctionData(theEnv)->SortComparisonFunction; SortFunctionData(theEnv)->SortComparisonFunction = functionReference; for (i = 0; i < argumentSize; i++) { ValueInstall(theEnv,&theArguments2[i]); } MergeSort(theEnv,(unsigned long) argumentSize,theArguments2,DefaultCompareSwapFunction); for (i = 0; i < argumentSize; i++) { ValueDeinstall(theEnv,&theArguments2[i]); } SortFunctionData(theEnv)->SortComparisonFunction = SortFunctionData(theEnv)->SortComparisonFunction->nextArg; functionReference->nextArg = NULL; ReturnExpression(theEnv,functionReference); theMultifield = (struct multifield *) EnvCreateMultifield(theEnv,(unsigned long) argumentSize); for (i = 0; i < argumentSize; i++) { SetMFType(theMultifield,i+1,GetType(theArguments2[i])); SetMFValue(theMultifield,i+1,GetValue(theArguments2[i])); } genfree(theEnv,theArguments2,argumentSize * sizeof(DATA_OBJECT)); SetpType(returnValue,MULTIFIELD); SetpDOBegin(returnValue,1); SetpDOEnd(returnValue,argumentSize); SetpValue(returnValue,(void *) theMultifield); }
//////////////////////////////////////////////////////////////////////// // 描 述: 读取指定的配置项的字符串值,并允许指定未配置时的缺省值 // 作 者: 邵凯田 // 创建时间: 2011-11-13 16:20 // 参数说明: @sGroup表示组名称(中括号的标题) // @sField表示组内的配置项名称 // @szdefault表示读取失败(未配置的情况下)时的缺省值 // 返 回 值: 配置值 ////////////////////////////////////////////////////////////////////////// SString SIniFile::GetKeyStringValue(SString sGroup, SString sField, SString szdefault /*= ""*/) { if(!IsKey(sGroup,sField)) return szdefault; return GetValue(sGroup,sField); }
//*======================================================================================== //*函数: bool CSmartJZSRCTable::Convert(TSSmartDoc *pDoc, unsigned char *ucRawData) //*功能: 转换结构 //*参数: 略 //*返回: 是否成功 //*说明: 虚基类程序 //*======================================================================================== bool CSmartJZSRCTable::Convert(int nAuthNo, TSSmartDoc *pDoc, unsigned char *ucRawData, char *pszAdjustCode) { CString strValue = "" ; CString strText = ""; CString strData = ""; char szDateTime[7]; CString strDealCode = "20"; //收费机 0232 上机上网机 if( !strcmp(pDoc->m_szMacCode, "0226") || !strcmp(pDoc->m_szMacCode, "0232") ) { strDealCode = "91"; } //增值机 else if( !strcmp(pDoc->m_szMacCode, "0201") ) { strDealCode = "90"; } CTime t = CTime::GetCurrentTime(); strText.Format("%04d-%02d-%02d %02d:%02d:%02d ", t.GetYear(), t.GetMonth(), t.GetDay(), t.GetHour(), t.GetMinute(), t.GetSecond()); sprintf(szDateTime, "%04d%02d", t.GetYear(), t.GetMonth()); m_strTableName.Format("Smart_JZSource%04d%02d", t.GetYear(), t.GetMonth()); strValue.Format("注册号:%.2X%.2X%.2X%.2X ",ucRawData[0],ucRawData[1],ucRawData[2],ucRawData[3]); strText += strValue ; GetValue(strValue, m_SRC.sMachineID); strValue.Format("%s", m_SRC.sMachineID); strData+= strValue; strValue.Format("扎帐流水:%d ", ucRawData[6]*256+ucRawData[7]); strText += strValue ; GetValue(strValue, m_SRC.nSettleInvoice); strValue.Format("%d", m_SRC.nSettleInvoice); strData+= strValue; if( !IsValidDateTime(&ucRawData[8]) ) { char szDateTime[24]; GetCurDateTime(szDateTime); strValue = szDateTime; strText += strValue ; GetValue(strValue, m_SRC.sSettleTime); } else { strValue.Format("扎帐时间:%04d-%02d-%02d %02d:%02d:%02d ",ucRawData[8]+2000,ucRawData[9],ucRawData[10],ucRawData[11],ucRawData[12],ucRawData[13]); strText += strValue ; GetValue(strValue, m_SRC.sSettleTime); } strValue.Format("%s", m_SRC.sSettleTime); strData+= strValue; strValue.Format("起始流水号:%d ",ucRawData[14]*256+ucRawData[15]); strText += strValue ; GetValue(strValue, m_SRC.nBeginInvoice); strValue.Format("%d", m_SRC.nBeginInvoice); strData+= strValue; strValue.Format("结束流水号:%d ",ucRawData[16]*256+ucRawData[17]); strText += strValue ; GetValue(strValue, m_SRC.nEndInvoice); strValue.Format("%d", m_SRC.nEndInvoice); strData+= strValue; strValue.Format("正常消费总笔数:%d ",ucRawData[18]*256+ucRawData[19]); strText += strValue ; GetValue(strValue, m_SRC.nDealCount); strValue.Format("%d", m_SRC.nDealCount); strData+= strValue; strValue.Format("正常消费总金额:%d ",ucRawData[20]+ucRawData[21]*256+ucRawData[22]*65536); strText += strValue ; GetValue(strValue, m_SRC.nDealAmount); strValue.Format("%d", m_SRC.nDealAmount); strData+= strValue; strValue.Format("冲正消费总笔数:%d ",ucRawData[23]*256+ucRawData[24]); strText += strValue ; GetValue(strValue, m_SRC.nCancelCount); strValue.Format("%d", m_SRC.nCancelCount); strData+= strValue; strValue.Format("冲正消费总金额:%d ",ucRawData[25]+ucRawData[26]*256+ucRawData[27]*65536); strText += strValue ; GetValue(strValue, m_SRC.nCancelAmount); strValue.Format("%d", m_SRC.nCancelAmount); strData+= strValue; strValue.Format("异常消费总笔数%d\n",ucRawData[28]*256+ucRawData[29]); strText += strValue ; GetValue(strValue, m_SRC.nExcepCount); strValue.Format("%d", m_SRC.nExcepCount); strData+= strValue; strValue.Format("异常消费总金额%d\n",ucRawData[30]+ucRawData[31]*256+ucRawData[32]*65536); strText += strValue ; GetValue(strValue, m_SRC.nExcepACount); strValue.Format("%d", m_SRC.nExcepACount); strData+= strValue; strValue.Format("其他交易总笔数:%d ",ucRawData[33]*256+ucRawData[34]); strText += strValue ; GetValue(strValue, m_SRC.nOtherCount); strValue.Format("%d", m_SRC.nOtherCount); strData+= strValue; strValue.Format("扎帐标记:%.2X ",ucRawData[35]); strText += strValue ; GetValue(strValue, m_SRC.nOuterkeeper); strValue.Format("%d", m_SRC.nOuterkeeper); strData+= strValue; int nSettType = 0; if(ucRawData[35] == 0x00) strValue = "初次运行扎帐 "; else if(ucRawData[35] == 0x01) strValue = "上位机扎帐 "; else if(ucRawData[35] == 0x02) strValue = "复核扎帐 "; else if(ucRawData[35] == 0x03) { nSettType = 0; strValue = "手工扎帐 "; } else if(ucRawData[35] == 0x04) { nSettType = 1; strValue = "定时扎帐 "; } else if(ucRawData[35] == 0x05) { nSettType = 1; strValue = "开机扎帐 "; } else strValue = "未知类型 "; strValue.Format("CRC:%.2X%.2X\n", ucRawData[36],ucRawData[37]); strText += strValue ; CString strAdjust=GetAdjustCode(pszAdjustCode, m_SRC.nSettleInvoice, m_SRC.sSettleTime, "Smart_Settlement"); if( strAdjust == "" && !IsValidDateTime(&ucRawData[8]) ) { strAdjust = "0204"; } m_pDoc = pDoc ; CString strTemp = "" ; strTemp = "INSERT INTO " + m_strTableName ; strTemp+= "(SMT_RowID, SMT_AuthNo, SMT_Data, SMT_CRC, "; strTemp+= "SMT_DateTime, SMT_DealWith, SMT_DealWithDateTime, SMT_AdjustCode) "; strTemp+= " VALUES(SMART_JZSOURCE%s_rowid.nextval, %ld, '%s', %d, SYSDATE, 0, NULL, '%s')"; if( strAdjust == "0102" ) { strSQL1.Format(strTemp, szDateTime, nAuthNo, strData.GetBuffer(0), 0, strAdjust.GetBuffer(0)); } else { strSQL1.Format(strTemp, szDateTime, nAuthNo, strData.GetBuffer(0), 1, strAdjust.GetBuffer(0)); } strTemp = "INSERT INTO Smart_Settlement(" ; strTemp+= " SMT_RowID, SMT_Authno, SMT_MachineID, SMT_Org_id, " ; strTemp+= " SMT_SettleInvoice, SMT_SettleTime, SMT_BeginInvoice, " ; strTemp+= " SMT_EndInvoice, SMT_DealCount, SMT_DealAmount, " ; strTemp+= " SMT_CancelCount, SMT_CancelAmount, SMT_OtherCount, " ; strTemp+= " SMT_OperatorID, SMT_KeepingDate, SMT_BatchNo, " ; strTemp+= " SMT_SettleType, SMT_DealCode, SMT_EXCEPTCOUNT, SMT_EXCEPTAMOUNT, SMT_ADJUSTCODE) VALUES( " ; strTemp+= " SMART_SETTLEMENT_ROWID.nextval, %d, '%s', '%s', " ; strTemp+= " %d, to_date('%s','yyyy-mm-dd hh24:mi:ss'), %d, " ; strTemp+= " %d, %d, %d, " ; strTemp+= " %d, %d, %d, " ; strTemp+= " '%d', SYSDATE, %d, " ; strTemp+= " %d, '%s', %d, %d,'%s')" ; char szOrg[12]; if( !strcmp(pDoc->m_szOrgid, "") ) strcpy(szOrg, " "); else strcpy(szOrg, pDoc->m_szOrgid); strSQL2.Format(strTemp.GetBuffer(0), nAuthNo, m_SRC.sMachineID, szOrg, m_SRC.nSettleInvoice, m_SRC.sSettleTime, m_SRC.nBeginInvoice, m_SRC.nEndInvoice, m_SRC.nDealCount, m_SRC.nDealAmount, m_SRC.nCancelCount, m_SRC.nCancelAmount, m_SRC.nOtherCount, 999, 0, nSettType, strDealCode.GetBuffer(0), m_SRC.nExcepCount, m_SRC.nExcepACount, strAdjust.GetBuffer(0)); strUpdate.Format("Update Smart_Commrec Set SMT_LASTDEALDATETIME=to_date('%s','yyyy-mm-dd hh24:mi:ss'), SMT_SETTLEINVOICE=%ld, SMT_SETTLETIME=to_date('%s','yyyy-mm-dd hh24:mi:ss'), SMT_BEGININVOICE=%d, SMT_ENDINVOICE=%d Where Smt_AuthNo=%ld ", m_SRC.sSettleTime, m_SRC.nSettleInvoice, m_SRC.sSettleTime, m_SRC.nBeginInvoice, m_SRC.nEndInvoice, nAuthNo); /* CString strString; pDoc->m_nFlow = m_SRC.nSettleInvoice; pDoc->m_nCardID = 0; pDoc->m_nInMoney = m_SRC.nDealAmount; pDoc->m_nOutMoney = m_SRC.nCancelAmount; pDoc->m_nDealCount++; strString.Format("%d&%d&%d&%s&%d&%d&%d", pDoc->m_nAuthID, m_SRC.nSettleInvoice, pDoc->m_nDealCount, m_SRC.sSettleTime, 0, m_SRC.nDealAmount, m_SRC.nCancelAmount); BroadcastPro(PACKET_CMD_1002, pDoc, strString.GetBuffer(0), strString.GetLength()); */ return true; }
void loop() { // try to get client EthernetClient client = server.available(); String getStr; if (client) { digitalWrite(greLed,HIGH); boolean currentLineIsBlank = true; boolean indice = false; while (client.connected()) { if (client.available()) { // client data available to read char c = client.read(); // read 1 byte (character) from client // filter GET request // GET /index.html HTTP/1.1 if (c == 'G') { c = client.read(); if (c == 'E') { c = client.read(); if (c == 'T') { Serial.print("GET="); c = client.read(); // space while (true) { c = client.read(); if (c == ' ') { break; } //Serial.println(c); getRequest[getIndi] = c; getIndi++; } Serial.print(getRequest); Serial.println("@"); } } } if (c == '\n' && currentLineIsBlank) { // convert to string and clear char array String getStr(getRequest); Clear(); // if check // first page if (getStr == "/" || getStr == "/index.html") { indice = true; } // ajax GET info else if (getStr.startsWith("/Set?")) { indice = true; int getRequestStart = getStr.indexOf('?' ); int getRequestFirst = getStr.indexOf('=' ); int getRequestFinal = getStr.indexOf('/',2); int getRequestDuall = getStr.indexOf('&' ); // 2 GET if (getRequestDuall>0) { // /index.html?X=20&Y=30 int getRequestSecon = getStr.indexOf('=', getRequestFirst+1); String inputFirst_1 = getStr.substring(getRequestStart+1, getRequestFirst); // X String valueFirst_1 = getStr.substring(getRequestFirst+1, getRequestDuall); // 20 String inputFirst_2 = getStr.substring(getRequestDuall+1, getRequestSecon); // Y String valueFirst_2 = getStr.substring(getRequestSecon+1, getRequestFinal); // 30 if (inputFirst_1 == "X") { Update('X',valueFirst_1.toInt()); Update('Y',valueFirst_2.toInt()); } // reverse else if (inputFirst_1 == "Y") { Update('Y',valueFirst_1.toInt()); Update('X',valueFirst_2.toInt()); } } else { // /index.html?Y=50 or X=50 String inputFirst = getStr.substring(getRequestStart+1, getRequestFirst); // Y String valueFirst = getStr.substring(getRequestFirst+1, getRequestFinal); // 50 if (inputFirst == "X") { Update('X',valueFirst.toInt()); } else if (inputFirst == "Y") { Update('Y',valueFirst.toInt()); } } } //ajax SAVE info else if (getStr.startsWith("/Save/")) { digitalWrite(redLed,HIGH); client.println("HTTP/1.1 200 OK"); client.println("Connection: close"); Serial.println("SAVE"); Serial.println(""); SD.remove(LOG); dataFile = SD.open(LOG, FILE_WRITE); if(dataFile) { // X=123-Y=45- dataFile.print("X="); dataFile.print(X); dataFile.print("-Y="); dataFile.print(Y); dataFile.print("-"); dataFile.close(); } digitalWrite(redLed,LOW); } //ajax RESET info else if (getStr.startsWith("/Reset/")) { digitalWrite(redLed,HIGH); client.println("HTTP/1.1 200 OK"); client.println("Connection: close"); Serial.println("RESET"); Serial.println(""); delay(1); servoX.detach(); servoY.detach(); digitalWrite(redLed,LOW); digitalWrite(resetPin, LOW); } // ajax SET info else if (getStr.startsWith("/Coordinate/")) { digitalWrite(redLed,HIGH); GetValue(); double temp = analogRead(thermRes); int phot = analogRead(photoRes); client.println("HTTP/1.1 200 OK"); client.println("Connection: close"); client.println(); // JSON client.print("{\"coordinate\":{\"X\":"); client.print(X); client.print(",\"Y\":"); client.print(Y); client.print("},\"temp\":"); client.print(GetTemp(temp),1); client.print(",\"light\":"); client.print(phot); client.print(",\"network\":\""); client.print(Ethernet.localIP()); client.print("\",\"file\":["); for (int i=0; i<HTTP_FILE; i++) { File dFile = SD.open(GET[i]); if (dFile) { if(i>0) { client.print(","); } client.print("{"); client.print("\"name\":\""); client.print(GET[i]); client.print("\",\"size\":"); client.print(dFile.size()); client.print("}"); } } client.println("]}"); digitalWrite(redLed,LOW); } // print other file else { for(int i=1; i<HTTP_FILE; i++) { if (getStr == TYP[0][i]) { webFile = SD.open(GET[i]); if (webFile) { client.println("HTTP/1.1 200 OK"); client.println(TYP[1][i]); if(TYP[2][i] == "1") { client.println("Content-Encoding: gzip"); } client.print("Content-Length: "); client.println(webFile.size()); client.println("Cache-Control: max-age=302400, public"); client.println("Connection: close"); client.println(); } break; } } } // endif check // print index.html if (indice) { webFile = SD.open(GET[0]); if (webFile) { client.println("HTTP/1.1 200 OK"); client.println(TYP[1][0]); client.print("Content-Length: "); client.println(webFile.size()); client.println("Connection: close"); client.println(); } } // read file and write into web client if (webFile) { while(webFile.available()) { client.write(webFile.read()); } webFile.close(); } break; } if (c == '\n') { // last character on line of received text. Starting new line with next character read currentLineIsBlank = true; } else if (c != '\r') { // you've gotten a character on the current line currentLineIsBlank = false; } } } //delay(1); // give the web browser time to receive the data client.stop(); // close the connection digitalWrite(greLed,LOW); } }
// Returns the text content of the element. void ElementFormControlTextArea::GetInnerRML(Rocket::Core::String& content) const { content = GetValue(); }
std::string SymbolTable::GetValue(char const* symbol, int length) const { return GetValue(std::string(symbol, length)); }
/* NumberTextCtrl::isIncrement * Returns true if the entered value is an increment *******************************************************************/ bool NumberTextCtrl::isIncrement() { return GetValue().StartsWith("++"); }
const VS_FIXEDFILEINFO *VersionInfo<string>::GetFixedFileInfo() const { return static_cast<VS_FIXEDFILEINFO *>(GetValue(block_fixed_file_info, 0)); }
/* NumberTextCtrl::isFactor * Returns true if the entered value is an increment *******************************************************************/ bool NumberTextCtrl::isFactor() { return GetValue().StartsWith("*"); }
bool EdiDocument::IsValidValue(size_t row, size_t col, bool doLog ) const { wxString result = GetColumnDescriptor(col).IsValid(GetValue(row, col)); if ( result.IsEmpty() && GetValue(row, col).IsEmpty() && IsColRequired(row, col) ) { result = "Value can not be empty."; } if ( 0 == result.Cmp(wxEmptyString ) && GetColumnDescriptor(col).GetType().Cmp("choice") == 0 && GetColumnDescriptor(col).GetCrossFieldName().Cmp(wxEmptyString) != 0) { const FieldDescriptor& desc = GetColumnDescriptor(col); int crossIdx = GetColumnIdx(desc.GetCrossFieldName()); const FieldDescriptor& crossDesc = GetColumnDescriptor(crossIdx); long crossId = 0; wxString crossValue = GetValue(row, GetColumnIdx(desc.GetCrossFieldName())); for ( int i=0; i<crossDesc.GetChoicesDesk().size(); i++ ) { if ( crossValue == crossDesc.PrepareValue(crossDesc.GetChoicesDesk()[i].choice) ) { crossId = crossDesc.GetChoicesDesk()[i].id; break; } } result = "Must be one of: "; for ( i=0; i<desc.GetChoicesDesk().size(); i++ ) { const IdList& ids = desc.GetChoicesDesk()[i].ids; for ( int j=0; j<ids.size(); j++ ) { if ( crossId == ids[j] ) { result += "'"+desc.GetChoicesDesk()[i].choice+"' "; if ( GetValue(row, col) == desc.PrepareValue(desc.GetChoicesDesk()[i].choice) ) { result = wxEmptyString; goto found; } } } } found:; } // later than and early than if ( result.IsEmpty() && (!GetColumnDescriptor(col).GetLaterThan().IsEmpty() || !GetColumnDescriptor(col).GetEarlyThan().IsEmpty()) ) { wxDateTime this_date; if ( !GetColumnDescriptor(col).GetLaterThan().IsEmpty() ) { wxDateTime l_date; size_t later_idx = GetColumnIdx(GetColumnDescriptor(col).GetLaterThan()); if ( l_date.ParseFormat(GetValue(row, later_idx), "%m/%d/%Y") ) { if ( this_date.ParseFormat(GetValue(row, col), "%m/%d/%Y") && !GetColumnDescriptor(col).GetLaterThan().IsEmpty() ) { if ( !this_date.IsLaterThan(l_date) ) { result = "Date is not later than " + GetColumnDescriptor(col).GetLaterThan() + " value [" + l_date.Format("%m/%d/%Y") + "]."; } } } } if ( !GetColumnDescriptor(col).GetEarlyThan().IsEmpty() ) { wxDateTime e_date; size_t early_idx = GetColumnIdx(GetColumnDescriptor(col).GetEarlyThan()); if ( e_date.ParseFormat(GetValue(row, early_idx), "%m/%d/%Y") ) { if ( this_date.ParseFormat(GetValue(row, col), "%m/%d/%Y") && !GetColumnDescriptor(col).GetEarlyThan().IsEmpty() ) { if ( !this_date.IsEarlierThan(e_date) ) { result = "Date is not earlier than " + GetColumnDescriptor(col).GetEarlyThan() + " value [" + e_date.Format("%m/%d/%Y") + "]."; } } } } } // check/then/else if ( result.IsEmpty() && !GetColumnDescriptor(col).GetCheckEmptyName().IsEmpty() ) { const FieldDescriptor& colDesc = GetColumnDescriptor(col); wxString checkValue = GetValue(row, GetColumnIdx( colDesc.GetCheckEmptyName())).Trim(false).Trim(true); wxString pattern = checkValue.IsEmpty() ? colDesc.GetEmptyThenPattern() : colDesc.GetEmptyElsePattern(); if ( !colDesc.MatchPattern(GetValue(row, col), pattern) ) { EdiDocument* d = (EdiDocument*)this; if ( pattern.IsEmpty() ) { d->SetValue(row, col, wxEmptyString); } else { if ( '!' != pattern[0] ) { d->SetValue(row, col, pattern); } else { result = "Value cannot be " + pattern.Mid(1); } } } } // check_value/check_value_then/check_value_else if ( result.IsEmpty() && !GetColumnDescriptor(col).GetCheckValueField().IsEmpty() ) { const FieldDescriptor& colDesc = GetColumnDescriptor(col); wxString checkValue; EdiDocument* d = (EdiDocument*)this; if ( 0 == colDesc.GetCheckValueField().SubString(0,6).CmpNoCase("header:") ) { checkValue = d->GetFieldByName(colDesc.GetCheckValueField().Mid(7)).GetValue().Trim(false).Trim(true); } else { checkValue = GetValue(row, GetColumnIdx(colDesc.GetCheckValueField())).Trim(false).Trim(true); } wxString pattern = colDesc.GetCheckValueThenPattern(); bool good_value = false; for ( int i = 0; i < colDesc.GetCheckValueValues().Count(); i++ ) { if ( 0 == checkValue.Cmp(colDesc.GetCheckValueValues().Item(i)) ) { good_value = true; } } if ( good_value && ('>' != pattern[0]) && ('<' != pattern[0]) ) { if ( !colDesc.MatchPattern(GetValue(row, col), pattern) ) { if ( pattern.IsEmpty() ) { d->SetValue(row, col, wxEmptyString); } else { if ( '!' != pattern[0] ) { d->SetValue(row, col, pattern); } else { result = "Value cannot be " + pattern.Mid(1); } } } } else if ( good_value && (('>' == pattern[0]) || ('<' == pattern[0]) ) && ("numeric" == colDesc.GetType()) ) { long val, pat; val = 0; pat = 0; if ( GetValue(row, col).IsEmpty() ) { d->SetValue(row, col, "0"); } if ( pattern.Mid(1).ToLong(&pat) && GetValue(row, col).ToLong(&val) ) { if ( val <= pat && ('>' == pattern[0]) ) { result = "Value must be greater than " + pattern.Mid(1); } else if ( val >= pat && ('<' == pattern[0]) ) { result = "Value must be less than " + pattern.Mid(1); } } else { wxMessageBox(ADVPCS_DESC_WRONG_XML + " [" + colDesc.GetName() + "]" ); THROW_CFG_EXCEPTION(ADVPCS_DESC_WRONG_XML); } } } if ( 0 != result.Cmp(wxEmptyString) && doLog ) { unsigned short ncol = col; unsigned short nrow = row; ATF_ERROR code = row; code <<= 16; code |= col; LOG_ERROR(wxGetApp().GetLogger(), code, wxString::Format(".Value for row %ld, column %s is invalid. '%s'", row+1, GetColumnDescriptor(col).GetName(), result)); } return 0 == result.Cmp(wxEmptyString); };
/* NumberTextCtrl::onChanged * Called when the value is changed *******************************************************************/ void NumberTextCtrl::onChanged(wxCommandEvent& e) { string new_value = GetValue(); // Check if valid // Can begin with '+', '++', '-' or '--', rest has to be numeric bool num = false; bool valid = true; int plus = 0; int minus = 0; int splat = 0; int slash = 0; int decimal = 0; for (unsigned a = 0; a < new_value.size(); a++) { // Check for number if (new_value.at(a) >= '0' && new_value.at(a) <= '9') { num = true; continue; } // Check for + if (new_value.at(a) == '+') { if (num || plus == 2 || minus > 0 || splat > 0 || slash > 0) { // We've had a number, a different operator, or 2 '+' already, invalid valid = false; break; } else plus++; } // Check for - else if (new_value.at(a) == '-') { if (num || minus == 2 || plus > 0 || splat > 0 || slash > 0) { // We've had a number, a different operator, or 2 '-' already, invalid valid = false; break; } else minus++; } // Check for * if (new_value.at(a) == '*') { if (num || splat == 2 || plus > 0 || minus > 0 || slash > 0) { // We've had a number, a different operator, or 2 '*' already, invalid valid = false; break; } else splat++; } // Check for / if (new_value.at(a) == '/') { if (num || slash == 2 || plus > 0 || minus > 0 || splat > 0) { // We've had a number, a different operator, or 2 '/' already, invalid valid = false; break; } else slash++; } // Check for . else if (new_value.at(a) == '.') { if (!num || decimal > 0) { // We've already had a decimal, or no numbers yet, invalid valid = false; break; } else decimal++; } } // If invalid revert to previous value if (!valid) { ChangeValue(last_value); SetInsertionPoint(last_point); } else { last_value = new_value; last_point = GetInsertionPoint(); e.Skip(); } }
LPCTSTR GetTechnicianSI(FILE_INFO* info) { return GetValue(info, FIELD_TECHNICIAN_SI); }