Exemple #1
0
void mtstring::atlocation(const double& rX,
                          const double& rY,
                          MString& rValues) const
{
  rValues.SetDefined(false);

  if(IsDefined() &&
     IsValidLocation(rX, rY))
  {
    rValues.SetDefined(true);

    Rectangle<3> boundingBox;
    bbox(boundingBox);
    Instant minimumTime = boundingBox.MinD(2);
    Instant maximumTime = boundingBox.MaxD(2);
    datetime::DateTime duration = m_Grid.GetDuration();

    rValues.StartBulkLoad();

    for(Instant currentTime = minimumTime;
        currentTime < maximumTime;
        currentTime += duration)
    {
      CcString value;
      atlocation(rX, rY, currentTime.ToDouble(), value);

      if(value.IsDefined())
      {
        Interval<Instant> interval(currentTime, currentTime + duration,
                                   true, false);
        rValues.Add(UString(interval, value, value));
      }
    }

    rValues.EndBulkLoad();

    if(rValues.IsEmpty())
    {
      rValues.SetDefined(false);
    }
  }
}
Exemple #2
0
STDMETHODIMP CUUEngine::get_DFileDetail(short row, short itemno, short subscr, VARIANT *pVal)
{
	MString cs;
	CComVariant lv;
	int *ip;
	struct _uufile *ufp;
	long lct;

	uulist *l = ue.GetUulp(row);

	if (l == NULL)
		return(CTL_E_INVALIDPROPERTYARRAYINDEX);

	switch (itemno) {
		case UUVBLD_STATE:
			lv = l->state;
			break;

		case UUVBLD_MODE:
			lv = l->mode;
			break;

		case UUVBLD_BEGIN:
			lv = (short) l->begin;
			break;

		case UUVBLD_END:
			lv = (short) l->end;
			break;

		case UUVBLD_UUDET:
			lv = l->uudet;
			break;

		case UUVBLD_FLAGS:
			lv = (short) l->flags;
			break;

		case UUVBLD_SIZE:
			lv = l->size;
			break;

		case UUVBLD_FILEN:
			cs = l->filename;
			break;

		case UUVBLD_SUBF:
			cs = l->subfname;
			break;

		case UUVBLD_MIMEID:
			cs = l->mimeid;
			break;

		case UUVBLD_MIMETYPE:
			cs = l->mimetype;
			break;

		case UUVBLD_BINFILE:
			cs = l->binfile;
			break;

		case UUVBLD_HAVEPART:
		case UUVBLD_MISSPART:
			if (subscr < 0 || subscr > 255)
				return(CTL_E_INVALIDPROPERTYARRAYINDEX);

			ip = ((itemno == UUVBLD_HAVEPART) ? l->haveparts : l->misparts)
				+ subscr;

			if (IsBadReadPtr(ip, sizeof(int)))
				return(CTL_E_INVALIDPROPERTYARRAYINDEX);

			lv = (short) *ip;
			break;

		case UUVBLD_UFPART:
			if (subscr < 0 || subscr > 255)
				return(CTL_E_INVALIDPROPERTYARRAYINDEX);

			for (ufp=l->thisfile; ufp != NULL && subscr > 0; subscr--)
				ufp = ufp->NEXT;

			if (ufp == NULL)
				return(CTL_E_INVALIDPROPERTYARRAYINDEX);

			lv = ufp->partno;
			break;


		case UUVBLD_UFRSUBJ:
		case UUVBLD_UFRORG:
		case UUVBLD_UFRSFN:
		case UUVBLD_UFRSTART:		// uulist.thisfile[subscr].data.start
		case UUVBLD_UFRLEN:			// uulist.thisfile[subscr].data.length
			if (subscr < 0 || subscr > 255)
				return(CTL_E_INVALIDPROPERTYARRAYINDEX);

			for (ufp=l->thisfile; ufp != NULL && subscr > 0; subscr--)
				ufp = ufp->NEXT;

			if (ufp == NULL || ufp->data == NULL)
				return(CTL_E_INVALIDPROPERTYARRAYINDEX);

			switch (itemno) 
			{
				case UUVBLD_UFRSUBJ:
					cs = ufp->data->subject;
					break;

				case UUVBLD_UFRORG:
					cs = ufp->data->origin;
					break;

				case UUVBLD_UFRSFN:
					cs = ufp->data->sfname;
					break;

				case UUVBLD_UFRSTART:		// uulist.thisfile[subscr].data.start
					lv = ufp->data->startpos;
					break;

				case UUVBLD_UFRLEN:			// uulist.thisfile[subscr].data.length
					lv = ufp->data->length;
					break;
			}
			break;

		case UUVBLD_UFRCOUNT:			// Figure out the number of parts this subsection has
			lct = 0;

			ufp = l->thisfile; 

			while (ufp != NULL)
			{
				ufp = ufp->NEXT;
				lct++;
			}

			lv = lct;
			break;

		}

	if (!cs.IsEmpty()) 			// This is a string return
	{
		lv.vt = VT_BSTR;
		cs.ToBSTR(&lv.bstrVal);
	}

	lv.Copy(pVal);

	return S_OK;
}