Пример #1
0
        public RepresentationEngine()
        {
            global_library   = new GlobalLibrary();
            class_library    = new ClassLibrary();
            fragment_library = new FragmentLibrary();

            instancers   = new Dictionary <string, RepresentationInstancer>();
            constructors = new Dictionary <string, List <RepresentationConstructor> >();

            constructor_cache = new OperationCache <RepresentationConstructor, string, ContentsEnumerable <Type> >("constructor_cache", delegate(string name, ContentsEnumerable <Type> parameter_types) {
                return(constructors.GetValues(name)
                       .FindFirst(c => c.GetParameterTypes().AreElements(parameter_types, (p1, p2) => p1.CanHold(p2))));
            });

            infos = new Dictionary <string, TypeDictionary <RepresentationInfo> >();

            info_sets         = new Dictionary <Type, List <RepresentationInfoSet> >();
            general_modifiers = new Dictionary <Type, List <RepresentationModifier_General> >();
        }
Пример #2
0
 static public void AddFragmentProviders(this FragmentLibrary item, params FragmentProvider[] to_add)
 {
     item.AddFragmentProviders((IEnumerable <FragmentProvider>)to_add);
 }
Пример #3
0
 static public void AddFragmentProviders(this FragmentLibrary item, IEnumerable <FragmentProvider> to_add)
 {
     to_add.Process(f => item.AddFragmentProvider(f));
 }
Пример #4
0
 static public void AddFragments(this FragmentLibrary item, params CmlFragment[] to_add)
 {
     item.AddFragments((IEnumerable <CmlFragment>)to_add);
 }
Пример #5
0
 static public void AddFragments(this FragmentLibrary item, IEnumerable <CmlFragment> to_add)
 {
     to_add.Process(f => item.AddFragment(f));
 }
Пример #6
0
 static public void AddFragment(this FragmentLibrary item, string name, string text)
 {
     item.AddFragment(
         new CmlFragment_Entity(name, CmlEntity.DOMify(text))
         );
 }