Skip to content

Commit c8badf7

Browse files
authored
Merge pull request #2693 from changeworld/patch-19
Delete unnecessary spaces
2 parents 4da0e6b + f391f6c commit c8badf7

File tree

1 file changed

+133
-133
lines changed

1 file changed

+133
-133
lines changed

docs/extensibility/debugger/reference/idebuggenericparamfield-getconstraints.md

Lines changed: 133 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -2,145 +2,145 @@
22
title: "IDebugGenericParamField::GetConstraints | Microsoft Docs"
33
ms.date: "11/04/2016"
44
ms.topic: "conceptual"
5-
helpviewer_keywords:
5+
helpviewer_keywords:
66
- "IDebugGenericParamField::GetConstraints"
77
- "GetConstraints"
88
ms.assetid: 86a78b5a-ee0f-4999-a0ba-919d3dc7d969
99
author: "gregvanl"
1010
ms.author: "gregvanl"
1111
manager: jillfra
12-
ms.workload:
12+
ms.workload:
1313
- "vssdk"
1414
---
1515
# IDebugGenericParamField::GetConstraints
16-
Retrieves the constraints that are associated with this generic parameter.
17-
18-
## Syntax
19-
20-
```cpp
21-
HRESULT GetConstraints(
22-
ULONG32 cConstraints,
23-
IDebugField** ppConstraints,
24-
ULONG32* pcConstraints
25-
);
26-
```
27-
28-
```csharp
29-
int GetConstraints(
30-
uint cConstraints,
31-
out IDebugField[] ppConstraints,
32-
ref uint pcConstraints
33-
);
34-
```
35-
36-
#### Parameters
37-
`cConstraints`
38-
[in] Number of constraints.
39-
40-
`ppConstraints`
41-
[out] Returns an array that contains the constraints associated with this field.
42-
43-
`pcConstraints`
44-
[in, out] Number of constraints in the `ppConstraints` array.
45-
46-
## Return Value
47-
If successful, returns `S_OK`; otherwise, returns an error code.
48-
49-
## Example
50-
The following example shows how to implement this method for a **CDebugGenericParamFieldType** object that exposes the [IDebugGenericParamField](../../../extensibility/debugger/reference/idebuggenericparamfield.md) interface.
51-
52-
```cpp
53-
HRESULT CDebugGenericParamFieldType::GetConstraints(
54-
ULONG32 cConstraints,
55-
IDebugField** ppConstraints,
56-
ULONG32* pcConstraints)
57-
{
58-
HRESULT hr = S_OK;
59-
CComPtr<IMetaDataImport> pMetadata;
60-
CComPtr<IMetaDataImport2> pMetadata2;
61-
mdGenericParamConstraint* rgParamConsts = NULL;
62-
HCORENUM hEnum = 0;
63-
ULONG cConst = 0;
64-
ULONG iConst;
65-
ULONG iConstOut = 0;
66-
67-
METHOD_ENTRY( CDebugGenericParamFieldType::GetConstraints );
68-
69-
IfFalseGo(ppConstraints && pcConstraints, E_INVALIDARG );
70-
*pcConstraints = 0;
71-
72-
IfNullGo( rgParamConsts = new mdGenericParamConstraint[cConstraints], E_OUTOFMEMORY);
73-
74-
IfFailGo( m_spSH->GetMetadata( m_idModule, &pMetadata ) );
75-
IfFailGo( pMetadata->QueryInterface(IID_IMetaDataImport2, (void**)&pMetadata2) );
76-
IfFailGo( pMetadata2->EnumGenericParamConstraints( &hEnum,
77-
m_tokParam,
78-
rgParamConsts,
79-
cConstraints,
80-
&cConst) );
81-
pMetadata->CloseEnum(hEnum);
82-
hEnum = NULL;
83-
84-
for (iConst = 0; iConst < cConst; iConst++)
85-
{
86-
mdToken tokConst;
87-
88-
IfFailGo( pMetadata2->GetGenericParamConstraintProps( rgParamConsts[iConst],
89-
NULL,
90-
&tokConst ) );
91-
switch (TypeFromToken(tokConst))
92-
{
93-
case mdtTypeRef:
94-
{
95-
Module_ID mid;
96-
mdTypeDef tokClass;
97-
98-
IfFailGo( CDebugClassFieldType::GetClassToken(m_spSH, m_idModule, tokConst, &mid, &tokClass) );
99-
IfFailGo( m_spSH->CreateClassType( mid, tokClass, ppConstraints + iConstOut ) );
100-
iConstOut++;
101-
break;
102-
}
103-
case mdtTypeDef:
104-
{
105-
IfFailGo( m_spSH->CreateClassType( m_idModule, tokConst, ppConstraints + iConstOut ) );
106-
iConstOut++;
107-
break;
108-
}
109-
case mdtTypeSpec:
110-
{
111-
PCCOR_SIGNATURE pvSig;
112-
ULONG cbSig;
113-
DWORD cb = 0;
114-
DWORD dwElementType;
115-
116-
IfFailGo( pMetadata2->GetTypeSpecFromToken( tokConst, &pvSig, &cbSig) );
117-
118-
cb += CorSigUncompressData(&(pvSig[cb]), &dwElementType);
119-
120-
IfFailGo( m_spSH->CreateType( pvSig, cbSig, m_idModule, mdMethodDefNil, m_pGenScope, ppConstraints + iConstOut ) );
121-
122-
iConstOut++;
123-
124-
break;
125-
}
126-
default:
127-
{
128-
ASSERT(!"Bad constraint token");
129-
}
130-
}
131-
}
132-
133-
*pcConstraints = iConstOut;
134-
135-
Error:
136-
137-
METHOD_EXIT( CDebugGenericParamFieldType::GetConstraints, hr );
138-
139-
DELETERG(rgParamConsts);
140-
141-
return hr;
142-
}
143-
```
144-
145-
## See Also
146-
[IDebugGenericParamField](../../../extensibility/debugger/reference/idebuggenericparamfield.md)
16+
Retrieves the constraints that are associated with this generic parameter.
17+
18+
## Syntax
19+
20+
```cpp
21+
HRESULT GetConstraints(
22+
ULONG32 cConstraints,
23+
IDebugField** ppConstraints,
24+
ULONG32* pcConstraints
25+
);
26+
```
27+
28+
```csharp
29+
int GetConstraints(
30+
uint cConstraints,
31+
out IDebugField[] ppConstraints,
32+
ref uint pcConstraints
33+
);
34+
```
35+
36+
#### Parameters
37+
`cConstraints`
38+
[in] Number of constraints.
39+
40+
`ppConstraints`
41+
[out] Returns an array that contains the constraints associated with this field.
42+
43+
`pcConstraints`
44+
[in, out] Number of constraints in the `ppConstraints` array.
45+
46+
## Return Value
47+
If successful, returns `S_OK`; otherwise, returns an error code.
48+
49+
## Example
50+
The following example shows how to implement this method for a **CDebugGenericParamFieldType** object that exposes the [IDebugGenericParamField](../../../extensibility/debugger/reference/idebuggenericparamfield.md) interface.
51+
52+
```cpp
53+
HRESULT CDebugGenericParamFieldType::GetConstraints(
54+
ULONG32 cConstraints,
55+
IDebugField** ppConstraints,
56+
ULONG32* pcConstraints)
57+
{
58+
HRESULT hr = S_OK;
59+
CComPtr<IMetaDataImport> pMetadata;
60+
CComPtr<IMetaDataImport2> pMetadata2;
61+
mdGenericParamConstraint* rgParamConsts = NULL;
62+
HCORENUM hEnum = 0;
63+
ULONG cConst = 0;
64+
ULONG iConst;
65+
ULONG iConstOut = 0;
66+
67+
METHOD_ENTRY( CDebugGenericParamFieldType::GetConstraints );
68+
69+
IfFalseGo(ppConstraints && pcConstraints, E_INVALIDARG );
70+
*pcConstraints = 0;
71+
72+
IfNullGo( rgParamConsts = new mdGenericParamConstraint[cConstraints], E_OUTOFMEMORY);
73+
74+
IfFailGo( m_spSH->GetMetadata( m_idModule, &pMetadata ) );
75+
IfFailGo( pMetadata->QueryInterface(IID_IMetaDataImport2, (void**)&pMetadata2) );
76+
IfFailGo( pMetadata2->EnumGenericParamConstraints( &hEnum,
77+
m_tokParam,
78+
rgParamConsts,
79+
cConstraints,
80+
&cConst) );
81+
pMetadata->CloseEnum(hEnum);
82+
hEnum = NULL;
83+
84+
for (iConst = 0; iConst < cConst; iConst++)
85+
{
86+
mdToken tokConst;
87+
88+
IfFailGo( pMetadata2->GetGenericParamConstraintProps( rgParamConsts[iConst],
89+
NULL,
90+
&tokConst ) );
91+
switch (TypeFromToken(tokConst))
92+
{
93+
case mdtTypeRef:
94+
{
95+
Module_ID mid;
96+
mdTypeDef tokClass;
97+
98+
IfFailGo( CDebugClassFieldType::GetClassToken(m_spSH, m_idModule, tokConst, &mid, &tokClass) );
99+
IfFailGo( m_spSH->CreateClassType( mid, tokClass, ppConstraints + iConstOut ) );
100+
iConstOut++;
101+
break;
102+
}
103+
case mdtTypeDef:
104+
{
105+
IfFailGo( m_spSH->CreateClassType( m_idModule, tokConst, ppConstraints + iConstOut ) );
106+
iConstOut++;
107+
break;
108+
}
109+
case mdtTypeSpec:
110+
{
111+
PCCOR_SIGNATURE pvSig;
112+
ULONG cbSig;
113+
DWORD cb = 0;
114+
DWORD dwElementType;
115+
116+
IfFailGo( pMetadata2->GetTypeSpecFromToken( tokConst, &pvSig, &cbSig) );
117+
118+
cb += CorSigUncompressData(&(pvSig[cb]), &dwElementType);
119+
120+
IfFailGo( m_spSH->CreateType( pvSig, cbSig, m_idModule, mdMethodDefNil, m_pGenScope, ppConstraints + iConstOut ) );
121+
122+
iConstOut++;
123+
124+
break;
125+
}
126+
default:
127+
{
128+
ASSERT(!"Bad constraint token");
129+
}
130+
}
131+
}
132+
133+
*pcConstraints = iConstOut;
134+
135+
Error:
136+
137+
METHOD_EXIT( CDebugGenericParamFieldType::GetConstraints, hr );
138+
139+
DELETERG(rgParamConsts);
140+
141+
return hr;
142+
}
143+
```
144+
145+
## See Also
146+
[IDebugGenericParamField](../../../extensibility/debugger/reference/idebuggenericparamfield.md)

0 commit comments

Comments
 (0)