STDMETHODIMP CComDictionary::GetUnitCommentStr(WORD UnitNo, BSTR *result) { TUnitComment* C = GetCommentsByUnitId(m_Units[UnitNo].m_EntryId); _bstr_t t = C->Comments; *result = t.copy(); return S_OK; }
string TRoss::GetUnitTextHeader(WORD UnitNo) const { string R; const CStructEntry& U = m_Units[UnitNo]; const TUnitComment* C = GetCommentsByUnitId(m_Units[UnitNo].m_EntryId); R += Format("%s = %s\r\n", GetTitleFieldName(), U.m_EntryStr); R += Format("%s = %u\r\n", GetSenseFieldName(),U.m_MeanNum); if (C && strlen(C->Comments)) R += Format("%s = %s\r\n", GetCommFieldName(),C->Comments); if (strlen(U.m_AuthorStr) > 0) R += Format("%s = %s\r\n", GetAuthorFieldName(),U.m_AuthorStr); if (C && strlen(C->Editor)) R += Format("%s = %s\r\n", GetRedactFieldName(),C->Editor); string t = TRoss::GetUnitModifTimeStr(UnitNo); if (!t.empty()) R += Format("%s = %s\r\n", GetTimeCreatFieldName(),t.c_str()); return R; }
STDMETHODIMP CComDictionary::SetUnitCurrentTime(WORD UnitNo) { // TODO: Add your implementation code here CDictionary::SetUnitCurrentTime (UnitNo); TUnitComment* C = GetCommentsByUnitId(m_Units[UnitNo].m_EntryId); C->modif_tm = RmlGetCurrentTime(); return S_OK; }
void TRoss::SetUnitCommentStr(WORD UnitNo, const char* Str) { TUnitComment* C = GetCommentsByUnitId(m_Units[UnitNo].m_EntryId); int l = strlen(Str); if (l > UnitCommentSize - 1) l = UnitCommentSize - 1; strncpy (C->Comments, Str, l); C->Comments[l] = 0; }
void TRoss::SetUnitModifTimeStr(WORD UnitNo, const char* TimeStr) { try { TUnitComment* C = GetCommentsByUnitId(m_Units[UnitNo].m_EntryId); C->modif_tm = Str2Tm(TimeStr); } catch (...) { ::ErrorMessage ("StructDict", "Error in setting UnitComments"); }; }
void TRoss::SetUnitEditor(WORD UnitNo, const char* Editor) { try { TUnitComment* C = GetCommentsByUnitId(m_Units[UnitNo].m_EntryId); strcpy (C->Editor,Editor); } catch (...) { ::ErrorMessage ("StructDict", "Error in setting UnitEditor"); }; }
string TRoss::GetUnitModifTimeStr(WORD UnitNo) const { try { char tmpbuf[128]; const TUnitComment* C = GetCommentsByUnitId(m_Units[UnitNo].m_EntryId); long year = C->modif_tm.tm_year; if (year > 100) year -= 100; sprintf( tmpbuf, "%i/%i/%i %i:%i:%i", C->modif_tm.tm_mday, C->modif_tm.tm_mon+1, year, C->modif_tm.tm_hour, C->modif_tm.tm_min, C->modif_tm.tm_sec); return tmpbuf; } catch (...) { ErrorMessage("Error in getting UnitComments"); return ""; }; }