BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,unsigned char usVal) { _variant_t vt; vt.bVal=usVal; vt.vt=VT_UI1; return SetFieldValue(lpName, vt); }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,float flVal) { _variant_t vt; vt.fltVal=flVal; vt.vt=VT_R4; return SetFieldValue(lpName, vt); }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,BOOL blVal) { _variant_t vt; vt.boolVal=blVal; vt.vt=VT_BOOL; return SetFieldValue(lpName, vt); }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,double dblVal) { _variant_t vt; vt.dblVal=dblVal; vt.vt=VT_R8; return SetFieldValue(lpName, vt); }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,COleDateTime dtVal) { _variant_t vt; vt.date=dtVal; vt.vt=VT_DATE; return SetFieldValue(lpName, vt); }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,unsigned long ulVal) { _variant_t vt; vt.vt = VT_UI4; vt.ulVal = ulVal; return SetFieldValue(lpName, vt); }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,long lVal) { _variant_t vt; vt.lVal=lVal; vt.vt=VT_I4; return SetFieldValue(lpName, vt); }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,short shVal) { _variant_t vt; vt.iVal=shVal; vt.vt=VT_I2; return SetFieldValue(lpName, vt); }
void BOM_FIELD_VALUES::RevertChanges( unsigned int aFieldId ) { wxString backupValue; GetBackupValue( aFieldId, backupValue ); SetFieldValue( aFieldId, backupValue, true ); }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName, COleCurrency cuVal) { _variant_t vt; vt.vt = VT_CY; vt.cyVal = cuVal.m_cur; if(cuVal.m_status == COleCurrency::invalid) return FALSE; return SetFieldValue(lpName, vt); }
NS_IMETHODIMP nsImportFieldMap::SetFieldValueByDescription(nsIAddrDatabase *database, nsIMdbRow *row, const PRUnichar *fieldDesc, const PRUnichar *value) { NS_PRECONDITION(fieldDesc != nsnull, "null ptr"); if (!fieldDesc) return NS_ERROR_NULL_POINTER; PRInt32 i = FindFieldNum( fieldDesc); if (i == -1) return( NS_ERROR_FAILURE); return( SetFieldValue( database, row, i, value)); }
bool MessageData::LoadFromMessage(const String &fileName, shared_ptr<Message> pMessage) { m_pMessage = pMessage; _messageFileName = fileName; m_pMimeMail = shared_ptr<MimeBody>(new MimeBody); const int MaxSize = 1024*1024 * 80; // we'll ignore messages larger than 80MB. if (FileUtilities::FileSize(_messageFileName) > MaxSize) return false; bool bNewMessage = false; try { if (!m_pMimeMail->LoadFromFile(_messageFileName)) { bNewMessage = true; } } catch (...) { try { String sFileNameExclPath = FileUtilities::GetFileNameFromFullPath(_messageFileName); String sMessageBackupPath = IniFileSettings::Instance()->GetLogDirectory() + "\\Problematic messages\\" + sFileNameExclPath; FileUtilities::Copy(_messageFileName, sMessageBackupPath, true); String sErrorMessage; sErrorMessage.Format(_T("An unknown error occurred while loading message. File: %s. Backuped to: %s"), _messageFileName, sMessageBackupPath); ErrorManager::Instance()->ReportError(ErrorManager::Medium, 4218, "MessageData::LoadFromMessage", sErrorMessage); } catch (...) { ErrorManager::Instance()->ReportError(ErrorManager::Medium, 4218, "MessageData::LoadFromMessage", "An unknown error occurred while loading message."); } return false; } if (bNewMessage) { // For new messages, we default to UTF-8. This way client // can put any values into headers without having to care // about setting the correct character set first. SetCharset("utf-8"); SetFieldValue(CMimeConst::MimeVersion(), "1.0"); } return true; }
BOOL CGuiRecordSet::SetValue(LPCTSTR lpName,CString szCad) { _variant_t vt; if(!szCad.IsEmpty()) { vt.vt = VT_BSTR; vt.bstrVal = szCad.AllocSysString(); } return SetFieldValue(lpName, vt); }
void MessageData::SetSentTime(const String &sSentTime) { String sValue = sSentTime; if (sValue.IsEmpty()) { // Use default value sValue = Time::GetCurrentMimeDate(); } SetFieldValue("Date", sValue); }
void CMimeMessage::SetDate(int nYear, int nMonth, int nDay, int nHour, int nMinute, int nSecond) { static const char* s_MonthNames[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; static const char* s_DayNames[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; struct tm tmDate; ::memset(&tmDate, 0, sizeof(tmDate)); tmDate.tm_year = nYear - 1900; tmDate.tm_mon = nMonth - 1; tmDate.tm_mday = nDay; tmDate.tm_hour = nHour; tmDate.tm_min = nMinute; tmDate.tm_sec = nSecond; tmDate.tm_isdst = -1; time_t timeDate = ::mktime(&tmDate); if (timeDate < 0) { ASSERT(false); return; } tmDate = *::localtime(&timeDate); // adjusted local time struct tm *ptmGmt = ::gmtime(&timeDate); // Greenwich Mean Time long nTimeDiff = tmDate.tm_mday - ptmGmt->tm_mday; if (nTimeDiff > 1) nTimeDiff = -1; else if (nTimeDiff < -1) nTimeDiff = 1; nTimeDiff *= 60 * 24; nTimeDiff += (tmDate.tm_hour - ptmGmt->tm_hour) * 60 + tmDate.tm_min - ptmGmt->tm_min; if (tmDate.tm_isdst > 0) nTimeDiff -= 60; char szDate[40]; ASSERT(tmDate.tm_wday < 7); ASSERT(tmDate.tm_mon < 12); ::sprintf(szDate, "%s, %d %s %d %02d:%02d:%02d %c%02d%02d", s_DayNames[tmDate.tm_wday], tmDate.tm_mday, s_MonthNames[tmDate.tm_mon], tmDate.tm_year+1900, tmDate.tm_hour, tmDate.tm_min, tmDate.tm_sec, (nTimeDiff >= 0 ? '+' : '-'), abs(nTimeDiff / 60), abs(nTimeDiff % 60)); SetFieldValue("Date", szDate); }
/** * Set the value of a particular item in the model */ bool BOM_TABLE_MODEL::SetValue( const wxVariant& aVariant, const wxDataViewItem& aItem, unsigned int aFieldId ) { if( !aItem.IsOk() || !m_widget ) { return false; } // Extract the value to be set if( aVariant.GetType().Cmp( "string" ) == 0 ) { wxString value = aVariant.GetString(); bool result = false; wxDataViewItemArray selectedItems; m_widget->GetSelections( selectedItems ); // Set the row value for all selected rows for( auto item : selectedItems ) { auto selectedRow = static_cast<BOM_TABLE_ROW*>( item.GetID() ); if( selectedRow ) { result |= selectedRow->SetFieldValue( aFieldId, value, true ); } } if( m_widget ) { m_widget->Update(); } return result; } // Default return false; }
int GetBookProperties(char *name, struct BookProperties* pBookProps, int localLanguage) { CRLog::trace("GetBookProperties( %s )", name); memset(pBookProps, 0, sizeof(BookProperties) ); // open stream LVStreamRef stream = LVOpenFileStream(name, LVOM_READ); if (!stream) { CRLog::error("cannot open file %s", name); return 0; } // check archieve #ifdef USE_ZLIB LVContainerRef arc; //printf("start opening arc\n"); //for ( int i=0; i<1000; i++ ) //for ( int kk=0; kk<1000; kk++) { arc = LVOpenArchieve( stream ); //printf("end opening arc\n"); if (!arc.isNull()) { CRLog::trace("%s is archive with %d items", name, arc->GetObjectCount()); // archieve const LVContainerItemInfo * bestitem = NULL; const LVContainerItemInfo * fb2item = NULL; const LVContainerItemInfo * fbditem = NULL; for (int i=0; i<arc->GetObjectCount(); i++) { const LVContainerItemInfo * item = arc->GetObjectInfo(i); if (item) { if ( !item->IsContainer() ) { lString16 name( item->GetName() ); if ( name.length() > 5 ) { name.lowercase(); const lChar16 * pext = name.c_str() + name.length() - 4; if ( pext[0]=='.' && pext[1]=='f' && pext[2]=='b' && pext[3]=='2') { fb2item = item; } else if ( pext[0]=='.' && pext[1]=='f' && pext[2]=='b' && pext[3]=='d') { fbditem = item; } } } } } bestitem = fb2item; if ( fbditem ) bestitem = fbditem; if ( !bestitem ) return 0; CRLog::trace( "opening item %s from archive", UnicodeToUtf8(bestitem->GetName()).c_str() ); //printf("start opening stream\n"); //for ( int k=0; k<1000; k++ ) { stream = arc->OpenStream( bestitem->GetName(), LVOM_READ ); char buf[8192]; stream->Read(buf, 8192, NULL ); //} //printf("end opening stream\n"); if ( stream.isNull() ) return 0; CRLog::trace( "stream created" ); // opened archieve stream } } #endif //USE_ZLIB // read document #if COMPACT_DOM==1 ldomDocument doc(stream, 0); #else ldomDocument doc; #endif ldomDocumentWriter writer(&doc, true); doc.setNodeTypes( fb2_elem_table ); doc.setAttributeTypes( fb2_attr_table ); doc.setNameSpaceTypes( fb2_ns_table ); LVXMLParser parser( stream, &writer ); CRLog::trace( "checking format..." ); if ( !parser.CheckFormat() ) { return 0; } CRLog::trace( "parsing..." ); if ( !parser.Parse() ) { return 0; } CRLog::trace( "parsed" ); #if 0 char ofname[512]; sprintf(ofname, "%s.xml", name); CRLog::trace(" writing to file %s", ofname); LVStreamRef out = LVOpenFileStream(ofname, LVOM_WRITE); doc.saveToStream(out, "utf16"); #endif lString16 authors = extractDocAuthors( &doc ); lString16 title = extractDocTitle( &doc ); lString16 series = extractDocSeriesReverse( &doc ); #if SERIES_IN_AUTHORS==1 if ( !series.empty() ) authors << L" " << series; #endif SetFieldValue( pBookProps->name, title ); if ( !authors.empty() ) SetFieldValue( pBookProps->author, authors ); if ( !series.empty() ) SetFieldValue( pBookProps->series, series ); pBookProps->filesize = (long)stream->GetSize(); strncpy( pBookProps->filename, name, MAX_PROPERTY_LEN-1 ); struct stat fs; time_t t; if ( stat( name, &fs ) ) { t = (time_t)time(0); } else { t = fs.st_mtime; } SetFieldValue( pBookProps->filedate, getDateTimeString( t, localLanguage ) ); return 1; }
CPLErr HFAEntry::SetDoubleField( const char * pszFieldPath, double dfValue ) { return SetFieldValue( pszFieldPath, 'd', &dfValue ); }
CPLErr HFAEntry::SetIntField( const char * pszFieldPath, int nValue ) { return SetFieldValue( pszFieldPath, 'i', &nValue ); }
CPLErr HFAEntry::SetStringField( const char * pszFieldPath, const char * pszValue ) { return SetFieldValue( pszFieldPath, 's', (void *) pszValue ); }
void MessageData::SetSubject(const String &sSubject) { SetFieldValue("Subject", sSubject); }
void MessageData::SetReturnPath(const String &sReturnPath) { SetFieldValue("Return-Path", "<" + sReturnPath + ">"); }
void MessageData::SetCC(const String &sCC) { SetFieldValue("CC", sCC); }
void MessageData::SetBCC(const String &sBCC) { SetFieldValue("BCC", sBCC); }
void MessageData::SetFrom(const String &sFrom) { SetFieldValue("From", sFrom); }
void MessageData::SetTo(const String &sTo) { SetFieldValue("To", sTo); }