10 changed files with 251 additions and 92 deletions
@ -0,0 +1,16 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
|
||||||
|
namespace ICSharpCode.PackageManagement.EnvDTE |
||||||
|
{ |
||||||
|
public class CodeGetterFunction : CodeGetterOrSetterFunction |
||||||
|
{ |
||||||
|
public CodeGetterFunction(IProperty property) |
||||||
|
: base(property, property.GetterModifiers) |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,29 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
|
||||||
|
namespace ICSharpCode.PackageManagement.EnvDTE |
||||||
|
{ |
||||||
|
public class CodeGetterOrSetterFunction : CodeFunction |
||||||
|
{ |
||||||
|
ModifierEnum modifier; |
||||||
|
|
||||||
|
public CodeGetterOrSetterFunction(IProperty property, ModifierEnum modifier) |
||||||
|
: base(property) |
||||||
|
{ |
||||||
|
this.modifier = modifier; |
||||||
|
} |
||||||
|
|
||||||
|
public override vsCMAccess Access { |
||||||
|
get { |
||||||
|
if (modifier == ModifierEnum.None) { |
||||||
|
return base.Access; |
||||||
|
} |
||||||
|
return vsCMAccess.vsCMAccessPrivate; |
||||||
|
} |
||||||
|
set { } |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -0,0 +1,16 @@ |
|||||||
|
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||||
|
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||||
|
|
||||||
|
using System; |
||||||
|
using ICSharpCode.SharpDevelop.Dom; |
||||||
|
|
||||||
|
namespace ICSharpCode.PackageManagement.EnvDTE |
||||||
|
{ |
||||||
|
public class CodeSetterFunction : CodeGetterOrSetterFunction |
||||||
|
{ |
||||||
|
public CodeSetterFunction(IProperty property) |
||||||
|
: base(property, property.SetterModifiers) |
||||||
|
{ |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
@ -1,77 +0,0 @@ |
|||||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
|
||||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
|
||||||
|
|
||||||
using System; |
|
||||||
using System.Collections.Generic; |
|
||||||
using System.Linq; |
|
||||||
using ICSharpCode.PackageManagement.EnvDTE; |
|
||||||
|
|
||||||
namespace PackageManagement.Tests.Helpers |
|
||||||
{ |
|
||||||
public static class CodeElementsHelpers |
|
||||||
{ |
|
||||||
public static List<CodeElement> ToList(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
var list = new List<CodeElement>(); |
|
||||||
foreach (CodeElement codeElement in codeElements) { |
|
||||||
list.Add(codeElement); |
|
||||||
} |
|
||||||
return list; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeElement FirstOrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return ToList(codeElements).FirstOrDefault(); |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeFunction FirstCodeFunctionOrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.FirstOrDefault() as CodeFunction; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeClass2 FirstCodeClass2OrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.FirstOrDefault() as CodeClass2; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeInterface FirstCodeInterfaceOrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.FirstOrDefault() as CodeInterface; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeAttributeArgument FirstCodeAttributeArgumentOrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.FirstOrDefault() as CodeAttributeArgument; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeNamespace FirstCodeNamespaceOrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.FirstOrDefault() as CodeNamespace; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeNamespace LastCodeNamespaceOrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.LastOrDefault() as CodeNamespace; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeElement LastOrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.ToList().LastOrDefault(); |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeAttribute2 FirstCodeAttribute2OrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.FirstOrDefault() as CodeAttribute2; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeProperty2 FirstCodeProperty2OrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.FirstOrDefault() as CodeProperty2; |
|
||||||
} |
|
||||||
|
|
||||||
public static CodeVariable FirstCodeVariableOrDefault(this CodeElements codeElements) |
|
||||||
{ |
|
||||||
return codeElements.FirstOrDefault() as CodeVariable; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
Loading…
Reference in new issue