|
|
@@ -16,7 +16,6 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
{
|
|
|
void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode);
|
|
|
}
|
|
|
-
|
|
|
public class MemberBase
|
|
|
{
|
|
|
const string RootClassName = "XMLData";
|
|
|
@@ -60,6 +59,10 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
return value;
|
|
|
}
|
|
|
//xInt operator=(const int value) { AssignValue(value); return *this; }; //c#不可以重载=
|
|
|
+ public static implicit operator xInt(int value)
|
|
|
+ {
|
|
|
+ return new xInt(value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class xDouble : MemberBase
|
|
|
@@ -74,8 +77,15 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
return value;
|
|
|
}
|
|
|
//xDouble operator=(const double value) { AssignValue(value); return *this; }; //c#不可以重载=
|
|
|
+ public static implicit operator xDouble(double value)
|
|
|
+ {
|
|
|
+ return new xDouble(value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
public class xLong : MemberBase
|
|
|
{
|
|
|
public void AssignValue(long value) { m_sValue = value.ToString(); } //因为c#无=重载,所以修改为public public xLong() { AssignValue(0); }
|
|
|
@@ -88,6 +98,10 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
return value;
|
|
|
}
|
|
|
//xLong operator=(const long value) { AssignValue(value); return *this; }; //c#不可以重载=
|
|
|
+ public static implicit operator xLong(long value)
|
|
|
+ {
|
|
|
+ return new xLong(value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class xDWORD : MemberBase
|
|
|
@@ -102,6 +116,10 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
return value;
|
|
|
}
|
|
|
//xDWORD operator=(const DWORD value) { AssignValue(value); return *this; };
|
|
|
+ public static implicit operator xDWORD(uint value)
|
|
|
+ {
|
|
|
+ return new xDWORD(value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
public class xBool : MemberBase
|
|
|
@@ -127,7 +145,7 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- public class xTime_t : MemberBase
|
|
|
+ public class xTime_t : MemberBase
|
|
|
{
|
|
|
public void AssignValue(DateTime value) //因为c#无=重载,所以修改为public
|
|
|
{
|
|
|
@@ -147,6 +165,10 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
return Convert.ToDateTime(m_sValue);
|
|
|
}
|
|
|
//xTime_t operator=(const time_t value) { AssignValue(value); return *this; };
|
|
|
+ public static implicit operator xTime_t(DateTime value)
|
|
|
+ {
|
|
|
+ return new xTime_t(value);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// class __declspec(dllexport) xOleDateTime : public MemberBase //COleDateTime对应c#类型?统一改为time_t
|
|
|
@@ -161,7 +183,7 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
// xOleDateTime operator=(const COleDateTime value) { AssignValue(value); return *this; };
|
|
|
// };
|
|
|
|
|
|
- public class xOleDateTimeSpan : MemberBase
|
|
|
+ public class xOleDateTimeSpan : MemberBase
|
|
|
{
|
|
|
public void AssignValue(TimeSpan value) //因为c#无=重载,所以修改为public
|
|
|
{
|
|
|
@@ -180,6 +202,10 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
}
|
|
|
|
|
|
//xOleDateTimeSpan operator=(const COleDateTimeSpan value) { AssignValue(value); return *this; };
|
|
|
+ public static implicit operator xOleDateTimeSpan(TimeSpan value)
|
|
|
+ {
|
|
|
+ return new xOleDateTimeSpan(value);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
public class xRect : MemberBase
|
|
|
@@ -307,6 +333,10 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
return p;
|
|
|
}
|
|
|
//xPoint operator=(const CPoint value) { AssignValue(value); return *this; };
|
|
|
+ public static implicit operator xPoint(System.Drawing.Point value)
|
|
|
+ {
|
|
|
+ return new xPoint(value);
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
|
|
|
@@ -340,7 +370,7 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
create new element of type T
|
|
|
@return empty object of type T
|
|
|
*/
|
|
|
- public override ISlo newElement()
|
|
|
+ public override ISlo newElement()
|
|
|
{
|
|
|
T newItem = System.Activator.CreateInstance<T>();
|
|
|
//T newItem = default(T);
|
|
|
@@ -380,7 +410,7 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
|
|
|
//typedef std::vector<Slo*>::iterator __declspec(dllexport) SerializableIterator; //iterator?
|
|
|
|
|
|
- public class Slo: ISlo
|
|
|
+ public class Slo : ISlo
|
|
|
{
|
|
|
//private (Slo const &s) { }
|
|
|
//private Slo operator=(Slo const &s) { return *this; };
|
|
|
@@ -399,8 +429,8 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
public string m_sClassName;
|
|
|
public string m_sVersion;
|
|
|
public SortedDictionary<string, MemberBase> m_AttributeMappings = new SortedDictionary<string, MemberBase>();
|
|
|
- public SortedDictionary<string, ISlo> m_MemberMappings=new SortedDictionary<string, ISlo>();
|
|
|
- public SortedDictionary<string, CollectionBase<ISlo>> m_MemberCollections=new SortedDictionary<string, CollectionBase<ISlo>>();
|
|
|
+ public SortedDictionary<string, ISlo> m_MemberMappings = new SortedDictionary<string, ISlo>();
|
|
|
+ public SortedDictionary<string, CollectionBase<ISlo>> m_MemberCollections = new SortedDictionary<string, CollectionBase<ISlo>>();
|
|
|
|
|
|
public void setClassName(string ClassName) { m_sClassName = ClassName; }
|
|
|
public Slo()
|
|
|
@@ -448,18 +478,18 @@ namespace OTSIncAMeasureApp.SourceGridStringProvider
|
|
|
}
|
|
|
|
|
|
|
|
|
- public override void Serialize(bool isStoring, XmlDocument classDoc, XmlNode rootNode)
|
|
|
+ public override void Serialize(bool isStoring, XmlDocument xml, XmlNode rootNode)
|
|
|
{
|
|
|
if (isStoring)
|
|
|
{
|
|
|
- if (classDoc.DocumentElement != null)
|
|
|
+ if (xml.DocumentElement != null)
|
|
|
{
|
|
|
- toXML(classDoc, rootNode);
|
|
|
+ toXML(xml, rootNode);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- fromXML(classDoc, rootNode);
|
|
|
+ fromXML(xml, rootNode);
|
|
|
}
|
|
|
}
|
|
|
public void toXML(XmlDocument xml, XmlNode rootNode)
|