Diff for /Amaya/amaya/templateUtils.c between versions 1.43 and 1.44

version 1.43, 2009/08/28 09:02:27 version 1.44, 2009/09/07 14:01:56
Line 11 Line 11
   
 #include "AHTURLTools_f.h"  #include "AHTURLTools_f.h"
 #include "HTMLsave_f.h"  #include "HTMLsave_f.h"
   #include "templateUtils_f.h"
   
 #include <stdarg.h>  #include <stdarg.h>
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
Line 42  const char *GetSchemaFromDocType (Docume Line 41  const char *GetSchemaFromDocType (Docume
 }  }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
     IsUseInstantiated
     Return TRUE if the use must be instantiated
     ----------------------------------------------------------------------*/
   ThotBool IsUseInstantiated (Element el, Document doc)
   {
   #ifdef TEMPLATES
     Element       parent;
     ElementType     elType, parentType;
     int           option;
     ThotBool      opt;
   
     elType = TtaGetElementType (el);
     if (elType.ElTypeNum == Template_EL_useEl &&
         elType.ElSSchema &&
         !strcmp (TtaGetSSchemaName (elType.ElSSchema), "Template"))
       {
         parent = TtaGetParent (el);
         parentType = TtaGetElementType (parent);
         if (parentType.ElTypeNum == Template_EL_repeat &&
             parentType.ElSSchema == elType.ElSSchema &&
             el == TtaGetFirstChild (parent))
           {
             // check if the minOccurs of the repeat is 0
             option = GetMinOccurence (parent, doc);
             opt = option != 0;
           }
         else
           {
             option = GetAttributeIntValueFromNum (el, Template_ATTR_option);
             opt = (option == 0 || option == Template_ATTR_option_VAL_option_set);
           }
     return opt;
       }
   #endif /* TEMPLATES */
     return FALSE;
   }
   
   /*----------------------------------------------------------------------
 Set the value of a string attribute  Set the value of a string attribute
 ----------------------------------------------------------------------*/  ----------------------------------------------------------------------*/
 void SetAttributeStringValue (Element el, int att, const char* value)  void SetAttributeStringValue (Element el, int att, const char* value)
Line 91  void SetAttributeStringValueWithUndo (El Line 128  void SetAttributeStringValueWithUndo (El
 #endif /* TEMPLATES */  #endif /* TEMPLATES */
 }  }
   
   
   /*----------------------------------------------------------------------
     GetMinOccurence returns the minOccurs value
   ----------------------------------------------------------------------*/
   int GetMinOccurence (Element el, Document doc)
   {
     int            minVal = 1;
   #ifdef TEMPLATES
     AttributeType  minType;
     Attribute      minAtt;
     char          *text;
   
     // Get minOccurs
     minType.AttrSSchema = TtaGetElementType (el).ElSSchema;
     minType.AttrTypeNum = Template_ATTR_minOccurs;
     minAtt = TtaGetAttribute (el, minType);
     if (minAtt)
       {
         text = GetAttributeStringValue(el, minAtt, NULL);
         if (text)
           {
             minVal = atoi(text);
             TtaFreeMemory(text);
           }
       }
   #endif /* TEMPLATES */
     return minVal;
   }
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
 Returns the value of a string attribute without copy it  Returns the value of a string attribute without copy it
 ----------------------------------------------------------------------*/  ----------------------------------------------------------------------*/
Line 113  void GiveAttributeStringValueFromNum (El Line 179  void GiveAttributeStringValueFromNum (El
 #endif /* TEMPLATES */  #endif /* TEMPLATES */
 }  }
   
   
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
   Returns the value of a string attribute or NULL    Returns the value of a string attribute or NULL
 ----------------------------------------------------------------------*/  ----------------------------------------------------------------------*/
Line 191  void SetAttributeIntValue (Element el, i Line 255  void SetAttributeIntValue (Element el, i
 #endif /* TEMPLATES */  #endif /* TEMPLATES */
 }  }
   
   
   
   
 /*----------------------------------------------------------------------  /*----------------------------------------------------------------------
 Returns the value of a string attribute  Returns the value of a string attribute
 ----------------------------------------------------------------------*/  ----------------------------------------------------------------------*/

Removed from v.1.43  
changed lines
  Added in v.1.44


Webmaster