Exemplo n.º 1
0
const char *MSMBSDate::format(MSString& aString_,const char *format_) const
{
  #ifdef MS_THREAD_SAFE_FUNCTIONS
  struct tm tms;
  #endif //MS_THREAD_SAFE_FUNCTIONS

  MSString aString(0,((format_!=0)?strlen(format_):0)+3);
  // __tm_zone, a member of struct tm for the sun architecture
  // must be initialized if the strftime format %Z is used. Can
  // get this value from localtime.
  time_t now=time(0);
  struct tm *pCalendarTime=MS_LOCALTIME(&now,&tms);
  MSMonth m; MSDay d; MSYear y;
  asMonthDayYear(m,d,y);
  pCalendarTime->tm_sec=0;
  pCalendarTime->tm_min=0;
  pCalendarTime->tm_hour=0;
  pCalendarTime->tm_mday=d;
  pCalendarTime->tm_mon=m-1;
  pCalendarTime->tm_year=y-1900;
  pCalendarTime->tm_wday=weekDay()==7?0:weekDay();
  pCalendarTime->tm_yday=dayOfYear()-1;
  pCalendarTime->tm_isdst=-1;
  int numberOfChars;
  while ((numberOfChars=strftime((char*)aString.string(),aString.length(),format_,pCalendarTime))==0)
   {
     aString=MSString(0,2*aString.length());
   }
  // remove the terminating null from strftime. strftime returns the number of characters
  // produced not including the terminating null character.
  aString=MSString(aString.string(),numberOfChars);
  aString_=aString.string();
  return aString_;
}
Exemplo n.º 2
0
MSString MSIndexVector::asDebugInfo() const
{
  MSString result (className());
  
  return result << "(@" << MSString((unsigned long)this).d2x().lowerCase()
		<< ",_elements=" << ((Data *)_pImpl->data())->asDebugInfo()
		<< ",_size=" << MSString(size()) << ",_length=" << MSString(length())
		<< ",_type=" << type().symbolName() << ")";
}
Exemplo n.º 3
0
MSAttrValueList& MSArrowButton::get(MSAttrValueList& avList_)
{
  MSStringVector typeVector("MSArrow::Left\nMSArrow::Right\nMSArrow::Up\nMSArrow::Down");
  avList_<<MSAttrValue("activate","",MSAttrValue::Callback);
  avList_<<MSAttrValue("type",typeVector(type()),typeVector);
  avList_<<MSAttrValue("repeatThreshold",MSString(repeatThreshold()));
  avList_<<MSAttrValue("repeatInterval",MSString(repeatInterval()));
  avList_<<MSAttrValue("arrowColor",server()->colorName(arrowColor()),MSAttrValue::Color);
  return MSWidgetCommon::get(avList_);
}
Exemplo n.º 4
0
MSString MSTypeMatrix<char>::asString(void) const
{
  MSString result;
  result+='(';
  result+=MSString(rows());
  result+=',';
  result+=MSString(columns());
  result+=") ";
  unsigned n=length();
  for (unsigned i=0;i<n;) result<<(int)data()[i++];
  return MSString(result);
}
Exemplo n.º 5
0
MSString MSMBSDate::asDebugInfo(void) const
{
  MSString result("MSMBSDate(@");
  result+=MSString((unsigned long)this).d2x().lowerCase();
  result+=",_date=";
  result+=MSString((unsigned long)asInternal());
  result+=",_locale=";
  result+=MSString((int)_locale);
  result+=",_override=";
  result+=MSString((unsigned long)_override);
  result+=",_useOverride=";
  result+=MSString((int)_useOverride);
  result+=",_firstTime=";
  result+=MSString((int)_firstTime);
  result+=",_defaultFormat=";
  result+=MSString((int)_defaultFormat);
  result+=",_strftimeDefaultFormat=";
  result+=_strftimeDefaultFormat;
  result+=",_defaultConstructToToday=";
  result+=(defaultConstructToToday()==MSTrue?"MSTrue":"MSFalse");
  result+=",_type=";
  result+=type().symbolName();
  result+=")";
  return MSString(result);
}
Exemplo n.º 6
0
MSString MSTerm::asMSF(void) const
{
  MSString aString;
  if (isSet()==MSTrue)
   {
     aString+=MSString(_years);
     aString+='y';
     aString+=MSMSF_SPACE;
     aString+=MSString(_months);
     aString+='m';
     aString+=MSMSF_SPACE;
     aString+=MSString(_days);
     aString+='d';
   }
  return aString;
}
Exemplo n.º 7
0
MSString MSTerm::asDebugInfo(void) const
{
  MSString result("MSTerm(@");
  result+=MSString((unsigned long)this).d2x().lowerCase();
  result+=",_years=";
  result+=MSString(_years);
  result+=",_months=";
  result+=MSString(_months);
  result+=",_days=";
  result+=MSString(_days);
  result+=",_isSet=";
  if (isSet()==MSTrue) result+="MSTrue"; else result+="MSFalse";
  result+=",_type=";
  result+=type().symbolName();
  result+=")";
  return MSString(result);
}
Exemplo n.º 8
0
int MSRawConnection::doSyncRead(MSString &result_)
{
  MSBuffer *db=headBuffer();
  int n;

  if (isSet(MSProtocolConnection<MSString>::Reset)==MSTrue) return 0;
  if ((n=readTheBuffer(db,MaxReadSize))<0) return 0;

  if((n=db->put()-db->get())>0)
   {
     unset(MSProtocolConnection<MSString>::Read);
     result_=MSString(db->get(),n);
     db->get(db->get()+n);
   }
  return 1;
}
Exemplo n.º 9
0
MSAttrValueList& MSToggleButtonBase::get(MSAttrValueList& avList_)
{
  avList_<<MSAttrValue("selectColor", server()->colorName(selectColor()),MSAttrValue::Color);
  avList_<<MSAttrValue("toggleShadowThickness", MSString(toggleShadowThickness()));
  MSActionButton::get(avList_);
  //We need to remove "activate" callback since it is not supported by us or our subclasses
  MSIndexVector index;
  for(int i=0; i<avList_.length();i++)
   {
     if(avList_[i].valueType()==MSAttrValue::Callback && avList_[i].attribute()=="activate")
      {
        index<<i;
        break;
      }
   }
  avList_.remove(index);
  return avList_;
}
Exemplo n.º 10
0
MSString MSIndexVector::Operations::asMSF (const void *pData_, unsigned int index_) const
{
  return MSString (((Data *)pData_)->elements()[index_]);
}
Exemplo n.º 11
0
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// MSModel virtual methods
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MSString MSMBSDate::asString(void) const
{ MSString aString; return MSString(format(aString,MSDate::defaultFormat())); }
Exemplo n.º 12
0
MSString MSObservableTree<Element>::asMSF(void) const
{ return MSString();}
Exemplo n.º 13
0
MSString MSMBSDate::className(void) const
{ return MSString("MSMBSDate"); }
Exemplo n.º 14
0
MSAttrValueList& MSTableColumn::get(MSAttrValueList& avList_)
{
  MSStringVector aBoolVector("MSFalse\nMSTrue");
  avList_<<MSAttrValue("tag",tag().symbolName(),MSAttrValue::Control|MSAttrValue::String);
  avList_<<MSAttrValue("heading",MSAttrValue::stringVectorToString(heading()),MSAttrValue::String);
  avList_<<MSAttrValue("headingForeground",server()->colorName(headingForeground()),MSAttrValue::Color);
  avList_<<MSAttrValue("headingFont",server()->fontName(headingFont()),MSAttrValue::Font);
  MSStringVector alignmentVector("MSNone\nMSCenter\nMSTop\nMSBottom\nMSLeft\nMSRight");
  avList_<<MSAttrValue("headingAlignment",MSAttrValue::alignmentToString(headingAlignment()),
                       alignmentVector, MSAttrValue::List);
  avList_<<MSAttrValue("cycleColors",MSAttrValue::colorVectorToString(cycleColors(),server()),
                       MSAttrValue::Color|MSAttrValue::List|MSAttrValue::StringVector);
  const char *value;
  switch (cycleColorMode())
  {
  case MSBackground:   value="MSBackground";   break;
  case MSReverseVideo: value="MSReverseVideo"; break;
  case MSForeground:
  default:             value="MSForeground";   break;
  }
  avList_<<MSAttrValue("cycleColorMode",value, MSStringVector("MSBackground\nMSForeground\nMSReverseVideo"));
  switch (columnAlignment())
   {
   case MSCenter:  value="MSCenter"; break;
   case MSLeft:    value="MSLeft";   break;
   case MSRight:
   default:        value="MSRight";  break;
   }
  avList_<<MSAttrValue("columnAlignment",value,MSStringVector("MSLeft\nMSRight\nMSCenter"));
  MSStringVector clipModeVector("MSNoClipping\nMSClipStars");
  if(clipMode()==MSClipStars) value="MSClipStars";
  else value="MSNoClipping";
  avList_<<MSAttrValue("clipMode",value,clipModeVector);
  avList_<<MSAttrValue("columnWidth",MSString(columnWidth()));
  avList_<<MSAttrValue("editWidth",MSString(editWidth()));
  avList_<<MSAttrValue("resizable",resizable()==MSTrue?"MSTrue":"MSFalse",aBoolVector);
  avList_<<MSAttrValue("format",format().asString(),format().formats(),MSAttrValue::String);

  avList_<<MSAttrValue("breakOn",breakOn()==MSTrue?"MSTrue":"MSFalse",aBoolVector);
  
  MSStringVector modes="MSP::Total\nMSP::Minimum\nMSP::Maximum\nMSP::Average";
  MSUnsignedLongVector modeValues;
  modeValues.append(MSP::Total);
  modeValues.append(MSP::Minimum);
  modeValues.append(MSP::Maximum);
  modeValues.append(MSP::Average);

  MSString result=MSAttrValue::enumToString(breakProcessMode(),modes,modeValues,modes(0),MSTrue);
  
  avList_<<MSAttrValue("breakProcessMode",result,modes);
  avList_<<MSAttrValue("breakProcessOn",breakProcessOn()==MSTrue?"MSTrue":"MSFalse",aBoolVector);
  avList_<<MSAttrValue("breakBg",server()->colorName(breakBgPixel()),MSAttrValue::Color);
  avList_<<MSAttrValue("breakFg",server()->colorName(breakFgPixel()),MSAttrValue::Color);
//  avList_<<MSAttrValue("breakFont",server()->fontName(breakFont()),MSAttrValue::Font);
  avList_<<MSAttrValue("suppressDuplicate",suppressDuplicate()==MSTrue?"MSTrue":"MSFalse",aBoolVector);

  avList_<<MSAttrValue("columnresize","",MSAttrValue::Callback);
  avList_<<MSAttrValue("valueQuoted",valueQuoted()==MSTrue?"MSTrue":"MSFalse",aBoolVector);
  avList_<<MSAttrValue("choices",MSAttrValue::stringVectorToString(choices()),MSAttrValue::StringVector);
  return MSWidget::get(avList_);
}
Exemplo n.º 15
0
MSString MSObservableTree<Element>::className(void) const
{ return MSString("MSObservableTree"); }
Exemplo n.º 16
0
MSString MSIndexVector::className() const
{
  return MSString ("MSIndexVector");
}
Exemplo n.º 17
0
MSString MSObservableTree<Element>::asDebugInfo(void) const
{ return MSString();}
Exemplo n.º 18
0
MSString MSTypeVector<unsigned long>::className() const
{
  return MSString ("MSTypeVector<unsigned long>");
}
Exemplo n.º 19
0
MSString MSTerm::className(void) const
{ return MSString("MSTerm"); }
Exemplo n.º 20
0
MSString MSTerm::asString(void) const
{ MSString aString; return MSString(format(aString)); }
Exemplo n.º 21
0
MSString MSTypeVector<MSString>::className() const
{
  return MSString ("MSTypeVector<MSString>");
}
Exemplo n.º 22
0
const char *MSNumericArrayView::formatValue(MSString &buffer_,int data_)
{
    buffer_=MSString(data_);
    return buffer_.string();
}