Ejemplo n.º 1
0
/*----------------------------------------------------------------------
  SetDAVConf: update the DAV preferences based on the 
  preference dialog options.         
  ---------------------------------------------------------------------- */
void SetDAVConf (void)
{
  /* ****** User reference -  DAVUserURL ***** */
  /* if there's something in textUserReference, analyse it*/    
  if (verifyString (GProp_DAV.textUserReference) > 0) 
    {
      /*remove first and last space */     
      CleanFirstLastSpace (GProp_DAV.textUserReference);
      /* copy the info */
      strcpy (DAVUserURL, GProp_DAV.textUserReference);
    }
  
  /* ***** Lock depth -  DAVDepth **** */
  /* we control the radioDepth content in DAVPreferencesDlg_callback */
  strcpy (DAVDepth, GProp_DAV.radioDepth);
  
  /* ***** Lock scope -  DAVLockScope **** */
  /* we control the radioLockScope content in DAVPreferencesDlg_callback */
  strcpy (DAVLockScope, GProp_DAV.radioLockScope);
  
  /* ***** Lock timout -  DAVTimeout **** */
  if (!strcmp(GProp_DAV.radioTimeout, "Infinite"))
    strcpy (DAVTimeout, GProp_DAV.radioTimeout);
  else
    {
      if (GProp_DAV.numberTimeout < 300) GProp_DAV.numberTimeout = 300;
      sprintf (DAVTimeout, "%s%d", GProp_DAV.radioTimeout, GProp_DAV.numberTimeout);
    }
  /* ***** save registry ***** */
  DAVSaveRegistry ();
}
Ejemplo n.º 2
0
int CyPy_Task::setattro(const Py::String& name, const Py::Object& attr)
{

    auto nameStr = name.as_string();
    if (nameStr == "progress") {
        m_value->progress() = verifyNumeric(attr);
        return 0;
    }
    if (nameStr == "duration") {
        m_value->m_duration = verifyNumeric(attr);
        return 0;
    }
    if (nameStr == "tick_interval") {
        m_value->m_tick_interval = verifyNumeric(attr);
        return 0;
    }
    if (nameStr == "name") {
        m_value->name() = verifyString(attr);
        return 0;
    }

    auto element = CyPy_Element::asElement(attr);
    m_value->setAttr(nameStr, element);
    return 0;
}
Ejemplo n.º 3
0
/* --------------------------------------------------------
 * this function treats the start elements parsered.
 *
 * Parameters :
 *      void *userData : user data
 *      char *name : element readed
 *      char **attr : element attributes
 * --------------------------------------------------------
 */
extern void AwParser_startElement(void *userData, const char *name, const char **attr) 
{
    AwTree *tree = (AwTree *)userData;
    AwNode *node;
#ifdef DEBUG
    AwPair *pair;
    int i;
#endif              

    if (verifyString((char *)name)<=0)                  /* ignore lines like "\n" */
           return;

    node = AwParser_makeNode ((char *)name, (char **)attr, strlen(name), XML_ELEMENT);

    AwTree_putNewNode(tree,node);                      /* put the new node in the tree */

#ifdef DEBUG
    for (i = 0; i < AwNode_getLevel(node); i++)        /* show it */
        fprintf(stderr,"\t");
    fprintf (stderr,"%s\n", AwNode_getInfo(node));
    AwNode_resetAttributes(node);
    pair = AwNode_nextAttribute(node);
    while (pair!=NULL) 
     {
        for (i = 0; i < AwNode_getLevel(node) + 1 ; i++)
            fprintf(stderr,"\t");
        fprintf (stderr,"%s = %s \n",AwPair_getName(pair),AwPair_getValue(pair));
        pair = AwNode_nextAttribute(node);
     }
#endif              

}
Ejemplo n.º 4
0
/* --------------------------------------------------------
 * this function treats the text elements parsered.
 *
 * Parameters :
 *      void *userData : user data
 *      XML_char *s : data readed
 *      int len : s vector length
 * --------------------------------------------------------
 */
