Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
googletest
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
googletest
Commits
3f5b5b8f
Commit
3f5b5b8f
authored
May 03, 2019
by
Abseil Team
Committed by
gennadiycivil
May 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Googletest export
Remove special case for protocol buffers. It is no longer needed. PiperOrigin-RevId: 246550795
parent
bf3ef5c9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
67 deletions
+11
-67
gmock-actions.h
googlemock/include/gmock/gmock-actions.h
+11
-67
No files found.
googlemock/include/gmock/gmock-actions.h
View file @
3f5b5b8f
...
@@ -769,47 +769,15 @@ class SetErrnoAndReturnAction {
...
@@ -769,47 +769,15 @@ class SetErrnoAndReturnAction {
#endif // !GTEST_OS_WINDOWS_MOBILE
#endif // !GTEST_OS_WINDOWS_MOBILE
// Implements the SetArgumentPointee<N>(x) action for any function
// Implements the SetArgumentPointee<N>(x) action for any function
// whose N-th argument (0-based) is a pointer to x's type. The
// whose N-th argument (0-based) is a pointer to x's type.
// template parameter kIsProto is true iff type A is
template
<
size_t
N
,
typename
A
,
typename
=
void
>
// proto2::Message or a sub-class of it.
struct
SetArgumentPointeeAction
{
template
<
size_t
N
,
typename
A
,
bool
kIsProto
>
A
value
;
class
SetArgumentPointeeAction
{
public
:
// Constructs an action that sets the variable pointed to by the
// N-th function argument to 'value'.
explicit
SetArgumentPointeeAction
(
const
A
&
value
)
:
value_
(
value
)
{}
template
<
typename
Result
,
typename
ArgumentTuple
>
void
Perform
(
const
ArgumentTuple
&
args
)
const
{
CompileAssertTypesEqual
<
void
,
Result
>
();
*::
std
::
get
<
N
>
(
args
)
=
value_
;
}
private
:
const
A
value_
;
GTEST_DISALLOW_ASSIGN_
(
SetArgumentPointeeAction
);
};
template
<
size_t
N
,
typename
Proto
>
class
SetArgumentPointeeAction
<
N
,
Proto
,
true
>
{
public
:
// Constructs an action that sets the variable pointed to by the
// N-th function argument to 'proto'.
explicit
SetArgumentPointeeAction
(
const
Proto
&
proto
)
:
proto_
(
new
Proto
)
{
proto_
->
CopyFrom
(
proto
);
}
template
<
typename
Result
,
typename
ArgumentTuple
>
template
<
typename
...
Args
>
void
Perform
(
const
ArgumentTuple
&
args
)
const
{
void
operator
()(
const
Args
&
...
args
)
const
{
CompileAssertTypesEqual
<
void
,
Result
>
();
*::
std
::
get
<
N
>
(
std
::
tie
(
args
...))
=
value
;
::
std
::
get
<
N
>
(
args
)
->
CopyFrom
(
*
proto_
);
}
}
private
:
const
std
::
shared_ptr
<
Proto
>
proto_
;
GTEST_DISALLOW_ASSIGN_
(
SetArgumentPointeeAction
);
};
};
// Implements the Invoke(object_ptr, &Class::Method) action.
// Implements the Invoke(object_ptr, &Class::Method) action.
...
@@ -1078,38 +1046,14 @@ inline internal::DoDefaultAction DoDefault() {
...
@@ -1078,38 +1046,14 @@ inline internal::DoDefaultAction DoDefault() {
// Creates an action that sets the variable pointed by the N-th
// Creates an action that sets the variable pointed by the N-th
// (0-based) function argument to 'value'.
// (0-based) function argument to 'value'.
template
<
size_t
N
,
typename
T
>
template
<
size_t
N
,
typename
T
>
PolymorphicAction
<
internal
::
SetArgumentPointeeAction
<
N
,
T
>
SetArgPointee
(
T
x
)
{
internal
::
SetArgumentPointeeAction
<
return
{
std
::
move
(
x
)};
N
,
T
,
internal
::
IsAProtocolMessage
<
T
>::
value
>
>
SetArgPointee
(
const
T
&
x
)
{
return
MakePolymorphicAction
(
internal
::
SetArgumentPointeeAction
<
N
,
T
,
internal
::
IsAProtocolMessage
<
T
>::
value
>
(
x
));
}
template
<
size_t
N
>
PolymorphicAction
<
internal
::
SetArgumentPointeeAction
<
N
,
const
char
*
,
false
>
>
SetArgPointee
(
const
char
*
p
)
{
return
MakePolymorphicAction
(
internal
::
SetArgumentPointeeAction
<
N
,
const
char
*
,
false
>
(
p
));
}
template
<
size_t
N
>
PolymorphicAction
<
internal
::
SetArgumentPointeeAction
<
N
,
const
wchar_t
*
,
false
>
>
SetArgPointee
(
const
wchar_t
*
p
)
{
return
MakePolymorphicAction
(
internal
::
SetArgumentPointeeAction
<
N
,
const
wchar_t
*
,
false
>
(
p
));
}
}
// The following version is DEPRECATED.
// The following version is DEPRECATED.
template
<
size_t
N
,
typename
T
>
template
<
size_t
N
,
typename
T
>
PolymorphicAction
<
internal
::
SetArgumentPointeeAction
<
N
,
T
>
SetArgumentPointee
(
T
x
)
{
internal
::
SetArgumentPointeeAction
<
return
{
std
::
move
(
x
)};
N
,
T
,
internal
::
IsAProtocolMessage
<
T
>::
value
>
>
SetArgumentPointee
(
const
T
&
x
)
{
return
MakePolymorphicAction
(
internal
::
SetArgumentPointeeAction
<
N
,
T
,
internal
::
IsAProtocolMessage
<
T
>::
value
>
(
x
));
}
}
// Creates an action that sets a pointer referent to a given value.
// Creates an action that sets a pointer referent to a given value.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment