GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — mexcppclass/source/matlab/existargumentvalidator.cpp at master · rymut/mexcppclass

Expand file tree

/

existargumentvalidator.cpp

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
66 lines (56 loc) · 1.94 KB
/

existargumentvalidator.cpp

Copy path

File metadata and controls

66 lines (56 loc) · 1.94 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/// Copyright (C) 2017 by Boguslaw Rymut
///
/// This file is distributed under the Apache 2.0 License
/// See LICENSE for details.
#include "mexcppclass/matlab/existargumentvalidator.hpp"
#include <string>
#include "mexcppclass/utility/string.hpp"
namespace mexcppclass {
namespace matlab {
ExistArgumentValidator::ExistArgumentValidator(const Argument &type,
const int &position) : ExistsArgumentValidator(type) {
this->argument_ = type;
this->position_ = position;
}
ExistArgumentValidator::~ExistArgumentValidator() {
}
const mxArray *ExistArgumentValidator::GetArgument(const int &nrhs,
const mxArray * const * const prhs,
const int &nlhs, const mxArray * const * const plhs) const {
if (this->argument_ == Argument::Output &&
nlhs > this->position_ && plhs != nullptr ) {
return plhs[this->position_];
}
if (this->argument_ == Argument::Input &&
nrhs > this->position_ && prhs != nullptr) {
return prhs[this->position_];
}
return nullptr;
}
bool ExistArgumentValidator::IsValid(const int &nrhs,
const mxArray * const * const prhs,
const int nlhs, const mxArray * const * const plhs,
MessageDeque &deque) const {
const mxArray *array = this->GetArgument(nrhs, prhs, nlhs, plhs);
if (array == nullptr) {
deque.push_back(Message(MsgId::RequiredArgumentMissing, "exist",
utility::FormatString("%s is required", this->GetArgName())));
return false;
}
return true;
}
int ExistArgumentValidator::GetPosition() const {
return this->position_;
}
Argument ExistArgumentValidator::GetArgument() const {
return this->argument_;
}
std::string ExistArgumentValidator::GetArgName() const {
if (this->argument_ == Argument::Input) {
return utility::FormatString("argin(%d)", this->GetPosition() + 1);
} else {
return utility::FormatString("argout(%d)", this->GetPosition() + 1);
}
}
} // namespace matlab
} // namespace mexcppclass
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.