extern void AwParser_textElement (void *userData,const XML_Char *s,int len) 
{
    AwTree *tree = (AwTree *)userData;
    AwNode *node;
    char *data;
#ifdef DEBUG
    int i;
#endif

     data = (char *) AW_CALLOC (len+1,sizeof (char));
     strncpy (data,s,len);
     data[len]='\0';

     if (verifyString(data)<=0)                         /* ignore lines like "\n" */
           return;

     node = AwParser_makeNode (data,NULL,len,TEXT_ELEMENT);      /* create the new node */

     AwTree_putNewNode(tree,node);                      /* put the new node in the tree */

#ifdef DEBUG
     for (i = 0; i < AwNode_getLevel(node); i++)        /* show it */
            fprintf(stderr,"\t");
     fprintf (stderr,"%s\n",AwNode_getInfo(node));
#endif

     AW_FREE (data);

}
Ejemplo n.º 5
0
Py::Object CyPy_Task::irrelevant(const Py::Tuple& args)
{
    m_value->irrelevant();
    if (args.size() > 0) {
        args.verify_length(1);
        Atlas::Objects::Operation::Error e;
        Atlas::Objects::Entity::Anonymous arg;
        arg->setAttr("message", verifyString(args.front()));
        e->modifyArgs().push_back(arg);
        e->setTo(m_value->m_usageInstance.actor->getId());
        return CyPy_Operation::wrap(e);
    }
    return Py::None();
}
Ejemplo n.º 6
0
void IntlTestDecimalFormatAPI::TestScale()
{
    typedef struct TestData {
        double inputValue;
        int inputScale;
        const char *expectedOutput;
    } TestData;

    static TestData testData[] = {
        { 100.0, 3,  "100,000" },
        { 10034.0, -2, "100.34" },
        { 0.86, -3, "0.0009" },
        { -0.000455, 1, "-0%" },
        { -0.000555, 1, "-1%" },
        { 0.000455, 1, "0%" },
        { 0.000555, 1, "1%" },
    };

    UErrorCode status = U_ZERO_ERROR;
    DecimalFormat pat(status);
    if(U_FAILURE(status)) {
      errcheckln(status, "ERROR: Could not create DecimalFormat (default) - %s", u_errorName(status));
      return;
    }

    UnicodeString message;
    UnicodeString resultStr;
    UnicodeString exp;
    UnicodeString percentPattern("#,##0%");
    pat.setMaximumFractionDigits(4);

    for(int32_t i=0; i < UPRV_LENGTHOF(testData); i++) {
        if ( i > 2 ) {
            pat.applyPattern(percentPattern,status);
        }
        pat.setAttribute(UNUM_SCALE,testData[i].inputScale,status);
        pat.format(testData[i].inputValue, resultStr);
        message = UnicodeString("Unexpected output for ") + testData[i].inputValue + UnicodeString(" and scale ") +
                  testData[i].inputScale + UnicodeString(". Got: ");
        exp = testData[i].expectedOutput;
        verifyString(message, resultStr, exp);
        message.remove();
        resultStr.remove();
        exp.remove();
    }
}
Ejemplo n.º 7
0
CyPy_MemEntity::CyPy_MemEntity(Py::PythonClassInstanceWeak* self, Py::Tuple& args, Py::Dict& kwds)
    : CyPy_LocatedEntityBase(self, args, kwds)
{
    args.verify_length(1);

    auto arg = args.front();
    if (arg.isString()) {
        auto id = verifyString(args.front());

        long intId = integerId(id);
        if (intId == -1L) {
            throw Py::TypeError("MemEntity() requires string/int ID");
        }
        m_value = new MemEntity(id, intId);
    } else if (CyPy_MemEntity::check(arg)) {
        m_value = CyPy_MemEntity::value(arg);
    } else {
        throw Py::TypeError("MemEntity() requires string ID or MemEntity");
    }
}
Ejemplo n.º 8
0
/* --------------------------------------------------------
 * this function treats the end elements parsered.
 *
 * Parameters :
 *      void *userData : user data
 *      XML_char *name : element readed
 * --------------------------------------------------------
 */
extern void AwParser_endElement(void *userData, const char *name) 
{
    AwTree *tree = (AwTree *)userData;
    AwNode *last = NULL;

    if (verifyString((char *)name)<=0)                 /* ignore lines like "\n" */
           return;

    last = AwTree_getLast(tree);
    if (AwNode_getType(last)!=XML_ELEMENT)
     {                                           /* with text element, we need to get up twice */
                                                 /* to reach the last xml element */       
#ifdef DEBUG 
        fprintf (stderr,"going up twice\n");
#endif      
        AwTree_up(tree);                                
     }   

     AwTree_up(tree);
}
Ejemplo n.º 9
0
Py::Object CyPy_WorldTime::is_now(const Py::Tuple& args)
{
    args.verify_length(1);
    return Py::Boolean(get_value() == verifyString(args.front()));
}