From: <mog...@li...> - 2010-04-13 04:25:58
|
Revision: 305 http://mogre.svn.sourceforge.net/mogre/?rev=305&view=rev Author: mzanin Date: 2010-04-13 04:25:52 +0000 (Tue, 13 Apr 2010) Log Message: ----------- Added Mogre17.cs Added Paths: ----------- trunk/Mogre/AutoWrap/Meta/Mogre17.cs Added: trunk/Mogre/AutoWrap/Meta/Mogre17.cs =================================================================== --- trunk/Mogre/AutoWrap/Meta/Mogre17.cs (rev 0) +++ trunk/Mogre/AutoWrap/Meta/Mogre17.cs 2010-04-13 04:25:52 UTC (rev 305) @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; + +namespace AutoWrap.Meta +{ + internal class Mogre17 + { + public static string GetBaseType(DefTypeDef typedef) + { + string baseTypeName = typedef.BaseTypeName; + + if (string.IsNullOrEmpty(baseTypeName)) + { + return baseTypeName; + } + + int charPos = baseTypeName.IndexOf("<"); + string ogreTypeDef = charPos == -1 ? baseTypeName : baseTypeName.Substring(0, charPos); + + if (IsStdCollection(ogreTypeDef)) + { + return "std::" + ogreTypeDef; + } + + if (ogreTypeDef.Equals("HashedVector", StringComparison.Ordinal)) + { + return ogreTypeDef; + } + + return baseTypeName; + } + + private static readonly IEnumerable<string> s_StdHacks = new[] + { + "vector", "set", "deque", "list", "map", "multimap", "hash_map", "pair" + }; + + public static bool IsStdCollection(string baseTypeName) + { + foreach (var thing in s_StdHacks) + { + if (baseTypeName.Equals(thing, StringComparison.Ordinal)) + { + return true; + } + } + + return false; + } + + public static bool IsCollection(string baseTypeName) + { + return IsStdCollection(baseTypeName) || + baseTypeName.Equals("HashedVector", StringComparison.Ordinal); + } + } +} \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |