hexsha stringlengths 40 40 | size int64 7 1.05M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 4 269 | max_stars_repo_name stringlengths 5 108 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count int64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 4 269 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 40 | max_issues_repo_licenses listlengths 1 9 | max_issues_count int64 1 67k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 4 269 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 40 | max_forks_repo_licenses listlengths 1 9 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 7 1.05M | avg_line_length float64 1.21 330k | max_line_length int64 6 990k | alphanum_fraction float64 0.01 0.99 | author_id stringlengths 2 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
aabcaa409c50b922c940044845f7282aba871d3f | 11,251 | cpp | C++ | QtOpenGLDB/prism.cpp | as-i-see/OOPFundamentals2sem | a859001fba5e81446edf1e272909991fa2bfbd81 | [
"MIT"
] | null | null | null | QtOpenGLDB/prism.cpp | as-i-see/OOPFundamentals2sem | a859001fba5e81446edf1e272909991fa2bfbd81 | [
"MIT"
] | null | null | null | QtOpenGLDB/prism.cpp | as-i-see/OOPFundamentals2sem | a859001fba5e81446edf1e272909991fa2bfbd81 | [
"MIT"
] | null | null | null | #include "prism.h"
#include <QOpenGLFunctions>
void Prism::reconstruct() {
Vertex BA(this->dots[0].position());
Vertex BB(this->dots[1].position());
Vertex BC(this->dots[2].position());
Vertex BD(this->dots[3].position());
Vertex BE(this->dots[4].position());
Vertex BF(this->dots[5].position());
Vertex TA(this->dots[6].position());
QVector3D upVector = TA.position() - BA.position();
Vertex TB(BB.position() + upVector);
Vertex TC(BC.position() + upVector);
Vertex TD(BD.position() + upVector);
Vertex TE(BE.position() + upVector);
Vertex TF(BF.position() + upVector);
std::vector<Vertex> vertices = {// Bottom
BA, BF, BE, BD, BC, BB,
// Top
TA, TB, TC, TD, TE, TF,
// Face 1
BA, BB, TB, TA,
// Face 2
BB, BC, TC, TB,
// Face 3
BC, BD, TD, TC,
// Face 4
BD, BE, TE, TD,
// Face 5
BE, BF, TF, TE,
// Face 6
BF, BA, TA, TF};
this->dots = std::move(vertices);
}
void Prism::draw() {
if (this->isSelected()) {
glColor3f(153.0f / 255.0f, 51.0f / 255.0f, 255.0f / 255.0f);
} else {
glColor3f(this->color.x(), this->color.y(), this->color.z());
}
glPushMatrix();
glLoadMatrixf(this->transform.toMatrix().data());
for (int j = 0; j < 2; j++) {
glBegin(GL_POLYGON);
QVector3D normal = QVector3D::normal(this->dots[6 * j].position(),
this->dots[6 * j + 1].position(),
this->dots[6 * j + 2].position());
glNormal3f(normal.x(), normal.y(), normal.z());
glVertex3f(this->dots[6 * j].position().x(),
this->dots[6 * j].position().y(),
this->dots[6 * j].position().z());
glVertex3f(this->dots[6 * j + 1].position().x(),
this->dots[6 * j + 1].position().y(),
this->dots[6 * j + 1].position().z());
glVertex3f(this->dots[6 * j + 2].position().x(),
this->dots[6 * j + 2].position().y(),
this->dots[6 * j + 2].position().z());
glVertex3f(this->dots[6 * j + 3].position().x(),
this->dots[6 * j + 3].position().y(),
this->dots[6 * j + 3].position().z());
glVertex3f(this->dots[6 * j + 4].position().x(),
this->dots[6 * j + 4].position().y(),
this->dots[6 * j + 4].position().z());
glVertex3f(this->dots[6 * j + 5].position().x(),
this->dots[6 * j + 5].position().y(),
this->dots[6 * j + 5].position().z());
glEnd();
}
for (int j = 0; j < 6; j++) {
glBegin(GL_QUADS);
QVector3D normal = QVector3D::normal(this->dots[12 + 4 * j].position(),
this->dots[12 + 4 * j + 1].position(),
this->dots[12 + 4 * j + 2].position());
glNormal3f(normal.x(), normal.y(), normal.z());
glVertex3f(this->dots[12 + 4 * j].position().x(),
this->dots[12 + 4 * j].position().y(),
this->dots[12 + 4 * j].position().z());
glVertex3f(this->dots[12 + 4 * j + 1].position().x(),
this->dots[12 + 4 * j + 1].position().y(),
this->dots[12 + 4 * j + 1].position().z());
glVertex3f(this->dots[12 + 4 * j + 2].position().x(),
this->dots[12 + 4 * j + 2].position().y(),
this->dots[12 + 4 * j + 2].position().z());
glVertex3f(this->dots[12 + 4 * j + 3].position().x(),
this->dots[12 + 4 * j + 3].position().y(),
this->dots[12 + 4 * j + 3].position().z());
glEnd();
}
glPopMatrix();
}
void Prism::drawXYProjection() {
if (this->isSelected()) {
glColor3f(153.0f / 255.0f, 51.0f / 255.0f, 255.0f / 255.0f);
} else {
glColor3f(this->color.x(), this->color.y(), this->color.z());
}
glPushMatrix();
for (int j = 0; j < 2; j++) {
glBegin(GL_POLYGON);
glVertex3f((this->transform.toMatrix() * this->dots[6 * j].position()).x(),
(this->transform.toMatrix() * this->dots[6 * j].position()).y(),
0);
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 1].position()).x(),
(this->transform.toMatrix() * this->dots[6 * j + 1].position()).y(), 0);
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 2].position()).x(),
(this->transform.toMatrix() * this->dots[6 * j + 2].position()).y(), 0);
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 3].position()).x(),
(this->transform.toMatrix() * this->dots[6 * j + 3].position()).y(), 0);
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 4].position()).x(),
(this->transform.toMatrix() * this->dots[6 * j + 4].position()).y(), 0);
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 5].position()).x(),
(this->transform.toMatrix() * this->dots[6 * j + 5].position()).y(), 0);
glEnd();
}
for (int j = 0; j < 6; j++) {
glBegin(GL_QUADS);
glVertex3f(
(this->transform.toMatrix() * this->dots[12 + 4 * j].position()).x(),
(this->transform.toMatrix() * this->dots[12 + 4 * j].position()).y(),
0);
glVertex3f(
(this->transform.toMatrix() * this->dots[12 + 4 * j + 1].position())
.x(),
(this->transform.toMatrix() * this->dots[12 + 4 * j + 1].position())
.y(),
0);
glVertex3f(
(this->transform.toMatrix() * this->dots[12 + 4 * j + 2].position())
.x(),
(this->transform.toMatrix() * this->dots[12 + 4 * j + 2].position())
.y(),
0);
glVertex3f(
(this->transform.toMatrix() * this->dots[12 + 4 * j + 3].position())
.x(),
(this->transform.toMatrix() * this->dots[12 + 4 * j + 3].position())
.y(),
0);
glEnd();
}
glPopMatrix();
}
void Prism::drawXZProjection() {
if (this->isSelected()) {
glColor3f(153.0f / 255.0f, 51.0f / 255.0f, 255.0f / 255.0f);
} else {
glColor3f(this->color.x(), this->color.y(), this->color.z());
}
glPushMatrix();
for (int j = 0; j < 2; j++) {
glBegin(GL_POLYGON);
glVertex3f((this->transform.toMatrix() * this->dots[6 * j].position()).x(),
0,
(this->transform.toMatrix() * this->dots[6 * j].position()).z());
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 1].position()).x(), 0,
(this->transform.toMatrix() * this->dots[6 * j + 1].position()).z());
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 2].position()).x(), 0,
(this->transform.toMatrix() * this->dots[6 * j + 2].position()).z());
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 3].position()).x(), 0,
(this->transform.toMatrix() * this->dots[6 * j + 3].position()).z());
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 4].position()).x(), 0,
(this->transform.toMatrix() * this->dots[6 * j + 4].position()).z());
glVertex3f(
(this->transform.toMatrix() * this->dots[6 * j + 5].position()).x(), 0,
(this->transform.toMatrix() * this->dots[6 * j + 5].position()).z());
glEnd();
}
for (int j = 0; j < 6; j++) {
glBegin(GL_QUADS);
glVertex3f(
(this->transform.toMatrix() * this->dots[12 + 4 * j].position()).x(), 0,
(this->transform.toMatrix() * this->dots[12 + 4 * j].position()).z());
glVertex3f(
(this->transform.toMatrix() * this->dots[12 + 4 * j + 1].position())
.x(),
0,
(this->transform.toMatrix() * this->dots[12 + 4 * j + 1].position())
.z());
glVertex3f(
(this->transform.toMatrix() * this->dots[12 + 4 * j + 2].position())
.x(),
0,
(this->transform.toMatrix() * this->dots[12 + 4 * j + 2].position())
.z());
glVertex3f(
(this->transform.toMatrix() * this->dots[12 + 4 * j + 3].position())
.x(),
0,
(this->transform.toMatrix() * this->dots[12 + 4 * j + 3].position())
.z());
glEnd();
}
glPopMatrix();
}
void Prism::drawYZProjection() {
if (this->isSelected()) {
glColor3f(153.0f / 255.0f, 51.0f / 255.0f, 255.0f / 255.0f);
} else {
glColor3f(this->color.x(), this->color.y(), this->color.z());
}
glPushMatrix();
for (int j = 0; j < 2; j++) {
glBegin(GL_POLYGON);
glVertex3f(0,
(this->transform.toMatrix() * this->dots[6 * j].position()).y(),
(this->transform.toMatrix() * this->dots[6 * j].position()).z());
glVertex3f(
0, (this->transform.toMatrix() * this->dots[6 * j + 1].position()).y(),
(this->transform.toMatrix() * this->dots[6 * j + 1].position()).z());
glVertex3f(
0, (this->transform.toMatrix() * this->dots[6 * j + 2].position()).y(),
(this->transform.toMatrix() * this->dots[6 * j + 2].position()).z());
glVertex3f(
0, (this->transform.toMatrix() * this->dots[6 * j + 3].position()).y(),
(this->transform.toMatrix() * this->dots[6 * j + 3].position()).z());
glVertex3f(
0, (this->transform.toMatrix() * this->dots[6 * j + 4].position()).y(),
(this->transform.toMatrix() * this->dots[6 * j + 4].position()).z());
glVertex3f(
0, (this->transform.toMatrix() * this->dots[6 * j + 5].position()).y(),
(this->transform.toMatrix() * this->dots[6 * j + 5].position()).z());
glEnd();
}
for (int j = 0; j < 6; j++) {
glBegin(GL_QUADS);
glVertex3f(
0, (this->transform.toMatrix() * this->dots[12 + 4 * j].position()).y(),
(this->transform.toMatrix() * this->dots[12 + 4 * j].position()).z());
glVertex3f(
0,
(this->transform.toMatrix() * this->dots[12 + 4 * j + 1].position())
.y(),
(this->transform.toMatrix() * this->dots[12 + 4 * j + 1].position())
.z());
glVertex3f(
0,
(this->transform.toMatrix() * this->dots[12 + 4 * j + 2].position())
.y(),
(this->transform.toMatrix() * this->dots[12 + 4 * j + 2].position())
.z());
glVertex3f(
0,
(this->transform.toMatrix() * this->dots[12 + 4 * j + 3].position())
.y(),
(this->transform.toMatrix() * this->dots[12 + 4 * j + 3].position())
.z());
glEnd();
}
glPopMatrix();
}
QVector3D Prism::centreOfMass() {
QVector3D bottomCenter;
for (int i = 0; i < 6; i++) {
bottomCenter += this->dots[i].position();
}
bottomCenter /= 6.0f;
QVector3D topCenter;
for (int i = 0; i < 6; i++) {
topCenter += this->dots[6 + i].position();
}
topCenter /= 6.0f;
QVector3D center;
center += bottomCenter;
center += topCenter;
center /= 2.0f;
return center;
}
| 39.616197 | 80 | 0.483513 | as-i-see |
aabe0f77f24de2d84727e21fdbde6daa6501ff11 | 4,052 | hpp | C++ | addons/briefing/CfgDiary.hpp | YonVclaw/6sfdgdemo | f09b4ed8569cd0fcbca4c634aa79289f1ca84014 | [
"MIT"
] | null | null | null | addons/briefing/CfgDiary.hpp | YonVclaw/6sfdgdemo | f09b4ed8569cd0fcbca4c634aa79289f1ca84014 | [
"MIT"
] | null | null | null | addons/briefing/CfgDiary.hpp | YonVclaw/6sfdgdemo | f09b4ed8569cd0fcbca4c634aa79289f1ca84014 | [
"MIT"
] | null | null | null | class CfgDiary {
class FixedPages {
class Diary {
text = "%TEXT";
};
class Tasks {
text = "%LINK_SET_CURRENT_TASK<br /><br />%TASK_DESCRIPTION";
};
};
};
class RscHTML;
class RscControlsGroup;
class RscDisplayMainMap {
class controls {
class CA_ContentBackgroundd: RscText {
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
h = "18 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class CA_DiaryGroup: RscControlsGroup {
h = "safezoneH - 7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
class controls {
class CA_Diary: RscHTML {
h = 100;
w = "20.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
};
};
};
};
};
class RscDisplayDiary {
class controls {
class CA_ContentBackgroundd: RscText {
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
h = "18 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class CA_DiaryGroup: RscControlsGroup {
h = "safezoneH - 7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
class controls {
class CA_Diary: RscHTML {
h = 100;
w = "20.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
};
};
};
};
};
class RscDisplayGetReady: RscDisplayMainMap {
class controls {
class CA_ContentBackgroundd: RscText {
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
h = "18 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class CA_DiaryGroup: RscControlsGroup {
h = "safezoneH - 7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
class controls {
class CA_Diary: RscHTML {
h = 100;
w = "20.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
};
};
};
};
};
class RscDisplayServerGetReady: RscDisplayGetReady {
class controls {
class CA_ContentBackgroundd: RscText {
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
h = "18 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class CA_DiaryGroup: RscControlsGroup {
h = "safezoneH - 7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
class controls {
class CA_Diary: RscHTML {
h = 100;
w = "20.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
};
};
};
};
};
class RscDisplayClientGetReady: RscDisplayGetReady {
class controls {
class CA_ContentBackgroundd: RscText {
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
h = "18 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
class CA_DiaryGroup: RscControlsGroup {
h = "safezoneH - 7 * ((((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
w = "21.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
class controls {
class CA_Diary: RscHTML {
h = 100;
w = "20.5 * (((safezoneW / safezoneH) min 1.2) / 40) * 1.25"; // *1.25 = 6SFG
};
};
};
};
}; | 37.518519 | 97 | 0.449161 | YonVclaw |
aac15adf50b4c9b80b307e9fbc15ee51f86bc62b | 847 | cpp | C++ | problems21ruse/robot/1.cpp | Gomango999/codebreaker | 407c4ac7a69c8db52cc7d2a57034cdda243c9134 | [
"MIT"
] | null | null | null | problems21ruse/robot/1.cpp | Gomango999/codebreaker | 407c4ac7a69c8db52cc7d2a57034cdda243c9134 | [
"MIT"
] | null | null | null | problems21ruse/robot/1.cpp | Gomango999/codebreaker | 407c4ac7a69c8db52cc7d2a57034cdda243c9134 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
int main () {
int K;
cin >> K;
string directions;
cin >> directions;
// well to work out the number of moves, let's just make the robot go backwards!
string reverse_directions(K, '-');
for (int i = 0; i < K; i++) {
if (directions[i] == 'E') reverse_directions[i] = 'W';
if (directions[i] == 'W') reverse_directions[i] = 'E';
if (directions[i] == 'N') reverse_directions[i] = 'S';
if (directions[i] == 'S') reverse_directions[i] = 'N';
}
reverse(reverse_directions.begin(), reverse_directions.end());
// cout << reverse_directions << endl;
// now we count up the number of moves
int num_moves = 0;
for (int i = 0; i < reverse_directions.size(); i++) {
num_moves += 1;
}
printf("%d\n", num_moves);
} | 30.25 | 84 | 0.57379 | Gomango999 |
aac258ecf21af6accf3dfd66fb591ef2fcd4856f | 628 | hpp | C++ | Fusion/src/Fusion/Audio/Buffer.hpp | WhoseTheNerd/Fusion | 35ab536388392b3ba2e14f288eecbc292abd7dea | [
"Apache-2.0"
] | 4 | 2018-11-12T18:43:02.000Z | 2020-02-02T10:18:56.000Z | Fusion/src/Fusion/Audio/Buffer.hpp | WhoseTheNerd/Fusion | 35ab536388392b3ba2e14f288eecbc292abd7dea | [
"Apache-2.0"
] | 2 | 2018-12-22T13:18:05.000Z | 2019-07-24T20:15:45.000Z | Fusion/src/Fusion/Audio/Buffer.hpp | WhoseTheNerd/Fusion | 35ab536388392b3ba2e14f288eecbc292abd7dea | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <cinttypes>
#include <vector>
#include "Common.hpp"
namespace Fusion { namespace Audio {
class Buffer
{
public:
Buffer();
Buffer(uint32_t id);
/* The class doesn't store buffer data and we can't query it from OpenAL so it cannot be copied. */
Buffer(const Buffer& other) = delete;
Buffer(Buffer&& other);
~Buffer();
void SetData(Format format, uint32_t sample_rate, const std::vector<uint8_t>& data);
operator uint32_t() const
{
return m_BufferID;
}
uint32_t GetBufferHandle() const { return m_BufferID; }
private:
uint32_t m_BufferID;
bool m_PlaceHolder;
};
} }
| 17.942857 | 101 | 0.69586 | WhoseTheNerd |
aac413e5574a6891287bff955bc123b8de305b5e | 16,038 | cpp | C++ | rmf_traffic/src/rmf_traffic/blockade/Constraint.cpp | 0to1/rmf_traffic | 0e641f779e9c7e6d69c316e905df5a51a2c124e1 | [
"Apache-2.0"
] | 10 | 2021-04-14T07:01:56.000Z | 2022-02-21T02:26:58.000Z | rmf_traffic/src/rmf_traffic/blockade/Constraint.cpp | 0to1/rmf_traffic | 0e641f779e9c7e6d69c316e905df5a51a2c124e1 | [
"Apache-2.0"
] | 63 | 2021-03-10T06:06:13.000Z | 2022-03-25T08:47:07.000Z | rmf_traffic/src/rmf_traffic/blockade/Constraint.cpp | 0to1/rmf_traffic | 0e641f779e9c7e6d69c316e905df5a51a2c124e1 | [
"Apache-2.0"
] | 10 | 2021-03-17T02:52:14.000Z | 2022-02-21T02:27:02.000Z | /*
* Copyright (C) 2020 Open Source Robotics Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
#include "Constraint.hpp"
#include <vector>
#include <cassert>
namespace rmf_traffic {
namespace blockade {
//==============================================================================
// To Uppercase Letter
std::string toul(const std::size_t input)
{
const std::size_t TotalLetters = 'Z'-'A'+1;
std::string output;
std::size_t value = input;
do
{
const std::size_t digit = value % TotalLetters;
char offset = output.empty() ? 'A' : 'A'-1;
output += static_cast<char>(digit + offset);
value /= TotalLetters;
} while (value > 0);
std::reverse(output.begin(), output.end());
return output;
}
//==============================================================================
class BlockageConstraint : public Constraint
{
public:
BlockageConstraint(
std::size_t blocked_by,
std::optional<std::size_t> blocker_hold_point,
std::optional<BlockageEndCondition> end_condition)
: _blocked_by(blocked_by),
_blocker_hold_point(blocker_hold_point),
_end_condition(end_condition)
{
_dependencies.insert(_blocked_by);
}
bool evaluate(const State& state) const final
{
const auto it = state.find(_blocked_by);
if (it == state.end())
{
std::string error = "Failed to evaluate BlockageConstraint ";
error += _description();
error += " for state: <";
for (const auto& s : state)
{
const auto p = std::to_string(s.first);
const auto begin = std::to_string(s.second.begin);
const auto end = std::to_string(s.second.end);
error += p + ":[" + begin + "," + end + "]";
}
error += ">";
throw std::runtime_error(error);
}
return _evaluate(it->second);
}
const std::unordered_set<std::size_t>& dependencies() const final
{
return _dependencies;
}
std::optional<bool> partial_evaluate(const State& state) const final
{
const auto it = state.find(_blocked_by);
if (it == state.end())
return std::nullopt;
return _evaluate(it->second);
}
std::string detail(const State& state) const final
{
const auto& range = state.at(_blocked_by);
std::stringstream str;
const bool two_parts =
_blocker_hold_point.has_value() && _end_condition.has_value();
const bool hold_failed = !_evaluate_can_hold(range);
const bool end_failed = !_evaluate_has_reached(range);
const bool whole_failed = hold_failed && end_failed;
if (two_parts)
{
if (whole_failed)
str << "{";
else
str << "[";
}
if (_blocker_hold_point.has_value())
{
if (hold_failed)
str << "{";
str << "h(" << toul(_blocked_by) << _blocker_hold_point.value() << ")";
if (hold_failed)
str << "}";
}
if (two_parts)
str << "|";
if (_end_condition.has_value())
{
if (end_failed)
str << "{";
if (_end_condition.value().condition == BlockageEndCondition::HasReached)
str << "r(";
else
str << "p(";
str << toul(_blocked_by) << _end_condition.value().index << ")";
if (end_failed)
str << "}";
}
if (two_parts)
{
if (whole_failed)
str << "}";
else
str << "]";
}
return str.str();
}
private:
bool _evaluate_can_hold(const ReservedRange& range) const
{
if (_blocker_hold_point)
{
if (range.end <= _blocker_hold_point)
return true;
}
return false;
}
bool _evaluate_has_reached(const ReservedRange& range) const
{
if (_end_condition)
{
const std::size_t has_reached = _end_condition->index;
if (range.begin < has_reached)
return false;
// Implicit: has_reached <= range.begin
if (has_reached < range.end)
return true;
if (_end_condition->condition == BlockageEndCondition::HasReached)
{
if (_end_condition->index == range.begin)
return true;
}
}
return false;
}
bool _evaluate(const ReservedRange& range) const
{
if (_evaluate_can_hold(range))
return true;
if (_evaluate_has_reached(range))
return true;
return false;
}
std::string _description() const
{
const auto h = _blocker_hold_point ?
std::to_string(*_blocker_hold_point) : std::string("null");
std::string desc = std::to_string(_blocked_by) + ":(" + h;
if (_end_condition)
{
desc += ", " + std::to_string(_end_condition->index);
if (_end_condition->condition == BlockageEndCondition::HasReached)
desc += ")";
else
desc += "]";
}
else
{
desc += ")";
}
return desc;
}
std::size_t _blocked_by;
std::optional<std::size_t> _blocker_hold_point;
std::optional<BlockageEndCondition> _end_condition;
std::unordered_set<std::size_t> _dependencies;
};
//==============================================================================
ConstConstraintPtr blockage(
std::size_t blocked_by,
std::optional<std::size_t> blocker_hold_point,
std::optional<BlockageEndCondition> end_condition)
{
return std::make_shared<BlockageConstraint>(
blocked_by, blocker_hold_point, end_condition);
}
//==============================================================================
class PassedConstraint : public Constraint
{
public:
PassedConstraint(
std::size_t participant,
std::size_t index)
: _participant(participant),
_index(index)
{
_dependencies.insert(_participant);
}
bool evaluate(const State& state) const final
{
const auto it = state.find(_participant);
if (it == state.end())
{
std::string error = "Failed to evaluate PassedConstraint because "
"participant " + std::to_string(_participant)
+ " is missing from the state.";
throw std::runtime_error(error);
}
return _evaluate(it->second);
}
const std::unordered_set<std::size_t>& dependencies() const final
{
return _dependencies;
}
std::optional<bool> partial_evaluate(const State& state) const final
{
const auto it = state.find(_participant);
if (it == state.end())
return std::nullopt;
return _evaluate(it->second);
}
std::string detail(const State& state) const final
{
std::stringstream str;
const auto& range = state.at(_participant);
const bool failed = !_evaluate(range);
if (failed)
str << "{";
str << "p(" << toul(_participant) << _index << ")";
if (failed)
str << "}";
return str.str();
}
private:
bool _evaluate(const ReservedRange& range) const
{
if (_index < range.begin)
return true;
if (range.begin < _index)
return false;
return _index < range.end;
}
std::size_t _participant;
std::size_t _index;
std::unordered_set<std::size_t> _dependencies;
};
//==============================================================================
ConstConstraintPtr passed(
std::size_t participant,
std::size_t index)
{
return std::make_shared<PassedConstraint>(participant, index);
}
//==============================================================================
class AlwaysValid : public Constraint
{
public:
bool evaluate(const State&) const final
{
return true;
}
const std::unordered_set<std::size_t>& dependencies() const final
{
static const std::unordered_set<std::size_t> empty_set;
return empty_set;
}
std::optional<bool> partial_evaluate(const State&) const final
{
return true;
}
std::string detail(const State&) const final
{
return "True";
}
};
//==============================================================================
AndConstraint::AndConstraint(const std::vector<ConstConstraintPtr>& constraints)
{
for (const auto& c : constraints)
add(c);
}
//==============================================================================
void AndConstraint::add(ConstConstraintPtr new_constraint)
{
for (const auto& dep : new_constraint->dependencies())
_dependencies.insert(dep);
_constraints.emplace(std::move(new_constraint));
}
//==============================================================================
bool AndConstraint::evaluate(const State& state) const
{
for (const auto& c : _constraints)
{
if (!c->evaluate(state))
return false;
}
return true;
}
//==============================================================================
const std::unordered_set<std::size_t>& AndConstraint::dependencies() const
{
return _dependencies;
}
//==============================================================================
std::optional<bool> AndConstraint::partial_evaluate(const State& state) const
{
for (const auto& c : _constraints)
{
if (const auto opt_value = c->partial_evaluate(state))
{
const auto value = *opt_value;
if (!value)
return false;
}
}
return std::nullopt;
}
//==============================================================================
std::string AndConstraint::detail(const State& state) const
{
if (_constraints.empty())
return "And-Empty-True";
if (_constraints.size() == 1)
{
return (*_constraints.begin())->detail(state);
}
std::stringstream str;
const bool failed = !evaluate(state);
if (failed)
str << "{ ";
else
str << "[ ";
bool first = true;
for (const auto& c : _constraints)
{
if (first)
first = false;
else
str << " & ";
str << c->detail(state);
}
if (failed)
str << " }";
else
str << " ]";
return str.str();
}
//==============================================================================
OrConstraint::OrConstraint(const std::vector<ConstConstraintPtr>& constraints)
{
for (const auto& c : constraints)
add(c);
}
//==============================================================================
void OrConstraint::add(ConstConstraintPtr new_constraint)
{
for (const auto& dep : new_constraint->dependencies())
_dependencies.insert(dep);
_constraints.emplace(std::move(new_constraint));
}
//==============================================================================
bool OrConstraint::evaluate(const State& state) const
{
for (const auto& c : _constraints)
{
if (c->evaluate(state))
return true;
}
if (_constraints.empty())
return true;
return false;
}
//==============================================================================
const std::unordered_set<std::size_t>& OrConstraint::dependencies() const
{
return _dependencies;
}
//==============================================================================
std::optional<bool> OrConstraint::partial_evaluate(const State& state) const
{
for (const auto& c : _constraints)
{
if (const auto opt_value = c->partial_evaluate(state))
{
const auto value = *opt_value;
if (value)
return true;
}
}
return std::nullopt;
}
//==============================================================================
std::string OrConstraint::detail(const State& state) const
{
if (_constraints.empty())
return "Or-Empty-True";
if (_constraints.size() == 1)
{
return (*_constraints.begin())->detail(state);
}
std::stringstream str;
const bool failed = !evaluate(state);
if (failed)
str << "{ ";
else
str << "[ ";
bool first = true;
for (const auto& c : _constraints)
{
if (first)
first = false;
else
str << " | ";
str << c->detail(state);
}
if (failed)
str << " }";
else
str << " ]";
return str.str();
}
namespace {
//==============================================================================
using Cache = std::unordered_map<std::size_t, std::unordered_set<std::size_t>>;
//==============================================================================
struct GridlockNode;
using GridlockNodePtr = std::shared_ptr<const GridlockNode>;
//==============================================================================
struct Blocker
{
std::size_t participant;
std::size_t index;
ConstConstraintPtr constraint;
bool operator==(const Blocker& other) const
{
return participant == other.participant && index == other.index;
}
bool operator!=(const Blocker& other) const
{
return !(*this == other);
}
};
//==============================================================================
struct GridlockNode
{
Blocker blocker;
GridlockNodePtr parent;
Cache visited;
};
} // anonymous namespace
//==============================================================================
ConstConstraintPtr compute_gridlock_constraint(GridlockNodePtr node)
{
auto or_constraint = std::make_shared<OrConstraint>();
const auto target_blocker = node->blocker;
do
{
or_constraint->add(node->blocker.constraint);
node = node->parent;
assert(node);
} while (target_blocker != node->blocker);
return or_constraint;
}
//==============================================================================
ConstConstraintPtr compute_gridlock_constraint(const Blockers& blockers)
{
std::vector<GridlockNodePtr> queue;
std::unordered_map<std::size_t, std::vector<Blocker>> dependents;
for (const auto& b : blockers)
{
const auto participant = b.first;
const auto& points = b.second;
for (const auto& p : points)
{
const auto index = p.first;
const auto constraint = p.second;
Blocker blocker{participant, index, constraint};
for (const std::size_t dependency : constraint->dependencies())
{
auto& v = dependents.insert({dependency, {}}).first->second;
v.push_back(blocker);
}
auto node = std::make_shared<GridlockNode>(
GridlockNode{blocker, nullptr, {}});
node->visited[participant].insert(index);
queue.push_back(std::move(node));
}
}
Cache expanded_nodes;
State test_state;
std::vector<ConstConstraintPtr> gridlock_constraints;
while (!queue.empty())
{
const auto top = queue.back();
queue.pop_back();
const bool is_new_node = expanded_nodes
.insert({top->blocker.participant, {}})
.first->second.insert(top->blocker.index).second;
if (!is_new_node)
continue;
const auto participant = top->blocker.participant;
const auto index = top->blocker.index;
const auto it = dependents.find(top->blocker.participant);
if (it == dependents.end())
continue;
test_state.clear();
test_state[participant] = ReservedRange{index, index};
for (const auto& dep : it->second)
{
std::optional<bool> opt_eval =
dep.constraint->partial_evaluate(test_state);
if (!opt_eval.has_value() || opt_eval.value())
continue;
// This constraint is blocked by holding here, so we'll add it to the
// chain
Cache new_visited = top->visited;
const bool loop_found = !new_visited[dep.participant]
.insert(dep.index).second;
auto next = std::make_shared<GridlockNode>(
GridlockNode{dep, top, std::move(new_visited)});
if (loop_found)
gridlock_constraints.push_back(compute_gridlock_constraint(next));
else
queue.push_back(next);
}
}
if (gridlock_constraints.empty())
return std::make_shared<AlwaysValid>();
return std::make_shared<AndConstraint>(gridlock_constraints);
}
} // namespace blockade
} // namespace rmf_traffic
| 23.76 | 80 | 0.563599 | 0to1 |
aac499dbfd84c5e8199bf8a5811a0056d1d7bdd4 | 3,161 | cpp | C++ | Hashing/Maths and hashing/Grid Illumination.cpp | cenation092/InterviewBit-Solutions | ac4510a10d965fb681f7b3c80990407e18bc2668 | [
"MIT"
] | 7 | 2019-06-29T08:57:07.000Z | 2021-02-13T06:43:40.000Z | Hashing/Maths and hashing/Grid Illumination.cpp | cenation092/InterviewBit-Solutions | ac4510a10d965fb681f7b3c80990407e18bc2668 | [
"MIT"
] | null | null | null | Hashing/Maths and hashing/Grid Illumination.cpp | cenation092/InterviewBit-Solutions | ac4510a10d965fb681f7b3c80990407e18bc2668 | [
"MIT"
] | 3 | 2020-06-17T04:26:26.000Z | 2021-02-12T04:51:40.000Z | int dx[] = {-1, -1, 1, 1, -1, 0, 0, 0, 1};
int dy[] = {-1, 1, -1, 1, 0, -1, 0, 1, 0};
struct line{
int x1,y1,x2,y2;
int ass(int a, int b, int c, int d ){
x1 = a;
y1 = b;
x2 = c;
y2 = d;
}
};
line left(int x, int y, int A){
int top_x, top_y;
int sub = min(x-1, y-1);
top_x = x-sub;
top_y = y-sub;
int add = min(A-x, A-y);
int bot_x, bot_y;
bot_x = x+add;
bot_y = y+add;
line L;
L.ass(top_x, top_y, bot_x, bot_y);
return L;
}
line right( int x, int y, int A){
int top_x, top_y;
int sub = min(x-1, A-y);
top_x = x-sub;
top_y = y+sub;
int bot_x, bot_y;
int add = min(A-x, y-1);
bot_x = x+add;
bot_y = y-add;
line L;
L.ass(top_x, top_y, bot_x, bot_y);
return L;
}
vector<int> Solution::solve(int A, vector<vector<int> > &B, vector<vector<int> > &C) {
map<pair<int,int>, int> fre;
map<pair<pair<int,int>, pair<int,int> >, int > s;
map<int, int> X, Y;
for( auto it : B ){
int x = it[0], y = it[1];
x++, y++;
if( fre[make_pair(x,y)] > 0 )continue;
fre[make_pair(x,y)]++;
X[x]++;
Y[y]++;
line a = left(x, y, A);
s[make_pair(make_pair(a.x1, a.y1), make_pair(a.x2, a.y2))]++;
a = right(x, y, A);
s[make_pair(make_pair(a.x1, a.y1), make_pair(a.x2, a.y2))]++;
}
vector<int> ans;
for( auto it : C ){
int x = it[0], y = it[1];
x++, y++;
pair<pair<int,int>, pair<int,int> > a1;
pair<pair<int,int>, pair<int,int> > a2;
line a = left(x, y, A);
a1 = (make_pair(make_pair(a.x1, a.y1), make_pair(a.x2, a.y2)));
a = right(x, y, A);
a2 = (make_pair(make_pair(a.x1, a.y1), make_pair(a.x2, a.y2)));
if( s.count(a1) ){
ans.push_back(1);
}
else if( s.count(a2) ){
ans.push_back(1);
}
else if( X.find(x) != X.end() ){
ans.push_back(1);
}
else if( Y.find(y) != Y.end()){
ans.push_back(1);
}
else{
ans.push_back(0);
}
for( int i = 0; i < 9; i++ ){
int xx = x + dx[i];
int yy = y + dy[i];
if( xx < 1 || yy < 1 || xx > A || yy > A )continue;
if( fre.count(make_pair(xx,yy)) > 0 ){
a = left(xx, yy, A);
a1 = (make_pair(make_pair(a.x1, a.y1), make_pair(a.x2, a.y2)));
if( s.count(a1) ){
s[a1]--;
if( s[a1] == 0 )s.erase(a1);
}
a = right(xx, yy, A);
a1 = (make_pair(make_pair(a.x1, a.y1), make_pair(a.x2, a.y2)));
if( s.count(a1) ){
s[a1]--;
if( s[a1] == 0 )s.erase(a1);
}
X[xx]--;
Y[yy]--;
if( X[xx] == 0 )X.erase(xx);
if( Y[yy] == 0 )Y.erase(yy);
fre[make_pair(xx,yy)]--;
if( fre[make_pair(xx,yy)] == 0 )fre.erase(make_pair(xx,yy));
}
}
}
return ans;
}
| 28.223214 | 86 | 0.412528 | cenation092 |
aac5f875f4abdf1245ad33f3d1c7dd52277d7295 | 18,950 | cc | C++ | src/neo.cc | Quicr/qmedia | 96408d740bf35e6a845f61c40cc9f9ff859a9955 | [
"BSD-2-Clause"
] | null | null | null | src/neo.cc | Quicr/qmedia | 96408d740bf35e6a845f61c40cc9f9ff859a9955 | [
"BSD-2-Clause"
] | 1 | 2021-12-29T03:37:51.000Z | 2022-03-16T05:59:11.000Z | src/neo.cc | Quicr/qmedia | 96408d740bf35e6a845f61c40cc9f9ff859a9955 | [
"BSD-2-Clause"
] | null | null | null | #include <iostream>
#include "neo.hh"
#include "h264_encoder.hh"
namespace neo_media
{
Neo::Neo(const LoggerPointer &parent_logger) :
log(std::make_shared<Logger>("NEO", parent_logger)),
metrics(std::make_shared<Metrics>(MetricsConfig::URL,
MetricsConfig::ORG,
MetricsConfig::BUCKET,
MetricsConfig::AUTH_TOKEN))
{
}
void Neo::init(const std::string &remote_address,
const unsigned int remote_port,
unsigned int audio_sample_rate_,
unsigned int audio_channels_,
audio_sample_type audio_type,
unsigned int video_max_width_,
unsigned int video_max_height_,
unsigned int video_max_frame_rate_,
unsigned int video_max_bitrate_,
video_pixel_format video_encode_pixel_format_,
video_pixel_format video_decode_pixel_format_,
uint64_t clientID,
uint64_t conferenceID,
callbackSourceId callback,
NetTransport::Type xport_type,
bool echo)
{
myClientID = clientID;
myConferenceID = conferenceID;
audio_sample_rate = audio_sample_rate_;
audio_channels = audio_channels_;
type = audio_type;
video_max_width = video_max_width_;
video_max_height = video_max_height_;
video_max_frame_rate = video_max_frame_rate_;
video_max_bitrate = video_max_bitrate_;
video_encode_pixel_format = video_encode_pixel_format_;
video_decode_pixel_format = video_decode_pixel_format_;
newSources = callback;
transport_type = xport_type;
if (transport_type == NetTransport::Type::PICO_QUIC)
{
transport = std::make_unique<ClientTransportManager>(
NetTransport::Type::PICO_QUIC,
remote_address,
remote_port,
metrics,
log);
while (!transport->transport_ready())
{
std::this_thread::sleep_for(std::chrono::seconds(2));
}
}
else if (transport_type == NetTransport::Type::QUICR)
{
transport = std::make_unique<ClientTransportManager>(
NetTransport::Type::QUICR,
remote_address,
remote_port,
metrics,
log);
// setup sources
}
else
{
// UDP
transport = std::make_unique<ClientTransportManager>(
NetTransport::Type::UDP, remote_address, remote_port, metrics, log);
transport->start();
}
int64_t epoch_id = 1;
transport->setCryptoKey(epoch_id, bytes(8, uint8_t(epoch_id)));
// Construct and send a Join Packet
if (transport_type != NetTransport::Type::QUICR)
{
PacketPointer joinPacket = std::make_unique<Packet>();
assert(joinPacket);
joinPacket->packetType = neo_media::Packet::Type::Join;
joinPacket->clientID = myClientID;
joinPacket->conferenceID = myConferenceID;
joinPacket->echo = echo;
transport->send(std::move(joinPacket));
}
// TODO: add audio_encoder
workThread = std::thread(neoWorkThread, this);
// Init video pipeline unless disabled with zero width or height or bad
// format
if (!video_max_width || !video_max_height)
{
log->error << "video disabled" << std::flush;
return;
}
if (video_encode_pixel_format != video_pixel_format::NV12 &&
video_encode_pixel_format != video_pixel_format::I420)
{
std::cerr << "unsupported encode pixel format: "
<< int(video_encode_pixel_format) << std::endl;
return;
}
if (video_decode_pixel_format != video_pixel_format::NV12 &&
video_decode_pixel_format != video_pixel_format::I420)
{
std::cerr << "unsupported decode pixel format: "
<< int(video_decode_pixel_format) << std::endl;
return;
}
video_encoder = std::make_unique<H264Encoder>(
video_max_width,
video_max_height,
video_max_frame_rate,
video_max_bitrate,
(uint32_t) video_encode_pixel_format);
if (!video_encoder)
{
log->error << "AV1 video encoder init failed" << std::flush;
return;
}
}
void Neo::publish(std::uint64_t source_id,
Packet::MediaType media_type,
std::string url)
{
auto pkt_transport = transport->transport();
std::weak_ptr<NetTransportQUICR> tmp =
std::static_pointer_cast<NetTransportQUICR>(pkt_transport.lock());
auto quicr_transport = tmp.lock();
quicr_transport->publish(source_id, media_type, url);
}
void Neo::subscribe(Packet::MediaType mediaType, std::string url)
{
auto pkt_transport = transport->transport();
std::weak_ptr<NetTransportQUICR> tmp =
std::static_pointer_cast<NetTransportQUICR>(pkt_transport.lock());
auto quicr_transport = tmp.lock();
quicr_transport->subscribe(mediaType, url);
}
void Neo::start_transport(NetTransport::Type transport_type)
{
if (transport_type == NetTransport::Type::QUICR)
{
auto pkt_transport = transport->transport();
std::weak_ptr<NetTransportQUICR> tmp =
std::static_pointer_cast<NetTransportQUICR>(pkt_transport.lock());
auto quicr_transport = tmp.lock();
quicr_transport->start();
while (!transport->transport_ready())
{
std::this_thread::sleep_for(std::chrono::milliseconds(100));
}
}
}
/** Receive all packets in this thread, push to jitter buffer, and notify client
* if new stream via callback. */
void Neo::doWork()
{
// Wait on a condition variable
while (!shutdown)
{
transport->waitForPacket();
PacketPointer packet = transport->recv();
if (packet == nullptr)
{
continue;
}
if (Packet::Type::StreamContent == packet->packetType)
{
uint64_t clientID = packet->clientID;
uint64_t sourceID = packet->sourceID;
uint64_t sourceTS = packet->sourceRecordTime;
// TODO: This is pre-decode media type, which is
// not really right but close enough. Hold off changing a lot
// to get at that data before Geir's changes to Jitter/Playout.
Packet::MediaType sourceType = packet->mediaType;
bool new_stream;
auto jitter_instance = getJitter(clientID);
if (jitter_instance == nullptr)
{
jitter_instance = createJitter(clientID);
}
if (jitter_instance != nullptr)
{
new_stream = jitter_instance->push(std::move(packet));
// jitter assembles packets to frames, decodes, conceals
// and makes frames available to client
if (new_stream && newSources)
{
newSources(clientID, sourceID, sourceTS, sourceType);
}
}
}
else if (Packet::Type::IdrRequest == packet->packetType)
{
log->info << "Received IDR request" << std::flush;
reqKeyFrame = true;
}
}
}
void Neo::setMicrophoneMute(bool muted)
{
mutedAudioEmptyFrames = muted;
}
void Neo::sendAudio(const char *buffer,
unsigned int length,
uint64_t timestamp,
uint64_t sourceID)
{
std::shared_ptr<AudioEncoder> audio_encoder = getAudioEncoder(sourceID);
if (audio_encoder != nullptr)
{
audio_encoder->encodeFrame(
buffer, length, timestamp, mutedAudioEmptyFrames);
}
}
void Neo::sendVideoFrame(const char *buffer,
uint32_t length,
uint32_t width,
uint32_t height,
uint32_t stride_y,
uint32_t stride_uv,
uint32_t offset_u,
uint32_t offset_v,
uint32_t format,
uint64_t timestamp,
uint64_t sourceID)
{
// TODO:implement clone()
// TODO: remove assert
int sendRaw = 0; // 1 will send Raw YUV video instead of AV1
PacketPointer packet = std::make_unique<Packet>();
assert(packet);
packet->packetType = neo_media::Packet::Type::StreamContent;
packet->clientID = myClientID;
packet->conferenceID = myConferenceID;
packet->sourceID = sourceID;
packet->encodedSequenceNum = video_seq_no;
packet->sourceRecordTime = timestamp;
packet->mediaType = sendRaw ? Packet::MediaType::Raw :
Packet::MediaType::AV1;
// encode and packetize
encodeVideoFrame(buffer,
length,
width,
height,
stride_y,
stride_uv,
offset_u,
offset_v,
format,
timestamp,
packet.get());
if (packet->data.empty())
{
// encoder skipped this frame, nothing to send
return;
}
video_seq_no++;
if (loopbackMode == LoopbackMode::codec)
{
transport->loopback(std::move(packet));
return;
}
// create object for managing packetization
auto packets = std::make_shared<SimplePacketize>(std::move(packet),
1200 /* MTU */);
for (unsigned int i = 0; i < packets->GetPacketCount(); i++)
{
auto frame_packet = packets->GetPacket(i);
frame_packet->transportSequenceNumber = 0; // this will be set by
// the transport layer
// sending lots of Raw packets at the same time is unreliable.
if (frame_packet->mediaType == Packet::MediaType::Raw)
{
std::this_thread::sleep_for(std::chrono::microseconds(10));
}
if (loopbackMode == LoopbackMode::full_media)
{
// don't transmit but return an recv from Net
transport->loopback(std::move(frame_packet));
}
else
{
// send over network
transport->send(std::move(frame_packet));
}
}
}
JitterInterface::JitterIntPtr Neo::getJitter(uint64_t clientID)
{
auto playout_key = clientID;
if (auto it{jitters.find(playout_key)}; it != std::end(jitters))
{
return it->second;
}
return nullptr;
}
JitterInterface::JitterIntPtr Neo::createJitter(uint64_t clientID)
{
Packet::MediaType packet_media_type = Packet::MediaType::Bad;
switch (type)
{
case audio_sample_type::Float32:
packet_media_type = Packet::MediaType::F32;
break;
case audio_sample_type::PCMint16:
packet_media_type = Packet::MediaType::L16;
break;
default:
assert(0);
}
if (jitters.size() < maxJitters)
{
if (loopbackMode == LoopbackMode::codec)
{
LoopbackJitter::LoopbackJitterPtr loopbackPtr =
std::make_shared<LoopbackJitter>(
audio_sample_rate,
audio_channels,
packet_media_type,
video_max_width,
video_max_height,
(uint32_t) video_decode_pixel_format,
log);
auto ret = jitters.emplace(
clientID,
JitterInterface::JitterIntPtr(
std::static_pointer_cast<JitterInterface>(loopbackPtr)));
return ret.first->second;
}
else
{
Jitter::JitterPtr jitterPtr = std::make_shared<Jitter>(
audio_sample_rate,
audio_channels,
packet_media_type,
video_max_width,
video_max_height,
(uint32_t) video_decode_pixel_format,
log,
metrics);
auto ret = jitters.emplace(
clientID,
JitterInterface::JitterIntPtr(
std::static_pointer_cast<JitterInterface>(jitterPtr)));
return ret.first->second;
}
}
return nullptr;
}
void Neo::encodeVideoFrame(const char *buffer,
uint32_t length,
uint32_t width,
uint32_t height,
uint32_t stride_y,
uint32_t stride_uv,
uint32_t offset_u,
uint32_t offset_v,
uint32_t format,
uint64_t timestamp,
Packet *packet)
{
switch (packet->mediaType)
{
case Packet::MediaType::AV1:
{
// TODO : add logic to determine to send keyframe or not
// TODO : encoder api needs to return frame type and its
// relationships
bool keyFrame = reqKeyFrame;
packet->videoFrameType = (Packet::VideoFrameType)
video_encoder->encode(buffer,
length,
width,
height,
stride_y,
stride_uv,
offset_u,
offset_v,
format,
timestamp,
packet->data,
keyFrame);
if (keyFrame &&
packet->videoFrameType == Packet::VideoFrameType::Idr)
{
log->info << "after encode, resetting keyFrame\n" << std::flush;
reqKeyFrame = false;
}
}
break;
case Packet::MediaType::Raw:
packet->data.resize(length);
memcpy(packet->data.data(), buffer, length);
break;
default:
log->error << "unknown video packet type: "
<< (int) packet->mediaType << std::flush;
assert(0); // TODO: handle more gracefully
}
}
int Neo::getAudio(uint64_t clientID,
uint64_t sourceID,
uint64_t ×tamp,
unsigned char **buffer,
unsigned int max_len,
Packet **packetToFree)
{
int recv_length = 0;
PacketPointer packet;
JitterInterface::JitterIntPtr jitter = getJitter(clientID);
if (jitter == nullptr) return 0;
packet = jitter->popAudio(sourceID, max_len);
if (packet != NULL)
{
timestamp = packet->sourceRecordTime;
*buffer = &packet->data[0];
recv_length = packet->data.size();
*packetToFree = packet.release();
}
return recv_length;
}
std::uint32_t Neo::getVideoFrame(uint64_t clientID,
uint64_t sourceID,
uint64_t ×tamp,
uint32_t &width,
uint32_t &height,
uint32_t &format,
unsigned char **buffer)
{
int recv_length = 0;
JitterInterface::JitterIntPtr jitter_instance = getJitter(clientID);
if (jitter_instance == nullptr) return 0;
Packet::IdrRequestData idr_data = {clientID, 0, 0};
recv_length = jitter_instance->popVideo(
sourceID, width, height, format, timestamp, buffer, idr_data);
if (idr_data.source_timestamp > 0)
{
log->debug << "jitter asked for keyFrame, sending IDR\n" << std::flush;
PacketPointer idr = std::make_unique<Packet>();
idr->packetType = Packet::Type::IdrRequest;
idr->transportSequenceNumber = 0;
idr->idrRequestData = std::move(idr_data);
transport->send(std::move(idr));
}
return recv_length;
}
void Neo::audioEncoderCallback(PacketPointer packet)
{
assert(packet);
// TODO: temporary copy until we decouple data from packet
packet->packetType = neo_media::Packet::Type::StreamContent;
packet->clientID = myClientID;
packet->conferenceID = myConferenceID;
packet->encodedSequenceNum = seq_no;
packet->transportSequenceNumber = 0; // this will be set by the
// transport layer
// This assumes that the callback is coming from an opus encoder
// Once we encode other media we need to change where this is set
packet->mediaType = Packet::MediaType::Opus;
// this seems to be incomplete, we need media timeline driven
// seq_no and may be also the media packet sequence number
seq_no++;
if (loopbackMode == LoopbackMode::full_media ||
loopbackMode == LoopbackMode::codec)
{
// don't transmit but return an recv from Net
transport->loopback(std::move(packet));
return;
}
// send it over the network
transport->send(std::move(packet));
}
std::shared_ptr<AudioEncoder> Neo::getAudioEncoder(uint64_t sourceID)
{
std::shared_ptr<AudioEncoder> audio_enc = nullptr;
if (auto it{audio_encoders.find(sourceID)}; it != std::end(audio_encoders))
{
audio_enc = it->second;
}
if (audio_enc == nullptr)
{
Packet::MediaType m_type;
switch (type)
{
case Neo::audio_sample_type::PCMint16:
m_type = Packet::MediaType::L16;
break;
case Neo::audio_sample_type::Float32:
m_type = Packet::MediaType::F32;
break;
default:
break;
}
auto callback = std::bind(
&Neo::audioEncoderCallback, this, std::placeholders::_1);
auto ret = audio_encoders.emplace(
sourceID,
std::make_shared<AudioEncoder>(audio_sample_rate,
audio_channels,
m_type,
callback,
sourceID,
log));
audio_enc = ret.first->second;
}
return audio_enc;
}
} // namespace neo_media
| 33.718861 | 80 | 0.539947 | Quicr |
aac62f3744b21b2b66d38fdafafb663b04c60f20 | 724 | cc | C++ | ui/compositor/test/throughput_report_checker.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 14,668 | 2015-01-01T01:57:10.000Z | 2022-03-31T23:33:32.000Z | ui/compositor/test/throughput_report_checker.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 86 | 2015-10-21T13:02:42.000Z | 2022-03-14T07:50:50.000Z | ui/compositor/test/throughput_report_checker.cc | zealoussnow/chromium | fd8a8914ca0183f0add65ae55f04e287543c7d4a | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 5,941 | 2015-01-02T11:32:21.000Z | 2022-03-31T16:35:46.000Z | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/compositor/test/throughput_report_checker.h"
#include "base/time/time.h"
#include "ui/compositor/test/animation_throughput_reporter_test_base.h"
namespace ui {
bool ThroughputReportChecker::WaitUntilReported() {
DCHECK(!reported_);
test_base_->Advance(base::Seconds(5));
return reported_;
}
void ThroughputReportChecker::OnReport(
const cc::FrameSequenceMetrics::CustomReportData&) {
reported_ = true;
if (fail_if_reported_)
ADD_FAILURE() << "It should not be reported.";
test_base_->QuitRunLoop();
}
} // namespace ui
| 26.814815 | 73 | 0.752762 | zealoussnow |
aac76e242e4ada48bd710fe049d969d1360c9be6 | 3,814 | cpp | C++ | virtualbox/hgcm-oob/source/pwn2ownuser/service_inf.cpp | niklasb/sploits | af232ec45dc60ef9597149e5f29164dad2f45473 | [
"BSD-2-Clause-FreeBSD"
] | 415 | 2018-11-23T01:51:57.000Z | 2022-02-17T05:55:00.000Z | virtualbox/hgcm-oob/source/pwn2ownuser/service_inf.cpp | niklasb/sploits | af232ec45dc60ef9597149e5f29164dad2f45473 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | virtualbox/hgcm-oob/source/pwn2ownuser/service_inf.cpp | niklasb/sploits | af232ec45dc60ef9597149e5f29164dad2f45473 | [
"BSD-2-Clause-FreeBSD"
] | 74 | 2018-11-23T01:50:37.000Z | 2022-02-23T23:48:05.000Z | #include "stdafx.h"
#include <Windows.h>
#include "common.h"
#include "debug.h"
#include "service.h"
#include "service_inf.h"
/*
Format string arguments:
#1 - Source binary path
#2, #3 - Service name
*/
#define INF_DATA \
\
"[Version]\n" \
"Signature = \"$Windows NT$\"\n" \
"Class = \"Driver\"\n" \
"Provider = %%MSFT%%\n" \
"DriverVer = 27/10/2010,1.0.0.0\n" \
\
"[DestinationDirs]\n" \
"DefaultDestDir = 12\n" \
\
"[DefaultInstall]\n" \
"OptionDesc = %%ServiceDescription%%\n" \
\
"[DefaultInstall.Services]\n" \
"AddService = %%ServiceName%%,,Driver.Service\n" \
\
"[Driver.Service]\n" \
"DisplayName = %%ServiceName%%\n" \
"Description = %%ServiceDescription%%\n" \
"ServiceBinary = %s\n" \
"ServiceType = 1\n" \
"StartType = 3\n" \
"ErrorControl = 1\n" \
"AddReg = Driver.AddRegistry\n" \
\
"[Driver.AddRegistry]\n" \
"HKLM,%%RegKey%%\n" \
\
"[Strings]\n" \
"ServiceName = \"%s\"\n" \
"ServiceDescription = %%ServiceName%%\n" \
"RegKey = \"system\\currentcontrolset\\services\\%s\"\n"
// how long we should wait before termination of installation process
#define INF_PROCESS_TIMEOUT (10 * 1000)
//--------------------------------------------------------------------------------------
BOOL InfLoadDriver(char *lpszServiceName, char *lpszFilePath)
{
BOOL bRet = FALSE;
// allocate memory for the inf file contens
char *lpszData = (char *)M_ALLOC(PAGE_SIZE);
if (lpszData)
{
wsprintf(lpszData, INF_DATA, lpszFilePath, lpszServiceName, lpszServiceName);
#ifdef DBG
OutputDebugStringA(lpszData);
#endif
char szInfPath[MAX_PATH];
GetTempPath(MAX_PATH, szInfPath);
wsprintf(szInfPath + strlen(szInfPath), "\\%.8x.tmp", GetTickCount());
// save inf file to the disk
if (DumpToFile(szInfPath, lpszData, lstrlen(lpszData)))
{
DWORD dwExitCode = 0;
// install/uninstall kernl mode driver from inf file
if (StartProcess(
INF_PROCESS_TIMEOUT, &dwExitCode, "rundll32", "setupapi,InstallHinfSection %s 128 %s",
"DefaultInstall", szInfPath))
{
DbgMsg(__FILE__, __LINE__, __FUNCTION__"(): Exit code = %d\n", dwExitCode);
if (dwExitCode == 0)
{
// start service
bRet = OpenAndStartService(lpszServiceName);
}
}
DeleteFile(szInfPath);
}
M_FREE(lpszData);
}
return bRet;
}
//--------------------------------------------------------------------------------------
BOOL InfUnloadDriver(char *lpszServiceName)
{
// stop and uninstall service
return DrvServiceStop(lpszServiceName);
}
//--------------------------------------------------------------------------------------
// EoF | 36.673077 | 90 | 0.405087 | niklasb |
aac7aa7ee563ffb6904482b84dc7ad5fc5cecc85 | 526 | cpp | C++ | 11_10/11_10.cpp | wjingzhe/CPP_lab | 081ba3612c2d96ffd074061ca1800b7f31486c37 | [
"MIT"
] | null | null | null | 11_10/11_10.cpp | wjingzhe/CPP_lab | 081ba3612c2d96ffd074061ca1800b7f31486c37 | [
"MIT"
] | null | null | null | 11_10/11_10.cpp | wjingzhe/CPP_lab | 081ba3612c2d96ffd074061ca1800b7f31486c37 | [
"MIT"
] | null | null | null | #include<iostream>
#include<fstream>
using namespace std;
int main()
{
int value[]={ 3, 7, 0, 5, 4 };
ofstream os("intergers",ios_base::out|ios_base::binary);
os.write(reinterpret_cast<char*>(&value),sizeof(value));
os.close();
ifstream is("intergers",ios_base::in|ios_base::binary);
if(is)
{
is.seekg(3*sizeof(int));
int v;
is.read(reinterpret_cast<char*>(&v),sizeof(int));
cout<<"The 4th integer in the file 'intergers' is "<<v<<endl;
}
else
{
cout<<"ERROR:Cancot open the file."<<endl;
}
return 0;
} | 21.04 | 63 | 0.659696 | wjingzhe |
aac7d13eded9ad84c4984a36a7e4f0a561e5c490 | 11,421 | cpp | C++ | DEM/Low/src/Animation/AnimationController.cpp | niello/deusexmachina | 2f698054fe82d8b40a0a0e58b86d64ffed0de06c | [
"MIT"
] | 15 | 2019-05-07T11:26:13.000Z | 2022-01-12T18:26:45.000Z | DEM/Low/src/Animation/AnimationController.cpp | niello/deusexmachina | 2f698054fe82d8b40a0a0e58b86d64ffed0de06c | [
"MIT"
] | 16 | 2021-10-04T17:15:31.000Z | 2022-03-20T09:34:29.000Z | DEM/Low/src/Animation/AnimationController.cpp | niello/deusexmachina | 2f698054fe82d8b40a0a0e58b86d64ffed0de06c | [
"MIT"
] | 2 | 2019-04-28T23:27:48.000Z | 2019-05-07T11:26:18.000Z | #include "AnimationController.h"
#include <Animation/Graph/AnimGraphNode.h>
#include <Animation/SkeletonInfo.h>
#include <Animation/Skeleton.h>
namespace DEM::Anim
{
CAnimationController::CAnimationController() = default;
CAnimationController::CAnimationController(CAnimationController&&) noexcept = default;
CAnimationController& CAnimationController::operator =(CAnimationController&&) noexcept = default;
CAnimationController::~CAnimationController() = default;
void CAnimationController::Init(PAnimGraphNode&& GraphRoot, Resources::CResourceManager& ResMgr,
CStrID LeftFootID, CStrID RightFootID,
std::map<CStrID, float>&& Floats,
std::map<CStrID, int>&& Ints,
std::map<CStrID, bool>&& Bools,
std::map<CStrID, CStrID>&& Strings,
const std::map<CStrID, CStrID>& AssetOverrides)
{
_Params.clear();
_FloatValues.reset();
_IntValues.reset();
_BoolValues.reset();
_StringValues.reset();
if (!Floats.empty())
{
UPTR CurrIdx = 0;
_FloatValues.reset(new float[Floats.size()]);
for (const auto [ID, DefaultValue] : Floats)
{
_Params.emplace(ID, std::pair{ EParamType::Float, CurrIdx });
_FloatValues[CurrIdx++] = DefaultValue;
// Duplicate IDs aren't allowed
Ints.erase(ID);
Bools.erase(ID);
Strings.erase(ID);
}
}
if (!Ints.empty())
{
UPTR CurrIdx = 0;
_IntValues.reset(new int[Ints.size()]);
for (const auto [ID, DefaultValue] : Ints)
{
_Params.emplace(ID, std::pair{ EParamType::Int, CurrIdx });
_IntValues[CurrIdx++] = DefaultValue;
// Duplicate IDs aren't allowed
Bools.erase(ID);
Strings.erase(ID);
}
}
if (!Bools.empty())
{
UPTR CurrIdx = 0;
_BoolValues.reset(new bool[Bools.size()]);
for (const auto [ID, DefaultValue] : Bools)
{
_Params.emplace(ID, std::pair{ EParamType::Bool, CurrIdx });
_BoolValues[CurrIdx++] = DefaultValue;
// Duplicate IDs aren't allowed
Strings.erase(ID);
}
}
if (!Strings.empty())
{
UPTR CurrIdx = 0;
_StringValues.reset(new CStrID[Strings.size()]);
for (const auto [ID, DefaultValue] : Strings)
{
_Params.emplace(ID, std::pair{ EParamType::String, CurrIdx });
_StringValues[CurrIdx++] = DefaultValue;
}
}
_GraphRoot = std::move(GraphRoot);
_SkeletonInfo = nullptr;
_UpdateCounter = 0;
if (_GraphRoot)
{
CAnimationInitContext Context{ *this, _SkeletonInfo, ResMgr, AssetOverrides };
_GraphRoot->Init(Context);
}
_PoseIndex = 2;
if (_SkeletonInfo)
{
_LastPoses[0].SetSize(_SkeletonInfo->GetNodeCount());
_LastPoses[1].SetSize(_SkeletonInfo->GetNodeCount());
_LeftFootBoneIndex = _SkeletonInfo->FindNodePort(LeftFootID);
_RightFootBoneIndex = _SkeletonInfo->FindNodePort(RightFootID);
}
else
{
// TODO: can issue a warning - no leaf animation data is provided or some assets are not resolved
_LeftFootBoneIndex = INVALID_BONE_INDEX;
_RightFootBoneIndex = INVALID_BONE_INDEX;
}
}
//---------------------------------------------------------------------
void CAnimationController::Update(const CSkeleton& Target, float dt)
{
// update conditions etc
// TODO:
// - selector (CStrID based?) with blend time for switching to actions like "open door". Finish vs cancel anim?
// - pose modifiers = skeletal controls, object space
// - inertialization
// - IK
if (_GraphRoot)
{
++_UpdateCounter;
CAnimationUpdateContext Context{ *this, Target };
_GraphRoot->Update(Context, dt);
// TODO: synchronize times by sync group?
}
_InertializationDt += dt; // Don't write to _InertializationElapsedTime, because dt may be discarded by teleportation
}
//---------------------------------------------------------------------
void CAnimationController::EvaluatePose(CSkeleton& Target)
{
Target.ToPoseBuffer(_CurrPose); // TODO: update only if changed externally?
if (_PoseIndex > 1)
{
// Init both poses from current. Should be used at the first frame and when teleported.
_PoseIndex = 0;
_LastPoses[0] = _CurrPose;
_LastPoses[1] = _CurrPose;
_LastPoseDt = 0.f;
}
else
{
// Swap current and previous pose buffers
_PoseIndex ^= 1;
_LastPoses[_PoseIndex] = _CurrPose;
_LastPoseDt = _InertializationDt;
}
if (_GraphRoot) _GraphRoot->EvaluatePose(_CurrPose);
//???else (if no _GraphRoot) leave as is or reset to refpose?
ProcessInertialization();
//!!!DBG TMP!
//pseudo root motion processing
//???diff from ref pose? can also be from the first frame of the animation, but that complicates things
//???precalculate something in tools to simplify processing here? is possible?
//Output.SetTranslation(0, vector3::Zero);
Target.FromPoseBuffer(_CurrPose);
}
//---------------------------------------------------------------------
bool CAnimationController::FindParam(CStrID ID, EParamType* pOutType, UPTR* pOutIndex) const
{
auto It = _Params.find(ID);
if (It == _Params.cend()) return false;
if (pOutType) *pOutType = It->second.first;
if (pOutIndex) *pOutIndex = It->second.second;
return true;
}
//---------------------------------------------------------------------
bool CAnimationController::SetFloat(CStrID ID, float Value)
{
EParamType Type;
UPTR Index;
if (!FindParam(ID, &Type, &Index) || Type != EParamType::Float) return false;
_FloatValues[Index] = Value;
return true;
}
//---------------------------------------------------------------------
float CAnimationController::GetFloat(CStrID ID, float Default) const
{
EParamType Type;
UPTR Index;
if (!FindParam(ID, &Type, &Index) || Type != EParamType::Float) return Default;
return _FloatValues[Index];
}
//---------------------------------------------------------------------
bool CAnimationController::SetInt(CStrID ID, int Value)
{
EParamType Type;
UPTR Index;
if (!FindParam(ID, &Type, &Index) || Type != EParamType::Int) return false;
_IntValues[Index] = Value;
return true;
}
//---------------------------------------------------------------------
int CAnimationController::GetInt(CStrID ID, int Default) const
{
EParamType Type;
UPTR Index;
if (!FindParam(ID, &Type, &Index) || Type != EParamType::Int) return Default;
return _IntValues[Index];
}
//---------------------------------------------------------------------
bool CAnimationController::SetBool(CStrID ID, bool Value)
{
EParamType Type;
UPTR Index;
if (!FindParam(ID, &Type, &Index) || Type != EParamType::Bool) return false;
_BoolValues[Index] = Value;
return true;
}
//---------------------------------------------------------------------
bool CAnimationController::GetBool(CStrID ID, bool Default) const
{
EParamType Type;
UPTR Index;
if (!FindParam(ID, &Type, &Index) || Type != EParamType::Bool) return Default;
return _BoolValues[Index];
}
//---------------------------------------------------------------------
bool CAnimationController::SetString(CStrID ID, CStrID Value)
{
EParamType Type;
UPTR Index;
if (!FindParam(ID, &Type, &Index) || Type != EParamType::String) return false;
_StringValues[Index] = Value;
return true;
}
//---------------------------------------------------------------------
CStrID CAnimationController::GetString(CStrID ID, CStrID Default) const
{
EParamType Type;
UPTR Index;
if (!FindParam(ID, &Type, &Index) || Type != EParamType::String) return Default;
return _StringValues[Index];
}
//---------------------------------------------------------------------
float CAnimationController::GetLocomotionPhaseFromPose(const CSkeleton& Skeleton) const
{
if (_LeftFootBoneIndex == INVALID_BONE_INDEX || _RightFootBoneIndex == INVALID_BONE_INDEX) return -1.f;
const auto* pRootNode = Skeleton.GetNode(0);
const auto* pLeftFootNode = Skeleton.GetNode(_LeftFootBoneIndex);
const auto* pRightFootNode = Skeleton.GetNode(_RightFootBoneIndex);
if (!pRootNode || !pLeftFootNode || !pRightFootNode) return -1.f;
auto ForwardDir = pRootNode->GetWorldMatrix().AxisZ();
ForwardDir.norm();
auto SideDir = pRootNode->GetWorldMatrix().AxisX();
SideDir.norm();
// Project foot offset onto the locomotion plane (fwd, up) and normalize it to get phase direction
auto PhaseDir = pLeftFootNode->GetWorldMatrix().Translation() - pRightFootNode->GetWorldMatrix().Translation();
PhaseDir -= (SideDir * PhaseDir.Dot(SideDir));
PhaseDir.norm();
const float CosA = PhaseDir.Dot(ForwardDir);
const float SinA = (PhaseDir * ForwardDir).Dot(SideDir);
/* TODO: use ACL/RTM for poses
const auto Fwd = RootCoordSystem.GetColumn(2);
acl::Vector4_32 ForwardDir = { static_cast<float>(Fwd[0]), static_cast<float>(Fwd[1]), static_cast<float>(Fwd[2]), 0.0f };
ForwardDir = acl::vector_normalize3(ForwardDir);
const auto Side = RootCoordSystem.GetColumn(0);
acl::Vector4_32 SideDir = { static_cast<float>(Side[0]), static_cast<float>(Side[1]), static_cast<float>(Side[2]), 0.0f };
SideDir = acl::vector_normalize3(SideDir);
const auto Offset = acl::vector_sub(LeftFootPositions[i], RightFootPositions[i]);
const auto ProjectedOffset = acl::vector_sub(Offset, acl::vector_mul(SideDir, acl::vector_dot3(Offset, SideDir)));
const auto PhaseDir = acl::vector_normalize3(ProjectedOffset);
const float CosA = acl::vector_dot3(PhaseDir, ForwardDir);
const float SinA = acl::vector_dot3(acl::vector_cross3(PhaseDir, ForwardDir), SideDir);
*/
const float Angle = std::copysignf(std::acosf(CosA) * 180.f / PI, SinA); // Could also use Angle = RadToDeg(std::atan2f(SinA, CosA));
return 180.f - Angle; // map 180 -> -180 to 0 -> 360
}
//---------------------------------------------------------------------
void CAnimationController::RequestInertialization(float Duration)
{
if (_InertializationRequest < 0.f || _InertializationRequest > Duration)
_InertializationRequest = Duration;
}
//---------------------------------------------------------------------
// TODO: detect teleportation, reset pending request and _InertializationDt to mitigate abrupt velocity changes
// That must zero out _LastPoseDt, when it is not a last dt yet!
void CAnimationController::ProcessInertialization()
{
if (_PoseIndex > 1) return;
// Process new request
const bool RequestPending = (_InertializationRequest > 0.f);
if (RequestPending)
{
float NewDuration = _InertializationRequest;
_InertializationRequest = -1.f;
// When interrupt active inertialization, must reduce duration to avoid degenerate pose (see UE4)
if (_InertializationDuration > 0.f)
{
// TODO: learn why we check prevoius deficit to apply current
const bool HasDeficit = (_InertializationDeficit > 0.f);
_InertializationDeficit = _InertializationDuration - _InertializationElapsedTime;
if (HasDeficit) NewDuration = std::max(0.f, NewDuration - _InertializationDeficit);
}
_InertializationDuration = NewDuration;
_InertializationElapsedTime = 0.0f;
}
// Process active inertialization
if (_InertializationDuration > 0.f)
{
if (RequestPending)
_InertializationPoseDiff.Init(_CurrPose, _LastPoses[_PoseIndex], _LastPoses[_PoseIndex ^ 1], _LastPoseDt, _InertializationDuration);
_InertializationElapsedTime += _InertializationDt;
if (_InertializationElapsedTime >= _InertializationDuration)
{
_InertializationElapsedTime = 0.0f;
_InertializationDuration = 0.0f;
_InertializationDeficit = 0.0f;
}
else
{
_InertializationDeficit = std::max(0.f, _InertializationDeficit - _InertializationDt);
_InertializationPoseDiff.ApplyTo(_CurrPose, _InertializationElapsedTime);
}
}
_InertializationDt = 0.f;
}
//---------------------------------------------------------------------
}
| 31.902235 | 135 | 0.66404 | niello |
aacc1ea577716f75ada3aacb0e7a4f38ea6bf962 | 6,802 | cpp | C++ | blades/xbmc/xbmc/video/VideoLibraryQueue.cpp | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 4 | 2016-04-26T03:43:54.000Z | 2016-11-17T08:09:04.000Z | blades/xbmc/xbmc/video/VideoLibraryQueue.cpp | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 17 | 2015-01-05T21:06:22.000Z | 2015-12-07T20:45:44.000Z | blades/xbmc/xbmc/video/VideoLibraryQueue.cpp | krattai/AEBL | a7b12c97479e1236d5370166b15ca9f29d7d4265 | [
"BSD-2-Clause"
] | 3 | 2016-04-26T03:43:55.000Z | 2020-11-06T11:02:08.000Z | /*
* Copyright (C) 2014 Team XBMC
* http://xbmc.org
*
* This Program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This Program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with XBMC; see the file COPYING. If not, see
* <http://www.gnu.org/licenses/>.
*
*/
#include "VideoLibraryQueue.h"
#include <utility>
#include "guilib/GUIWindowManager.h"
#include "GUIUserMessages.h"
#include "threads/SingleLock.h"
#include "Util.h"
#include "video/jobs/VideoLibraryCleaningJob.h"
#include "video/jobs/VideoLibraryJob.h"
#include "video/jobs/VideoLibraryMarkWatchedJob.h"
#include "video/jobs/VideoLibraryRefreshingJob.h"
#include "video/jobs/VideoLibraryScanningJob.h"
#include "video/VideoDatabase.h"
CVideoLibraryQueue::CVideoLibraryQueue()
: CJobQueue(false, 1, CJob::PRIORITY_LOW),
m_jobs(),
m_modal(false),
m_cleaning(false)
{ }
CVideoLibraryQueue::~CVideoLibraryQueue()
{
CSingleLock lock(m_critical);
m_jobs.clear();
}
CVideoLibraryQueue& CVideoLibraryQueue::GetInstance()
{
static CVideoLibraryQueue s_instance;
return s_instance;
}
void CVideoLibraryQueue::ScanLibrary(const std::string& directory, bool scanAll /* = false */ , bool showProgress /* = true */)
{
AddJob(new CVideoLibraryScanningJob(directory, scanAll, showProgress));
}
bool CVideoLibraryQueue::IsScanningLibrary() const
{
// check if the library is being cleaned synchronously
if (m_cleaning)
return true;
// check if the library is being scanned asynchronously
VideoLibraryJobMap::const_iterator scanningJobs = m_jobs.find("VideoLibraryScanningJob");
if (scanningJobs != m_jobs.end() && !scanningJobs->second.empty())
return true;
// check if the library is being cleaned asynchronously
VideoLibraryJobMap::const_iterator cleaningJobs = m_jobs.find("VideoLibraryCleaningJob");
if (cleaningJobs != m_jobs.end() && !cleaningJobs->second.empty())
return true;
return false;
}
void CVideoLibraryQueue::StopLibraryScanning()
{
CSingleLock lock(m_critical);
VideoLibraryJobMap::const_iterator scanningJobs = m_jobs.find("VideoLibraryScanningJob");
if (scanningJobs == m_jobs.end())
return;
// get a copy of the scanning jobs because CancelJob() will modify m_scanningJobs
VideoLibraryJobs tmpScanningJobs(scanningJobs->second.begin(), scanningJobs->second.end());
// cancel all scanning jobs
for (VideoLibraryJobs::const_iterator job = tmpScanningJobs.begin(); job != tmpScanningJobs.end(); ++job)
CancelJob(*job);
Refresh();
}
void CVideoLibraryQueue::CleanLibrary(const std::set<int>& paths /* = std::set<int>() */, bool asynchronous /* = true */, CGUIDialogProgressBarHandle* progressBar /* = NULL */)
{
CVideoLibraryCleaningJob* cleaningJob = new CVideoLibraryCleaningJob(paths, progressBar);
if (asynchronous)
AddJob(cleaningJob);
else
{
m_modal = true;
m_cleaning = true;
cleaningJob->DoWork();
delete cleaningJob;
m_cleaning = false;
m_modal = false;
Refresh();
}
}
void CVideoLibraryQueue::CleanLibraryModal(const std::set<int>& paths /* = std::set<int>() */)
{
// we can't perform a modal library cleaning if other jobs are running
if (IsRunning())
return;
m_modal = true;
m_cleaning = true;
CVideoLibraryCleaningJob cleaningJob(paths, true);
cleaningJob.DoWork();
m_cleaning = false;
m_modal = false;
Refresh();
}
void CVideoLibraryQueue::RefreshItem(CFileItemPtr item, bool ignoreNfo /* = false */, bool forceRefresh /* = true */, bool refreshAll /* = false */, const std::string& searchTitle /* = "" */)
{
AddJob(new CVideoLibraryRefreshingJob(item, forceRefresh, refreshAll, ignoreNfo, searchTitle));
}
bool CVideoLibraryQueue::RefreshItemModal(CFileItemPtr item, bool forceRefresh /* = true */, bool refreshAll /* = false */)
{
// we can't perform a modal library cleaning if other jobs are running
if (IsRunning())
return false;
m_modal = true;
CVideoLibraryRefreshingJob refreshingJob(item, forceRefresh, refreshAll);
bool result = refreshingJob.DoModal();
m_modal = false;
return result;
}
void CVideoLibraryQueue::MarkAsWatched(const CFileItemPtr &item, bool watched)
{
if (item == NULL)
return;
AddJob(new CVideoLibraryMarkWatchedJob(item, watched));
}
void CVideoLibraryQueue::AddJob(CVideoLibraryJob *job)
{
if (job == NULL)
return;
CSingleLock lock(m_critical);
if (!CJobQueue::AddJob(job))
return;
// add the job to our list of queued/running jobs
std::string jobType = job->GetType();
VideoLibraryJobMap::iterator jobsIt = m_jobs.find(jobType);
if (jobsIt == m_jobs.end())
{
VideoLibraryJobs jobs;
jobs.insert(job);
m_jobs.insert(std::make_pair(jobType, jobs));
}
else
jobsIt->second.insert(job);
}
void CVideoLibraryQueue::CancelJob(CVideoLibraryJob *job)
{
if (job == NULL)
return;
CSingleLock lock(m_critical);
// remember the job type needed later because the job might be deleted
// in the call to CJobQueue::CancelJob()
std::string jobType;
if (job->GetType() != NULL)
jobType = job->GetType();
// check if the job supports cancellation and cancel it
if (job->CanBeCancelled())
job->Cancel();
// remove the job from the job queue
CJobQueue::CancelJob(job);
// remove the job from our list of queued/running jobs
VideoLibraryJobMap::iterator jobsIt = m_jobs.find(jobType);
if (jobsIt != m_jobs.end())
jobsIt->second.erase(job);
}
void CVideoLibraryQueue::CancelAllJobs()
{
CSingleLock lock(m_critical);
CJobQueue::CancelJobs();
// remove all scanning jobs
m_jobs.clear();
}
bool CVideoLibraryQueue::IsRunning() const
{
return CJobQueue::IsProcessing() || m_modal;
}
void CVideoLibraryQueue::Refresh()
{
CUtil::DeleteVideoDatabaseDirectoryCache();
CGUIMessage msg(GUI_MSG_NOTIFY_ALL, 0, 0, GUI_MSG_UPDATE);
g_windowManager.SendThreadMessage(msg);
}
void CVideoLibraryQueue::OnJobComplete(unsigned int jobID, bool success, CJob *job)
{
if (success)
{
if (QueueEmpty())
Refresh();
}
{
CSingleLock lock(m_critical);
// remove the job from our list of queued/running jobs
VideoLibraryJobMap::iterator jobsIt = m_jobs.find(job->GetType());
if (jobsIt != m_jobs.end())
jobsIt->second.erase(static_cast<CVideoLibraryJob*>(job));
}
return CJobQueue::OnJobComplete(jobID, success, job);
}
| 27.99177 | 191 | 0.7192 | krattai |
aacd3557b80b70df994458a9fd7e0f18c8833abf | 682 | cpp | C++ | main.cpp | Zermil/mathEval | b49016bd21b787364c53b1fe6444d17366a838d7 | [
"MIT"
] | null | null | null | main.cpp | Zermil/mathEval | b49016bd21b787364c53b1fe6444d17366a838d7 | [
"MIT"
] | null | null | null | main.cpp | Zermil/mathEval | b49016bd21b787364c53b1fe6444d17366a838d7 | [
"MIT"
] | null | null | null | #include <iostream>
#include "MathEval.hpp"
int main(int argc, char* argv[])
{
std::string EXPRESSIONS[] = {
" -123 + 12 * 3 \t",
"(2 * 3) + 1\n\r",
"(-1 + 2) * 3",
" 3 + 4 * 2/(1-5)^2^3",
"5 * 3 + (4 + 2 % 2 * 8)",
"-Pi + 3.2 - 4 + (-3 + 2)-E*3",
"2.398+14.23+3-e*3+(-3)",
"-123 + 4 - 16 +(-3-4)-6",
"-123,,+cos(-3)",
"-sin ( max ( 2, 3 ) / 3 * PI )",
"-sqrt(2)"
};
for (const std::string& exp : EXPRESSIONS) {
std::cout << "EXPRESSION: " << exp << std::endl;
std::cout << "= " << MathEval::evalExpression(exp) << '\n';
std::cout << "===================" << std::endl;
}
system("pause");
return 0;
} | 24.357143 | 63 | 0.409091 | Zermil |
aace9f423d7a4dfaaf366da679a6d04e0150d58c | 3,493 | hpp | C++ | src/Externals/spire/var-buffer/VarBuffer.hpp | Haydelj/SCIRun | f7ee04d85349b946224dbff183438663e54b9413 | [
"MIT"
] | null | null | null | src/Externals/spire/var-buffer/VarBuffer.hpp | Haydelj/SCIRun | f7ee04d85349b946224dbff183438663e54b9413 | [
"MIT"
] | null | null | null | src/Externals/spire/var-buffer/VarBuffer.hpp | Haydelj/SCIRun | f7ee04d85349b946224dbff183438663e54b9413 | [
"MIT"
] | null | null | null | /*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2020 Scientific Computing and Imaging Institute,
University of Utah.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#ifndef SPIRE_VARBUFFER_HPP
#define SPIRE_VARBUFFER_HPP
#include <es-log/trace-log.h>
#include <cstdint>
#include <memory>
#include <vector>
#include <bserialize/BSerialize.hpp>
#include <spire/scishare.h>
namespace spire {
/// This class is only for writing to a variable sized buffer. It is a thin
/// layer over the BSerialize code. To read data from a buffer, simply wrap
/// the buffer using BSerialize. There is no need to automatically extend
/// the buffer size when reading.
class SCISHARE VarBuffer final
{
public:
/// Initialize an empty buffer.
VarBuffer();
// Preallocate the variable buffer to the preset size.
explicit VarBuffer(size_t size);
// todo Add flag which will swap bytes when reading out of or into buffer.
// Writes numBytes of bytes.
void writeBytes(const char* bytes, size_t numBytes);
/// Writes a null terminated string.
void writeNullTermString(const char* str);
template <typename T>
void write(const T& val)
{
// Attempt to write the value to BSerialize. If a runtime exception is
// caught, then we need to resize the buffer.
while (mSerializer->write(val) == false)
{
resize();
}
}
template <typename T>
inline void writeUnsafe(const T& val)
{
mSerializer->writeUnsafe(val);
}
/// Clears all data currently written to the var buffer.
void clear();
/// Retrieves raw buffer contents.
char* getBuffer() {return mBuffer.empty() ? 0 : &mBuffer[0];}
/// Retrieves the current size of the buffer (size of all data currently
/// written to the buffer).
size_t getBufferSize() const {return mSerializer->getOffset();}
/// Retrieves currently allocated size of the buffer.
size_t getAllocatedSize() const {return mBufferSize;}
private:
void resize();
static bool serializeFloat(char* msg, int msgLen, int* offset_out, float in);
static bool serializeUInt16(char* msg, int msgLen, int* offset_out, uint16_t in);
static uint16_t deserializeUInt16(const char* msg, int msgLen, int* offset_out);
std::vector<char> mBuffer; ///< buffer
size_t mBufferSize; ///< Absolute size of mBuffer in bytes.
std::unique_ptr<spire::BSerialize> mSerializer;
};
} // namespace spire
#endif
| 31.468468 | 83 | 0.72631 | Haydelj |
aad0411c3c5470b87627b25488cd2b13710ec204 | 3,600 | cpp | C++ | test/StorageCacheNoneRuntimeTests.cpp | fsaporito/KVCache | 4d4402396426c1ca25e7fb9ae5f4fb181a0fa1f2 | [
"BSL-1.0"
] | null | null | null | test/StorageCacheNoneRuntimeTests.cpp | fsaporito/KVCache | 4d4402396426c1ca25e7fb9ae5f4fb181a0fa1f2 | [
"BSL-1.0"
] | null | null | null | test/StorageCacheNoneRuntimeTests.cpp | fsaporito/KVCache | 4d4402396426c1ca25e7fb9ae5f4fb181a0fa1f2 | [
"BSL-1.0"
] | null | null | null | #include "KVCache/StorageCache/StorageCacheNone.h"
#include <catch2/catch.hpp>
TEST_CASE("Put 1 KV Pair into StorageCacheNone", "[runtime],[Put],[Singlepair],[StorageCacheNone][SingleThread]")
{
// Initialize StorageCache
auto storageType = KVCache::Interface::StorageCacheType::NONE;
auto storagePath = KVCache::Interface::StoragePath::defaultStoragePath;
auto storageCache = KVCache::Internal::StorageCache::AbstractStorageCache::createStorageCache(storagePath,
storageType);
// Put KV Pair
const std::string key = "TestKey";
const std::string value = "TestValue";
REQUIRE_NOTHROW(storageCache->put(key, value));
REQUIRE(storageCache->size() == 0);
}
TEST_CASE("Put 2 KV Pairs into StorageCacheNone", "[runtime],[Put],[Multipair],[StorageCacheNone][SingleThread]")
{
// Initialize StorageCache
auto storageType = KVCache::Interface::StorageCacheType::NONE;
auto storagePath = KVCache::Interface::StoragePath::defaultStoragePath;
auto storageCache = KVCache::Internal::StorageCache::AbstractStorageCache::createStorageCache(storagePath,
storageType);
// Put KV Pair
const std::string key1 = "TestKey";
const std::string value1 = "TestValue";
REQUIRE_NOTHROW(storageCache->put(key1, value1));
REQUIRE(storageCache->size() == 0);
// Put Second KV Pair
const std::string key2 = "TestKey2";
const std::string value2 = "TestValue2";
REQUIRE_NOTHROW(storageCache->put(key2, value2));
REQUIRE(storageCache->size() == 0);
}
TEST_CASE("Get Always return empty optional with StorageCacheNone", "[runtime],[Put],[Get],[Singlepair],[StorageCacheNone][SingleThread]")
{
// Initialize StorageCache
auto storageType = KVCache::Interface::StorageCacheType::NONE;
auto storagePath = KVCache::Interface::StoragePath::defaultStoragePath;
auto storageCache = KVCache::Internal::StorageCache::AbstractStorageCache::createStorageCache(storagePath,
storageType);
// Put KV Pair
const std::string key = "TestKey";
const std::string value = "TestValue";
REQUIRE_NOTHROW(storageCache->put(key, value));
REQUIRE(storageCache->size() == 0);
REQUIRE(storageCache->getByteSize() == 0);
// Get KV Pair
REQUIRE_NOTHROW(storageCache->get(key));
auto optionalPair = storageCache->get(key);
REQUIRE(!optionalPair);
}
TEST_CASE("Remove Doesn't Throw with StorageCacheNone Single Thread", "[runtime],[Put],[Remove],[Singlepair],[MemoryCacheMap][SingleThread]")
{
// Initialize StorageCache
auto storageType = KVCache::Interface::StorageCacheType::NONE;
auto storagePath = KVCache::Interface::StoragePath::defaultStoragePath;
auto storageCache = KVCache::Internal::StorageCache::AbstractStorageCache::createStorageCache(storagePath,
storageType);
// Put KV Pair
const std::string key = "TestKey";
const std::string value = "TestValue";
REQUIRE_NOTHROW(storageCache->put(key, value));
REQUIRE(storageCache->size() == 0);
REQUIRE(storageCache->getByteSize() == 0);
// Remove KV Pair
bool removeFlag = false;
REQUIRE_NOTHROW(removeFlag = storageCache->remove(key));
REQUIRE(!removeFlag);
REQUIRE(storageCache->size() == 0);
} | 42.352941 | 141 | 0.640556 | fsaporito |
aad07a1cc8faae3d30a3de302637b907c3a25f0b | 1,446 | cpp | C++ | src/mc_control/fsm/states/Posture.cpp | fkanehiro/mc_rtc | 776017e46c1a4626c1d8f1fb7d51675a9b9b9cad | [
"BSD-2-Clause"
] | 44 | 2019-12-13T08:48:02.000Z | 2022-03-24T03:11:25.000Z | src/mc_control/fsm/states/Posture.cpp | fkanehiro/mc_rtc | 776017e46c1a4626c1d8f1fb7d51675a9b9b9cad | [
"BSD-2-Clause"
] | 160 | 2020-01-17T20:46:23.000Z | 2022-03-31T01:32:42.000Z | src/mc_control/fsm/states/Posture.cpp | fkanehiro/mc_rtc | 776017e46c1a4626c1d8f1fb7d51675a9b9b9cad | [
"BSD-2-Clause"
] | 20 | 2019-12-20T04:34:00.000Z | 2022-03-24T01:31:27.000Z | /*
* Copyright 2015-2019 CNRS-UM LIRMM, CNRS-AIST JRL
*/
#include <mc_control/fsm/Controller.h>
#include <mc_control/fsm/states/Posture.h>
#include <mc_rbdyn/configuration_io.h>
#include <mc_tasks/MetaTaskLoader.h>
namespace mc_control
{
namespace fsm
{
void PostureState::configure(const mc_rtc::Configuration & config)
{
if(config.has("postureTask"))
{
config_.load(config("postureTask"));
}
if(config.has("robot"))
{
robot_ = static_cast<std::string>(config("robot"));
}
if(config.has("completion"))
{
hasCompletion_ = true;
completion_ = config("completion");
}
}
void PostureState::start(Controller & ctl)
{
if(robot_.empty())
{
robot_ = ctl.robot().name();
}
else if(!ctl.hasRobot(robot_))
{
mc_rtc::log::error_and_throw<std::runtime_error>("[{}] Requested robot {} but this robot is not available", name(),
robot_);
}
auto postureTask = ctl.getPostureTask(robot_);
postureTask->load(ctl.solver(), config_);
crit_.configure(*postureTask, ctl.solver().dt(), completion_);
}
bool PostureState::run(Controller & ctl)
{
auto postureTask = ctl.getPostureTask(robot_);
if(crit_.completed(*postureTask))
{
output("OK");
return true;
}
return false;
}
void PostureState::teardown(Controller &) {}
} // namespace fsm
} // namespace mc_control
EXPORT_SINGLE_STATE("Posture", mc_control::fsm::PostureState)
| 21.264706 | 119 | 0.661826 | fkanehiro |
aad0d3b5437124698528b3ee345606ecbfa51cfd | 16,739 | cpp | C++ | apiwznm/PnlWznmChkDetail.cpp | mpsitech/wznm-WhizniumSBE | 4911d561b28392d485c46e98fb915168d82b3824 | [
"MIT"
] | 3 | 2020-09-20T16:24:48.000Z | 2021-12-01T19:44:51.000Z | apiwznm/PnlWznmChkDetail.cpp | mpsitech/wznm-WhizniumSBE | 4911d561b28392d485c46e98fb915168d82b3824 | [
"MIT"
] | null | null | null | apiwznm/PnlWznmChkDetail.cpp | mpsitech/wznm-WhizniumSBE | 4911d561b28392d485c46e98fb915168d82b3824 | [
"MIT"
] | null | null | null | /**
* \file PnlWznmChkDetail.cpp
* API code for job PnlWznmChkDetail (implementation)
* \copyright (C) 2016-2020 MPSI Technologies GmbH
* \author Alexander Wirthmueller (auto-generation)
* \date created: 5 Dec 2020
*/
// IP header --- ABOVE
#include "PnlWznmChkDetail.h"
using namespace std;
using namespace Sbecore;
using namespace Xmlio;
/******************************************************************************
class PnlWznmChkDetail::VecVDo
******************************************************************************/
uint PnlWznmChkDetail::VecVDo::getIx(
const string& sref
) {
string s = StrMod::lc(sref);
if (s == "butsaveclick") return BUTSAVECLICK;
if (s == "buttcoviewclick") return BUTTCOVIEWCLICK;
if (s == "butcalviewclick") return BUTCALVIEWCLICK;
return(0);
};
string PnlWznmChkDetail::VecVDo::getSref(
const uint ix
) {
if (ix == BUTSAVECLICK) return("ButSaveClick");
if (ix == BUTTCOVIEWCLICK) return("ButTcoViewClick");
if (ix == BUTCALVIEWCLICK) return("ButCalViewClick");
return("");
};
/******************************************************************************
class PnlWznmChkDetail::ContIac
******************************************************************************/
PnlWznmChkDetail::ContIac::ContIac(
const uint numFPupTyp
, const string& TxfCmt
) :
Block()
{
this->numFPupTyp = numFPupTyp;
this->TxfCmt = TxfCmt;
mask = {NUMFPUPTYP, TXFCMT};
};
bool PnlWznmChkDetail::ContIac::readXML(
xmlXPathContext* docctx
, string basexpath
, bool addbasetag
) {
clear();
bool basefound;
if (addbasetag)
basefound = checkUclcXPaths(docctx, basexpath, basexpath, "ContIacWznmChkDetail");
else
basefound = checkXPath(docctx, basexpath);
string itemtag = "ContitemIacWznmChkDetail";
if (basefound) {
if (extractUintAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "numFPupTyp", numFPupTyp)) add(NUMFPUPTYP);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "TxfCmt", TxfCmt)) add(TXFCMT);
};
return basefound;
};
void PnlWznmChkDetail::ContIac::writeXML(
xmlTextWriter* wr
, string difftag
, bool shorttags
) {
if (difftag.length() == 0) difftag = "ContIacWznmChkDetail";
string itemtag;
if (shorttags) itemtag = "Ci";
else itemtag = "ContitemIacWznmChkDetail";
xmlTextWriterStartElement(wr, BAD_CAST difftag.c_str());
writeUintAttr(wr, itemtag, "sref", "numFPupTyp", numFPupTyp);
writeStringAttr(wr, itemtag, "sref", "TxfCmt", TxfCmt);
xmlTextWriterEndElement(wr);
};
set<uint> PnlWznmChkDetail::ContIac::comm(
const ContIac* comp
) {
set<uint> items;
if (numFPupTyp == comp->numFPupTyp) insert(items, NUMFPUPTYP);
if (TxfCmt == comp->TxfCmt) insert(items, TXFCMT);
return(items);
};
set<uint> PnlWznmChkDetail::ContIac::diff(
const ContIac* comp
) {
set<uint> commitems;
set<uint> diffitems;
commitems = comm(comp);
diffitems = {NUMFPUPTYP, TXFCMT};
for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
return(diffitems);
};
/******************************************************************************
class PnlWznmChkDetail::ContInf
******************************************************************************/
PnlWznmChkDetail::ContInf::ContInf(
const string& TxtSrf
, const string& TxtTbl
, const string& TxtTco
, const string& TxtCal
) :
Block()
{
this->TxtSrf = TxtSrf;
this->TxtTbl = TxtTbl;
this->TxtTco = TxtTco;
this->TxtCal = TxtCal;
mask = {TXTSRF, TXTTBL, TXTTCO, TXTCAL};
};
bool PnlWznmChkDetail::ContInf::readXML(
xmlXPathContext* docctx
, string basexpath
, bool addbasetag
) {
clear();
bool basefound;
if (addbasetag)
basefound = checkUclcXPaths(docctx, basexpath, basexpath, "ContInfWznmChkDetail");
else
basefound = checkXPath(docctx, basexpath);
string itemtag = "ContitemInfWznmChkDetail";
if (basefound) {
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "TxtSrf", TxtSrf)) add(TXTSRF);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "TxtTbl", TxtTbl)) add(TXTTBL);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "TxtTco", TxtTco)) add(TXTTCO);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ci", "sref", "TxtCal", TxtCal)) add(TXTCAL);
};
return basefound;
};
set<uint> PnlWznmChkDetail::ContInf::comm(
const ContInf* comp
) {
set<uint> items;
if (TxtSrf == comp->TxtSrf) insert(items, TXTSRF);
if (TxtTbl == comp->TxtTbl) insert(items, TXTTBL);
if (TxtTco == comp->TxtTco) insert(items, TXTTCO);
if (TxtCal == comp->TxtCal) insert(items, TXTCAL);
return(items);
};
set<uint> PnlWznmChkDetail::ContInf::diff(
const ContInf* comp
) {
set<uint> commitems;
set<uint> diffitems;
commitems = comm(comp);
diffitems = {TXTSRF, TXTTBL, TXTTCO, TXTCAL};
for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
return(diffitems);
};
/******************************************************************************
class PnlWznmChkDetail::StatApp
******************************************************************************/
PnlWznmChkDetail::StatApp::StatApp(
const uint ixWznmVExpstate
) :
Block()
{
this->ixWznmVExpstate = ixWznmVExpstate;
mask = {IXWZNMVEXPSTATE};
};
bool PnlWznmChkDetail::StatApp::readXML(
xmlXPathContext* docctx
, string basexpath
, bool addbasetag
) {
clear();
string srefIxWznmVExpstate;
bool basefound;
if (addbasetag)
basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StatAppWznmChkDetail");
else
basefound = checkXPath(docctx, basexpath);
string itemtag = "StatitemAppWznmChkDetail";
if (basefound) {
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "srefIxWznmVExpstate", srefIxWznmVExpstate)) {
ixWznmVExpstate = VecWznmVExpstate::getIx(srefIxWznmVExpstate);
add(IXWZNMVEXPSTATE);
};
};
return basefound;
};
set<uint> PnlWznmChkDetail::StatApp::comm(
const StatApp* comp
) {
set<uint> items;
if (ixWznmVExpstate == comp->ixWznmVExpstate) insert(items, IXWZNMVEXPSTATE);
return(items);
};
set<uint> PnlWznmChkDetail::StatApp::diff(
const StatApp* comp
) {
set<uint> commitems;
set<uint> diffitems;
commitems = comm(comp);
diffitems = {IXWZNMVEXPSTATE};
for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
return(diffitems);
};
/******************************************************************************
class PnlWznmChkDetail::StatShr
******************************************************************************/
PnlWznmChkDetail::StatShr::StatShr(
const bool ButSaveAvail
, const bool ButSaveActive
, const bool TxtSrfActive
, const bool PupTypActive
, const bool TxtTblActive
, const bool TxtTcoActive
, const bool ButTcoViewAvail
, const bool ButTcoViewActive
, const bool TxtCalActive
, const bool ButCalViewAvail
, const bool ButCalViewActive
, const bool TxfCmtActive
) :
Block()
{
this->ButSaveAvail = ButSaveAvail;
this->ButSaveActive = ButSaveActive;
this->TxtSrfActive = TxtSrfActive;
this->PupTypActive = PupTypActive;
this->TxtTblActive = TxtTblActive;
this->TxtTcoActive = TxtTcoActive;
this->ButTcoViewAvail = ButTcoViewAvail;
this->ButTcoViewActive = ButTcoViewActive;
this->TxtCalActive = TxtCalActive;
this->ButCalViewAvail = ButCalViewAvail;
this->ButCalViewActive = ButCalViewActive;
this->TxfCmtActive = TxfCmtActive;
mask = {BUTSAVEAVAIL, BUTSAVEACTIVE, TXTSRFACTIVE, PUPTYPACTIVE, TXTTBLACTIVE, TXTTCOACTIVE, BUTTCOVIEWAVAIL, BUTTCOVIEWACTIVE, TXTCALACTIVE, BUTCALVIEWAVAIL, BUTCALVIEWACTIVE, TXFCMTACTIVE};
};
bool PnlWznmChkDetail::StatShr::readXML(
xmlXPathContext* docctx
, string basexpath
, bool addbasetag
) {
clear();
bool basefound;
if (addbasetag)
basefound = checkUclcXPaths(docctx, basexpath, basexpath, "StatShrWznmChkDetail");
else
basefound = checkXPath(docctx, basexpath);
string itemtag = "StatitemShrWznmChkDetail";
if (basefound) {
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ButSaveAvail", ButSaveAvail)) add(BUTSAVEAVAIL);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ButSaveActive", ButSaveActive)) add(BUTSAVEACTIVE);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "TxtSrfActive", TxtSrfActive)) add(TXTSRFACTIVE);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "PupTypActive", PupTypActive)) add(PUPTYPACTIVE);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "TxtTblActive", TxtTblActive)) add(TXTTBLACTIVE);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "TxtTcoActive", TxtTcoActive)) add(TXTTCOACTIVE);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ButTcoViewAvail", ButTcoViewAvail)) add(BUTTCOVIEWAVAIL);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ButTcoViewActive", ButTcoViewActive)) add(BUTTCOVIEWACTIVE);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "TxtCalActive", TxtCalActive)) add(TXTCALACTIVE);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ButCalViewAvail", ButCalViewAvail)) add(BUTCALVIEWAVAIL);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "ButCalViewActive", ButCalViewActive)) add(BUTCALVIEWACTIVE);
if (extractBoolAttrUclc(docctx, basexpath, itemtag, "Si", "sref", "TxfCmtActive", TxfCmtActive)) add(TXFCMTACTIVE);
};
return basefound;
};
set<uint> PnlWznmChkDetail::StatShr::comm(
const StatShr* comp
) {
set<uint> items;
if (ButSaveAvail == comp->ButSaveAvail) insert(items, BUTSAVEAVAIL);
if (ButSaveActive == comp->ButSaveActive) insert(items, BUTSAVEACTIVE);
if (TxtSrfActive == comp->TxtSrfActive) insert(items, TXTSRFACTIVE);
if (PupTypActive == comp->PupTypActive) insert(items, PUPTYPACTIVE);
if (TxtTblActive == comp->TxtTblActive) insert(items, TXTTBLACTIVE);
if (TxtTcoActive == comp->TxtTcoActive) insert(items, TXTTCOACTIVE);
if (ButTcoViewAvail == comp->ButTcoViewAvail) insert(items, BUTTCOVIEWAVAIL);
if (ButTcoViewActive == comp->ButTcoViewActive) insert(items, BUTTCOVIEWACTIVE);
if (TxtCalActive == comp->TxtCalActive) insert(items, TXTCALACTIVE);
if (ButCalViewAvail == comp->ButCalViewAvail) insert(items, BUTCALVIEWAVAIL);
if (ButCalViewActive == comp->ButCalViewActive) insert(items, BUTCALVIEWACTIVE);
if (TxfCmtActive == comp->TxfCmtActive) insert(items, TXFCMTACTIVE);
return(items);
};
set<uint> PnlWznmChkDetail::StatShr::diff(
const StatShr* comp
) {
set<uint> commitems;
set<uint> diffitems;
commitems = comm(comp);
diffitems = {BUTSAVEAVAIL, BUTSAVEACTIVE, TXTSRFACTIVE, PUPTYPACTIVE, TXTTBLACTIVE, TXTTCOACTIVE, BUTTCOVIEWAVAIL, BUTTCOVIEWACTIVE, TXTCALACTIVE, BUTCALVIEWAVAIL, BUTCALVIEWACTIVE, TXFCMTACTIVE};
for (auto it = commitems.begin(); it != commitems.end(); it++) diffitems.erase(*it);
return(diffitems);
};
/******************************************************************************
class PnlWznmChkDetail::Tag
******************************************************************************/
PnlWznmChkDetail::Tag::Tag(
const string& Cpt
, const string& CptSrf
, const string& CptTyp
, const string& CptTbl
, const string& CptTco
, const string& CptCal
, const string& CptCmt
) :
Block()
{
this->Cpt = Cpt;
this->CptSrf = CptSrf;
this->CptTyp = CptTyp;
this->CptTbl = CptTbl;
this->CptTco = CptTco;
this->CptCal = CptCal;
this->CptCmt = CptCmt;
mask = {CPT, CPTSRF, CPTTYP, CPTTBL, CPTTCO, CPTCAL, CPTCMT};
};
bool PnlWznmChkDetail::Tag::readXML(
xmlXPathContext* docctx
, string basexpath
, bool addbasetag
) {
clear();
bool basefound;
if (addbasetag)
basefound = checkUclcXPaths(docctx, basexpath, basexpath, "TagWznmChkDetail");
else
basefound = checkXPath(docctx, basexpath);
string itemtag = "TagitemWznmChkDetail";
if (basefound) {
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "Cpt", Cpt)) add(CPT);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "CptSrf", CptSrf)) add(CPTSRF);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "CptTyp", CptTyp)) add(CPTTYP);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "CptTbl", CptTbl)) add(CPTTBL);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "CptTco", CptTco)) add(CPTTCO);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "CptCal", CptCal)) add(CPTCAL);
if (extractStringAttrUclc(docctx, basexpath, itemtag, "Ti", "sref", "CptCmt", CptCmt)) add(CPTCMT);
};
return basefound;
};
/******************************************************************************
class PnlWznmChkDetail::DpchAppData
******************************************************************************/
PnlWznmChkDetail::DpchAppData::DpchAppData(
const string& scrJref
, ContIac* contiac
, const set<uint>& mask
) :
DpchAppWznm(VecWznmVDpch::DPCHAPPWZNMCHKDETAILDATA, scrJref)
{
if (find(mask, ALL)) this->mask = {SCRJREF, CONTIAC};
else this->mask = mask;
if (find(this->mask, CONTIAC) && contiac) this->contiac = *contiac;
};
string PnlWznmChkDetail::DpchAppData::getSrefsMask() {
vector<string> ss;
string srefs;
if (has(SCRJREF)) ss.push_back("scrJref");
if (has(CONTIAC)) ss.push_back("contiac");
StrMod::vectorToString(ss, srefs);
return(srefs);
};
void PnlWznmChkDetail::DpchAppData::writeXML(
xmlTextWriter* wr
) {
xmlTextWriterStartElement(wr, BAD_CAST "DpchAppWznmChkDetailData");
xmlTextWriterWriteAttribute(wr, BAD_CAST "xmlns", BAD_CAST "http://www.mpsitech.com/wznm");
if (has(SCRJREF)) writeString(wr, "scrJref", scrJref);
if (has(CONTIAC)) contiac.writeXML(wr);
xmlTextWriterEndElement(wr);
};
/******************************************************************************
class PnlWznmChkDetail::DpchAppDo
******************************************************************************/
PnlWznmChkDetail::DpchAppDo::DpchAppDo(
const string& scrJref
, const uint ixVDo
, const set<uint>& mask
) :
DpchAppWznm(VecWznmVDpch::DPCHAPPWZNMCHKDETAILDO, scrJref)
{
if (find(mask, ALL)) this->mask = {SCRJREF, IXVDO};
else this->mask = mask;
this->ixVDo = ixVDo;
};
string PnlWznmChkDetail::DpchAppDo::getSrefsMask() {
vector<string> ss;
string srefs;
if (has(SCRJREF)) ss.push_back("scrJref");
if (has(IXVDO)) ss.push_back("ixVDo");
StrMod::vectorToString(ss, srefs);
return(srefs);
};
void PnlWznmChkDetail::DpchAppDo::writeXML(
xmlTextWriter* wr
) {
xmlTextWriterStartElement(wr, BAD_CAST "DpchAppWznmChkDetailDo");
xmlTextWriterWriteAttribute(wr, BAD_CAST "xmlns", BAD_CAST "http://www.mpsitech.com/wznm");
if (has(SCRJREF)) writeString(wr, "scrJref", scrJref);
if (has(IXVDO)) writeString(wr, "srefIxVDo", VecVDo::getSref(ixVDo));
xmlTextWriterEndElement(wr);
};
/******************************************************************************
class PnlWznmChkDetail::DpchEngData
******************************************************************************/
PnlWznmChkDetail::DpchEngData::DpchEngData() :
DpchEngWznm(VecWznmVDpch::DPCHENGWZNMCHKDETAILDATA)
{
feedFPupTyp.tag = "FeedFPupTyp";
};
string PnlWznmChkDetail::DpchEngData::getSrefsMask() {
vector<string> ss;
string srefs;
if (has(SCRJREF)) ss.push_back("scrJref");
if (has(CONTIAC)) ss.push_back("contiac");
if (has(CONTINF)) ss.push_back("continf");
if (has(FEEDFPUPTYP)) ss.push_back("feedFPupTyp");
if (has(STATAPP)) ss.push_back("statapp");
if (has(STATSHR)) ss.push_back("statshr");
if (has(TAG)) ss.push_back("tag");
StrMod::vectorToString(ss, srefs);
return(srefs);
};
void PnlWznmChkDetail::DpchEngData::readXML(
xmlXPathContext* docctx
, string basexpath
, bool addbasetag
) {
clear();
bool basefound;
if (addbasetag)
basefound = checkUclcXPaths(docctx, basexpath, basexpath, "DpchEngWznmChkDetailData");
else
basefound = checkXPath(docctx, basexpath);
if (basefound) {
if (extractStringUclc(docctx, basexpath, "scrJref", "", scrJref)) add(SCRJREF);
if (contiac.readXML(docctx, basexpath, true)) add(CONTIAC);
if (continf.readXML(docctx, basexpath, true)) add(CONTINF);
if (feedFPupTyp.readXML(docctx, basexpath, true)) add(FEEDFPUPTYP);
if (statapp.readXML(docctx, basexpath, true)) add(STATAPP);
if (statshr.readXML(docctx, basexpath, true)) add(STATSHR);
if (tag.readXML(docctx, basexpath, true)) add(TAG);
} else {
contiac = ContIac();
continf = ContInf();
feedFPupTyp.clear();
statapp = StatApp();
statshr = StatShr();
tag = Tag();
};
};
| 29.944544 | 197 | 0.656849 | mpsitech |
aad0dc0b0a6f3ecabd8fb02405516b86e6eda6e3 | 339 | cpp | C++ | 00_cpp_beginners/04_pointers_memory/00_pointers/pointers.cpp | ganesh737/cfl-cpp | b1b9cff137897accca0f93a2d6f54129e5b9d19d | [
"MIT"
] | null | null | null | 00_cpp_beginners/04_pointers_memory/00_pointers/pointers.cpp | ganesh737/cfl-cpp | b1b9cff137897accca0f93a2d6f54129e5b9d19d | [
"MIT"
] | null | null | null | 00_cpp_beginners/04_pointers_memory/00_pointers/pointers.cpp | ganesh737/cfl-cpp | b1b9cff137897accca0f93a2d6f54129e5b9d19d | [
"MIT"
] | null | null | null | #include <iostream>
using namespace std;
int main() {
int nVal = 10;
int* pVal = &nVal;
cout << "nVal=" << nVal << endl;
cout << "pVal=" << pVal << endl;
cout << "*pVal=" << *pVal << endl;
cout << "sizeof(pVal)=" << sizeof(pVal) << endl;
cout << "sizeof(*pVal)=" << sizeof(*pVal) << endl;
return 0;
} | 22.6 | 54 | 0.501475 | ganesh737 |
aad1719583164cf3767724b1362548d81cc3228a | 1,218 | cpp | C++ | aws-cpp-sdk-chime/source/model/CreateSipMediaApplicationCallRequest.cpp | perfectrecall/aws-sdk-cpp | fb8cbebf2fd62720b65aeff841ad2950e73d8ebd | [
"Apache-2.0"
] | 1 | 2022-02-10T08:06:54.000Z | 2022-02-10T08:06:54.000Z | aws-cpp-sdk-chime/source/model/CreateSipMediaApplicationCallRequest.cpp | perfectrecall/aws-sdk-cpp | fb8cbebf2fd62720b65aeff841ad2950e73d8ebd | [
"Apache-2.0"
] | 1 | 2022-01-03T23:59:37.000Z | 2022-01-03T23:59:37.000Z | aws-cpp-sdk-chime/source/model/CreateSipMediaApplicationCallRequest.cpp | ravindra-wagh/aws-sdk-cpp | 7d5ff01b3c3b872f31ca98fb4ce868cd01e97696 | [
"Apache-2.0"
] | 1 | 2021-12-30T04:25:33.000Z | 2021-12-30T04:25:33.000Z | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
#include <aws/chime/model/CreateSipMediaApplicationCallRequest.h>
#include <aws/core/utils/json/JsonSerializer.h>
#include <utility>
using namespace Aws::Chime::Model;
using namespace Aws::Utils::Json;
using namespace Aws::Utils;
CreateSipMediaApplicationCallRequest::CreateSipMediaApplicationCallRequest() :
m_fromPhoneNumberHasBeenSet(false),
m_toPhoneNumberHasBeenSet(false),
m_sipMediaApplicationIdHasBeenSet(false),
m_sipHeadersHasBeenSet(false)
{
}
Aws::String CreateSipMediaApplicationCallRequest::SerializePayload() const
{
JsonValue payload;
if(m_fromPhoneNumberHasBeenSet)
{
payload.WithString("FromPhoneNumber", m_fromPhoneNumber);
}
if(m_toPhoneNumberHasBeenSet)
{
payload.WithString("ToPhoneNumber", m_toPhoneNumber);
}
if(m_sipHeadersHasBeenSet)
{
JsonValue sipHeadersJsonMap;
for(auto& sipHeadersItem : m_sipHeaders)
{
sipHeadersJsonMap.WithString(sipHeadersItem.first, sipHeadersItem.second);
}
payload.WithObject("SipHeaders", std::move(sipHeadersJsonMap));
}
return payload.View().WriteReadable();
}
| 21.75 | 79 | 0.761084 | perfectrecall |
aad1825460a7c417420398c215fefd9529353a97 | 1,214 | cpp | C++ | GuiLib/GuiButtonDoc.cpp | imxingquan/hotelMIS | f0da91dd5b4ffbe7d69a7038206a329e065d4c94 | [
"MIT"
] | 9 | 2019-11-28T02:42:01.000Z | 2021-12-25T08:32:02.000Z | GuiLib/GuiButtonDoc.cpp | imxingquan/hotelMIS | f0da91dd5b4ffbe7d69a7038206a329e065d4c94 | [
"MIT"
] | null | null | null | GuiLib/GuiButtonDoc.cpp | imxingquan/hotelMIS | f0da91dd5b4ffbe7d69a7038206a329e065d4c94 | [
"MIT"
] | 2 | 2021-01-07T10:00:07.000Z | 2021-11-01T11:18:37.000Z | // GuiButtonDoc.cpp : implementation file
//
#include "stdafx.h"
#include "GuiButtonDoc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGuiButtonDoc
CGuiButtonDoc::CGuiButtonDoc()
{
}
CGuiButtonDoc::~CGuiButtonDoc()
{
}
BEGIN_MESSAGE_MAP(CGuiButtonDoc, CWnd)
//{{AFX_MSG_MAP(CGuiButtonDoc)
ON_WM_CREATE()
ON_WM_PAINT()
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGuiButtonDoc message handlers
BOOL CGuiButtonDoc::Create(DWORD dwStyle, CWnd* pParentWnd, UINT nID)
{
// TODO: Add your specialized code here and/or call the base class
return CWnd::Create(NULL, NULL, dwStyle, CRect(0,0,0,0), pParentWnd, nID, NULL);
}
int CGuiButtonDoc::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
// TODO: Add your specialized creation code here
return 0;
}
void CGuiButtonDoc::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CWnd::OnPaint() for painting messages
}
| 19.901639 | 81 | 0.636738 | imxingquan |
aad2b51453302c5c467561dfd882137c374c187c | 815 | cc | C++ | src/somadicom/Dicom/CRImageStorageReader.cc | charbeljc/soma-io | 17548eb8eafdcb82d20ea6fba760856f279d7424 | [
"CECILL-B"
] | 3 | 2020-05-13T04:15:29.000Z | 2021-08-28T18:13:35.000Z | src/somadicom/Dicom/CRImageStorageReader.cc | charbeljc/soma-io | 17548eb8eafdcb82d20ea6fba760856f279d7424 | [
"CECILL-B"
] | 15 | 2018-10-30T16:52:14.000Z | 2022-02-15T12:34:00.000Z | src/somadicom/Dicom/CRImageStorageReader.cc | charbeljc/soma-io | 17548eb8eafdcb82d20ea6fba760856f279d7424 | [
"CECILL-B"
] | 3 | 2019-12-15T07:23:16.000Z | 2021-10-05T14:09:09.000Z | #ifdef SOMA_IO_DICOM
#include <soma-io/Dicom/CRImageStorageReader.h>
#else
#include <Dicom/CRImageStorageReader.h>
#endif
#include <dcmtk/config/osconfig.h>
#include <dcmtk/dcmdata/dcdatset.h>
#include <dcmtk/dcmdata/dcdeftag.h>
#include <dcmtk/dcmdata/dcuid.h>
dcm::CRImageStorageReader::CRImageStorageReader()
: dcm::SingleFileReader()
{
}
std::string dcm::CRImageStorageReader::getStorageUID()
{
return UID_ComputedRadiographyImageStorage;
}
bool dcm::CRImageStorageReader::readHeader( DcmDataset* dataset )
{
Float64 tmpFloat;
if ( dataset->findAndGetFloat64( DCM_SpatialResolution, tmpFloat ).good() )
{
_dataInfo->_resolution.x = (double)tmpFloat;
_dataInfo->_resolution.y = (double)tmpFloat;
}
return dcm::SingleFileReader::readHeader( dataset );
}
| 19.404762 | 77 | 0.730061 | charbeljc |
aad443b0febfc28694d99b2f0a2e2f887b32d0f3 | 2,768 | cpp | C++ | src/Test/TestMain.cpp | travelping/libamqp | afd15eec16bab7be4da9e4cc371392ea3f1a881e | [
"Apache-2.0"
] | 6 | 2015-11-05T10:28:59.000Z | 2021-05-06T03:50:12.000Z | src/Test/TestMain.cpp | travelping/libamqp | afd15eec16bab7be4da9e4cc371392ea3f1a881e | [
"Apache-2.0"
] | 2 | 2015-04-21T09:57:43.000Z | 2015-04-21T10:00:46.000Z | src/Test/TestMain.cpp | travelping/libamqp | afd15eec16bab7be4da9e4cc371392ea3f1a881e | [
"Apache-2.0"
] | 4 | 2016-09-14T08:01:24.000Z | 2021-06-15T11:24:14.000Z | /*
Copyright 2011-2012 StormMQ Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
#include <TestHarness.h>
#include <TestReporterStdout.h>
#include <XmlTestReporter.h>
#include <TraceReporter.h>
#include <iostream>
#include <fstream>
#include <SuiteFilter.h>
class ReporterMinder
{
public:
ReporterMinder(UnitTest::TestReporter *_reporter) : reporter(_reporter) {}
~ReporterMinder() { delete reporter; }
UnitTest::TestReporter& theReporter() const { return *reporter; }
private:
UnitTest::TestReporter *reporter;
};
class ArgumentProcessor
{
public:
ArgumentProcessor(SuiteFilter& filter) : _filter(filter), _reporter(0)
{
}
~ArgumentProcessor()
{
delete _reporter;
}
UnitTest::TestReporter& theReporter() const { return *_reporter; }
void scan(int argc, char const *argv[])
{
int i = 1;
while (i < argc && argv[i][0] == '-')
{
if (strcmp("--trace", argv[i]) == 0 && _reporter == 0)
{
_reporter = new TraceReporter();
}
else if (strcmp("--xml", argv[i]) == 0 && _reporter == 0)
{
_reporter = new UnitTest::XmlTestReporter(std::cout);
}
else if (strncmp("--xml=", argv[i], strlen("--xml=")) == 0 && _reporter == 0)
{
_resultFile.open(&argv[i][strlen("--xml=")]);
_reporter = new UnitTest::XmlTestReporter(_resultFile);
}
else if (strcmp("--exclude", argv[i]) == 0)
{
_filter.set_exclusion_mode();
}
i++;
}
while (i < argc)
{
_filter.add(argv[i++]);
}
if (_reporter == 0)
{
_reporter = new UnitTest::TestReporterStdout();
}
}
private:
std::ofstream _resultFile;
SuiteFilter& _filter;
UnitTest::TestReporter *_reporter;
};
int main(int argc, char const *argv[])
{
SuiteFilter filter;
ArgumentProcessor argumentProcessor(filter);
argumentProcessor.scan(argc, argv);
UnitTest::TestRunner runner(argumentProcessor.theReporter());
return runner.RunTestsIf(UnitTest::Test::GetTestList(), 0, filter, 0);
}
| 27.68 | 89 | 0.600434 | travelping |
aad457b42fbf4047458cbbacbfeadf42145e5c43 | 10,436 | cpp | C++ | src/gba/ppu/sprite.cpp | destoer/destoer-emu | 2a7941b175126e998eed2df8df87ee382c43d0b1 | [
"BSD-3-Clause"
] | 20 | 2020-01-19T21:54:23.000Z | 2021-11-28T17:27:15.000Z | src/gba/ppu/sprite.cpp | destoer/destoer-emu | 2a7941b175126e998eed2df8df87ee382c43d0b1 | [
"BSD-3-Clause"
] | 3 | 2020-05-01T07:46:10.000Z | 2021-09-18T13:50:18.000Z | src/gba/ppu/sprite.cpp | destoer/destoer-emu | 2a7941b175126e998eed2df8df87ee382c43d0b1 | [
"BSD-3-Clause"
] | null | null | null | #include <gba/gba.h>
namespace gameboyadvance
{
void Display::render_sprites(int mode)
{
const TileData lose_bg(read_bg_palette(0,0),pixel_source::bd);
// make all of the line lose
// until something is rendred over it
std::fill(sprite_line.begin(),sprite_line.end(),lose_bg);
std::fill(sprite_semi_transparent.begin(),sprite_semi_transparent.end(),false);
std::fill(sprite_priority.begin(),sprite_priority.end(),5);
// objects aernt enabled do nothing more
if(!disp_io.disp_cnt.obj_enable)
{
return;
}
std::fill(oam_priority.begin(),oam_priority.end(),128+1);
const bool is_bitmap = mode >= 3;
// have to traverse it in forward order
// even though reverse is easier to handle most cases
for(uint32_t i = 0; i < 128; i++)
{
int obj_idx = i * 8;
const auto attr0 = handle_read<uint16_t>(mem.oam,obj_idx);
const auto attr1 = handle_read<uint16_t>(mem.oam,obj_idx+2);
const auto attr2 = handle_read<uint16_t>(mem.oam,obj_idx+4);
const bool affine = is_set(attr0,8);
// should check mosaic by here but we will just ignore it for now
// disable bit in regular mode
if(is_set(attr0,9) && !affine)
{
continue;
}
const int obj_mode = (attr0 >> 10) & 0x3;
// prohibited is this ignored on hardware
// or does it behave like another?
if(obj_mode == 3)
{
continue;
}
const int shape = (attr0 >> 14) & 0x3;
// prohibited is this ignored on hardware
// or does it behave like another?
if(shape == 3)
{
continue;
}
const int obj_size = (attr1 >> 14) & 0x3;
static constexpr int32_t x_size_lookup[3][4] =
{
{8,16,32,64},
{16,32,32,64},
{8,8,16,32}
};
static constexpr int32_t y_size_lookup[3][4] =
{
{8,16,32,64},
{8,8,16,32},
{16,32,32,64}
};
auto y_size = y_size_lookup[shape][obj_size];
auto x_size = x_size_lookup[shape][obj_size];
// original size of the sprite that is not affected by the double size flag
const auto x_sprite_size = x_size;
const auto y_sprite_size = y_size;
const bool double_size = is_set(attr0,9) && affine;
uint32_t y_cord = attr0 & 0xff;
// current x cords greater than screen width are handled in the decode loop
// by ignoring them until they are in range
uint32_t x_cord = attr1 & 511;
// bounding box even if double isnt going to draw outside
// because of how we operate on it
// how to get this working?
// on the top and left side its not going to extend
// only to the postive so we need to find a way to "centre" it
// see tonc graphical artifacts
if(double_size)
{
x_size *= 2;
y_size *= 2;
}
// if cordinate out of screen bounds and does not wrap around
// then we dont care
if(x_cord >= SCREEN_WIDTH && x_cord + x_size < 512)
{
continue;
}
// check we intersect with the current ly
bool line_overlap;
if(y_cord < SCREEN_HEIGHT)
{
line_overlap = y_cord + y_size > ly && y_cord <= ly;
}
// overflowed from 255
else
{
// by definiton it is allways greater than ly before it overflows
uint8_t y_end = (y_cord + y_size) & 0xff;
line_overlap = y_end >= ly && y_end < SCREEN_HEIGHT;
}
if(!line_overlap)
{
continue;
}
const bool color = is_set(attr0,13);
// assume palette
unsigned int tile_num = attr2 & 0x3ff;
// lower bit ignored in 2d mapping
if(color && !disp_io.disp_cnt.obj_vram_mapping)
{
tile_num &= ~1;
}
const unsigned int pal = (attr2 >> 12) & 0xf;
const unsigned int priority = (attr2 >> 10) & 3;
// bitmap modes starts at 0x14000 instead of 0x10000
// because of bg map tiles below this are simply ignored
if(is_bitmap && tile_num < 512)
{
continue;
}
// merge both into a single loop by here and dont worry about it being fast
// or this will fast become a painful mess to work with
// figure out how the affine transforms is actually calculated
const bool x_flip = is_set(attr1,12) && !affine;
const bool y_flip = is_set(attr1,13) && !affine;
const uint32_t aff_param = (attr1 >> 9) & 31;
// rotation centre
const int32_t x0 = x_sprite_size / 2;
const int32_t y0 = y_sprite_size / 2;
const int32_t y_max = y_size - 1;
const int32_t y1 = y_flip? y_max - ((ly-y_cord) & y_max) : ((ly-y_cord) & y_max);
for(int32_t x1 = 0; x1 < x_size; x1++)
{
const uint32_t x_offset = (x_cord + x1) & 511;
// probably a nicer way to do this but this is fine for now
if(x_offset >= SCREEN_WIDTH)
{
continue;
}
int32_t y2 = y1;
int32_t x2 = x1;
if(affine)
{
const auto base = aff_param*0x20;
// 8.8 fixed point
const int16_t pa = handle_read<uint16_t>(mem.oam,base+0x6);
const int16_t pb = handle_read<uint16_t>(mem.oam,base+0xe);
const int16_t pc = handle_read<uint16_t>(mem.oam,base+0x16);
const int16_t pd = handle_read<uint16_t>(mem.oam,base+0x1e);
const int32_t x_param = x1 - (x_size / 2);
const int32_t y_param = y1 - (y_size / 2);
// perform the affine transform (8.8 fixed point)
x2 = ((pa*x_param + pb*y_param) >> 8) + x0;
y2 = ((pc*x_param + pd*y_param) >> 8) + y0;
// out of range transform pixel is transparent
if(x2 >= x_sprite_size || y2 >= y_sprite_size || x2 < 0 || y2 < 0)
{
continue;
}
}
else if(x_flip)
{
x2 = x_size - x2 - 1;
}
uint32_t tile_offset;
// 1d object mapping
if(disp_io.disp_cnt.obj_vram_mapping)
{
tile_offset = ((y2 / 8) * (x_sprite_size / 8)) + (x2 / 8);
}
// 2d object mapping
// in 4bpp 1024 tiles split into 32 by 32
// or 16 by 32 in 8bpp mode
else
{
tile_offset = ((y2 / 8) * (32 >> color)) + (x2 / 8);
}
const auto &disp_cnt = disp_io.disp_cnt;
// 4bpp
if(!color)
{
// base + tile_base * tile_size
const uint32_t addr = 0x10000 + ((tile_offset + tile_num) * 8 * 4);
const uint32_t data_offset = ((x2 % 8) / 2) + ((y2 % 8) * 4);
const auto tile_data = mem.vram[addr+data_offset];
// lower x cord stored in lower nibble
const uint32_t idx = ((x2 & 1)? (tile_data >> 4) : tile_data) & 0xf;
// object window obj not displayed any non zero pixels are
// the object window
if(idx != 0 && obj_mode == 2 && disp_cnt.obj_window_enable)
{
// window 0 and 1 have higher priority
if(window[x_offset] == window_source::out)
{
window[x_offset] = window_source::obj;
}
}
else
{
if(i < oam_priority[x_offset])
{
if(idx != 0)
{
const auto color = read_obj_palette(pal,idx);
sprite_line[x_offset].color = color;
sprite_line[x_offset].source = pixel_source::obj;
oam_priority[x_offset] = i;
}
// hardware bug priority is updated even if transparent
sprite_priority[x_offset] = priority;
}
}
}
else
{
// base + tile_base * tile_size
// tile size is still 32 bytes for the tile num in 256 for some reason (thanks fleroviux)
// even though the bg uses the logical 64...
// the actual offset into it because of the cords is still 64
const uint32_t addr = 0x10000 + (tile_num * 8 * 4) + (tile_offset * 8 * 8);
const uint32_t data_offset = (x2 % 8) + ((y2 % 8) * 8);
const auto tile_data = mem.vram[addr+data_offset];
// object window obj not displayed any non zero pixels are
// the object window
if(tile_data != 0 && obj_mode == 2 && disp_cnt.obj_window_enable)
{
// window 0 and 1 have higher priority
if(window[x_offset] == window_source::out)
{
window[x_offset] = window_source::obj;
}
}
else
{
if(i < oam_priority[x_offset])
{
if(tile_data != 0)
{
const auto color = read_obj_palette(0,tile_data);
sprite_line[x_offset].color = color;
sprite_line[x_offset].source = pixel_source::obj;
oam_priority[x_offset] = i;
}
// hardware bug priority is updated even if transparent
sprite_priority[x_offset] = priority;
}
}
}
if(obj_mode == 1)
{
sprite_semi_transparent[x_offset] = true;
}
}
}
}
} | 30.425656 | 105 | 0.489651 | destoer |
aad4ab0111b41f4c4709b51a73a308d801926c59 | 39,701 | cc | C++ | project/c++/mri/src/iwf/src/manual_parser.cc | jia57196/code41 | df611f84592afd453ccb2d22a7ad999ddb68d028 | [
"Apache-2.0"
] | null | null | null | project/c++/mri/src/iwf/src/manual_parser.cc | jia57196/code41 | df611f84592afd453ccb2d22a7ad999ddb68d028 | [
"Apache-2.0"
] | null | null | null | project/c++/mri/src/iwf/src/manual_parser.cc | jia57196/code41 | df611f84592afd453ccb2d22a7ad999ddb68d028 | [
"Apache-2.0"
] | null | null | null | /**
* Copyright (2012-2014) JSU Uniphase. All rights reserved.
*
* Author: LIM Fung Chai
*/
#include "xtreme/iwf/manual_parser.h"
#include "xtreme/iwf/internal/manual_parser_telemetry.h"
#include <sstream>
#include <iomanip>
#include <boost/format.hpp>
#include "arpa/inet.h"
#include "log4cxx/logger.h"
#include "xtreme/iwf/iwf.h"
#include "xtreme/cs/cs.h"
#include "xtreme/config/csparamapi.h"
#include "xtreme/common/event_frame.h"
#include "xtreme/common/parsed_frame.h"
#include "xtreme/common/debug.h"
namespace {
log4cxx::LoggerPtr g_logger(log4cxx::Logger::getLogger("xtreme.iwf.manual-parser"));
log4cxx::LoggerPtr g_telemetry_logger(log4cxx::Logger::getLogger("xtreme.telemetry.manual-parser"));
int g_trace_log_enabled = -1;
int g_debug_log_enabled = -1;
std::string hex_dump(const uint8_t* data, uint32_t len) {
std::ostringstream s;
for (size_t i = 0; i < len; ++i) {
if (i) {
s << ", ";
}
s << boost::format("0x%1$02x") % static_cast<unsigned int>(data[i]);
}
return s.str();
}
std::string dump_ether_type(uint16_t ether_type) {
std::ostringstream stream;
stream << "0x" << std::hex << std::setw(4) << std::setfill('0') << htons(ether_type);
return stream.str();
}
std::string dump_vlan(const xtreme::VlanTag* vlan) {
std::ostringstream stream;
stream << "0x" << std::hex << std::setw(8) << std::setfill('0') << htonl(vlan->u32b_);
return stream.str();
}
std::string dump_mpls(const xtreme::MplsEntry* mpls) {
std::ostringstream stream;
stream << "0x" << std::hex << std::setw(8) << std::setfill('0') << htonl(mpls->u32b_);
return stream.str();
}
const char* g_protocol_names[] = {
0 // 0x00 IPv6 Hop-by-Hop Option
, "ICMPv4" // 0x01 Internet Control Message Protocol
, "IGMP" // 0x02 Internet Group Management Protocol (multicast)
, "GGP" // 0x03 Gateway-to-Gateway Protocol
, 0 // 0x04 IPv4 encapsulation
, 0 // 0x05 Internet Stream Protocol
, "TCP" // 0x06 Transmission Control Protocol
, 0 // 0x07 Core-based trees
, "EGP" // 0x08 Exterior Gateway Protocol
, "IGP" // 0x09 Interior Gateway Protocol
, 0 // 0x0a BBN RCC Monitoring
, 0 // 0x0b Network Voice Protocol
, 0 // 0x0c Xerox PUP
, 0 // 0x0d ARGUS
, 0 // 0x0e EMCON
, 0 // 0x0f XNET
, 0 // 0x10 Chaos
, "UDP" // 0x11 User Datagram Protocol
, 0 // 0x12 Multiplexing
, 0 // 0x13 DCN Measurement Subsystems
, 0 // 0x14 Host Monitoring Protocol
, 0 // 0x15 Pakcet Radio Measurement
, 0 // 0x16 Xerox NS IDP
, 0 // 0x17 Trunk-1
, 0 // 0x18 Trunk-2
, 0 // 0x19 Leaf-1
, 0 // 0x1a Leaf-2
, "RDP" // 0x1b Reliable Datagram Protocol
, "IRTP" // 0x1c Internet Reliable Transaction Protocol
, 0 // 0x1d ISO Transport Protocol Class 4
, 0 // 0x1e Bulk Data Transfer Protocol
, 0 // 0x1f MFE Network Service Protocol
, 0 // 0x20 Merit Internodal Protocol
, 0 // 0x21 Datagram Congestion Control Protocol
, 0 // 0x22 Third Party Connect Protocol
, 0 // 0x23 Inter-Domain Policy Routing Protocol
, 0 // 0x24 Xpress Transport Protocol
, 0 // 0x25 Datagram Delivery Protocol
, 0 // 0x26 IDPR Control Message Control Protocol
, 0 // 0x27 TP++ Transport Protocol
, 0 // 0x28 IL Transport Protocol
, 0 // 0x29 IPv6 encapsulation
, 0 // 0x2a Source Demand Routing Protocol
, 0 // 0x2b IPv6 extension Routing Header
, 0 // 0x2c IPv6 extension Fragment Header
, "IDRP" // 0x2d Inter-Domain Routing Protocol
, "RSVP" // 0x2e Resource Reservation Protocol
, 0 // 0x2f Generic Routing Encapsulation
, 0 // 0x30 Mobile Host Routing Protocol
, 0 // 0x31 BNA
, 0 // 0x32 IPv6 Extension Encapsulating Security Payload Header
, 0 // 0x33 IPv6 Extension Authentication Header
, 0 // 0x34 Integrated Net Layer Security Protocol
, 0 // 0x35 SwiPe
, 0 // 0x36 NBMA Address Resolution Protocol
, 0 // 0x37 IPv6 Extension IP Mobility Header
, 0 // 0x38 Transport Layer Security Protocol
, 0 // 0x39 Simple Key-Management for Internet Protocol
, "ICMPv6" // 0x3a ICMP for IPv6
, 0 // 0x3b IPv6 Extension No-Next Header
, 0 // 0x3c IPv6 Extension Destination Options Header
, 0 // 0x3d Any host internal protocol
, 0 // 0x3e CFTP
, 0 // 0x3f Any local network
, 0 // 0x40 SATNET and Backroom EXPAK
, 0 // 0x41 Kryptolan
, 0 // 0x42 MIT Remote Virtual Disk Protocol
, 0 // 0x43 Internet Pluribus Packet Core
, 0 // 0x44 Any distributed file system
, 0 // 0x45 SATNET Monitoring
, 0 // 0x46 VISA Protocol
, 0 // 0x47 Internet Packet Core Utility
, 0 // 0x48 Computer Protocol Network Executive
, 0 // 0x49 Computer Protocol Heart Beat
, 0 // 0x4a Wang Span Network
, 0 // 0x4b Packet Video Protocol
, 0 // 0x4c Backroom SATNET Monitoring
, 0 // 0x4d SUN ND Protocol
, 0 // 0x4e Wideband Monitoring
, 0 // 0x4f Wideband ExPak
, 0 // 0x50 International Organization for Standardization Internet Protocol
, 0 // 0x51 Versatile Message Transaction Protocol
, 0 // 0x52 Secure Versatile Message Transaction Protocol
, 0 // 0x53 VINES
, 0 // 0x54 TTP, Internet Protocol Traffic Management
, 0 // 0x55 NFSNET-IGP
, 0 // 0x56 Disimilar Gateway Protocol
, 0 // 0x57 TCF
, 0 // 0x58 EIGRP
, "OSPF" // 0x59 Open Shortest Path First
, 0 // 0x5a Sprite RPC Protocol
, 0 // 0x5b Locus Address Resolution Protocol
, 0 // 0x5c Multicast Transport Protocol
, 0 // 0x5d AX.25
, 0 // 0x5e IP-within-IP Encapsulation Protocol
, 0 // 0x5f Mobile Internetworking Control Protocol
, 0 // 0x60 Semaphore Communication Sec Protocol
, 0 // 0x61 Ethernet-within-IP encapsulation
, 0 // 0x62 Encapsulation Header
, 0 // 0x63 Any private encryption scheme
, 0 // 0x64 GMTP
, 0 // 0x65 Ipsilon Flow Management Protocol
, 0 // 0x66 PNNI over IP
, 0 // 0x67 Protocol Independent Multicast
, 0 // 0x68 IBM Aggregate Route IP Switching Protocol
, 0 // 0x69 Space Communcations Protocol Standard
, 0 // 0x6a QNX
, 0 // 0x6b Active Networks
, 0 // 0x6c IP Payload Compression Protocol
, 0 // 0x6d Sitara Networks Protocol
, 0 // 0x6e Compaq Peer Protocol
, 0 // 0x6f IPX in IP
, 0 // 0x70 Virtual Router Redundancy Protocol
, 0 // 0x71 PGM Reliable Transport Protocol
, 0 // 0x72 Any 0-hop protocol
, 0 // 0x73 Layer Two Tunnelling Protocol
, 0 // 0x74 D-II Data Exchange
, 0 // 0x75 Interactive Agent Transfer Protocol
, 0 // 0x76 Schedule Transfer Protocol
, 0 // 0x77 SpectraLink Radio Protocol
, 0 // 0x78 Univeral Transport Interface Protocol
, 0 // 0x79 Simple Message Protocol
, 0 // 0x7a Simple Multicast Protocol
, 0 // 0x7b Performance Transparency Protocol
, 0 // 0x7c Intermediate System to Intermediate System Protocol
, 0 // 0x7d Flexible Intra-AS Routing Environment
, 0 // 0x7e Combat Radio Transport Protocol
, 0 // 0x7f Combat Radio User Datagram
, 0 // 0x80 Service Specific Connection-oriented Protocol
, 0 // 0x81 IPLT
, 0 // 0x82 Secure Packet Shield
, 0 // 0x83 Private IP Encapsulation within IP
, "SCTP" // 0x84 Stream Control Transmission Protocol
, 0 // 0x85 Fibre Channel
, 0 // 0x86 Reservation Protocol End-to_End Ignore
, 0 // 0x87 IPv6 Extension Mobilility Header
, 0 // 0x88 Lightweight User Datagram Protocol
, 0 // 0x89 MPLS within IP
, 0 // 0x8a MANET Protocol
, 0 // 0x8b Host Identity Protocol
, 0 // 0x8c Site Multihoming by IPv6 Intermediation
, 0 // 0x8d Wrapped Encapsulating Security Payload
, 0 // 0x8e Robust Header Compression
, 0 // 0x8f Unassigned
};
} // anonymous namespace
namespace xtreme {
namespace iwf {
class ManualParserHelper {
public:
void set_ethernet_frame(ParsedFrame* pf, const EthernetFrame* ethernet_frame) {
pf->ethernet_frame_ = ethernet_frame;
pf->ethernet_layer_ = ParsedFrame::ETHERNET_LAYER_;
}
void set_lower_ipv4_header(ParsedFrame* pf, const IPv4Header* ipv4_header) {
pf->lower_network_header_ = ipv4_header;
pf->lower_network_layer_ = ParsedFrame::IPv4_NETWORK_LAYER_;
}
void set_lower_ipv6_header(ParsedFrame* pf, const IPv6Header* ipv6_header) {
pf->lower_network_header_ = ipv6_header;
pf->lower_network_layer_ = ParsedFrame::IPv6_NETWORK_LAYER_;
}
void set_lower_udp_header(ParsedFrame* pf, const UDPHeader* udp_header) {
pf->lower_transport_header_ = udp_header;
pf->lower_transport_layer_ = ParsedFrame::UDP_TRANSPORT_LAYER_;
}
void set_lower_tcp_header(ParsedFrame* pf, const TCPHeader* tcp_header) {
pf->lower_transport_header_ = tcp_header;
pf->lower_transport_layer_ = ParsedFrame::TCP_TRANSPORT_LAYER_;
}
void set_lower_sctp_header(ParsedFrame* pf, const SCTPHeader* sctp_header) {
pf->lower_transport_header_ = sctp_header;
pf->lower_transport_layer_ = ParsedFrame::SCTP_TRANSPORT_LAYER_;
}
void set_gtpv1_header(ParsedFrame* pf, const GTPv1Header* gtpv1_header) {
pf->gtp_header_ = gtpv1_header;
pf->gtp_layer_ = ParsedFrame::GTPv1_LAYER_;
}
void set_gtpv2_header(ParsedFrame* pf, const GTPv2Header* gtpv2_header) {
pf->gtp_header_ = gtpv2_header;
pf->gtp_layer_ = ParsedFrame::GTPv2_LAYER_;
}
void set_upper_ipv4_header(ParsedFrame* pf, const IPv4Header* ipv4_header) {
pf->upper_network_header_ = ipv4_header;
pf->upper_network_layer_ = ParsedFrame::IPv4_NETWORK_LAYER_;
}
void set_upper_ipv6_header(ParsedFrame* pf, const IPv6Header* ipv6_header) {
pf->upper_network_header_ = ipv6_header;
pf->upper_network_layer_ = ParsedFrame::IPv6_NETWORK_LAYER_;
}
void set_upper_udp_header(ParsedFrame* pf, const UDPHeader* udp_header) {
pf->upper_transport_header_ = udp_header;
pf->upper_transport_layer_ = ParsedFrame::UDP_TRANSPORT_LAYER_;
}
void set_upper_tcp_header(ParsedFrame* pf, const TCPHeader* tcp_header) {
pf->upper_transport_header_ = tcp_header;
pf->upper_transport_layer_ = ParsedFrame::TCP_TRANSPORT_LAYER_;
}
void set_upper_sctp_header(ParsedFrame* pf, const SCTPHeader* sctp_header) {
pf->upper_transport_header_ = sctp_header;
pf->upper_transport_layer_ = ParsedFrame::SCTP_TRANSPORT_LAYER_;
}
};
class ManualParserDataSink::Impl {
public:
explicit Impl(iwf *manager);
~Impl();
bool decode(Event* frame);
bool drop_before_manual_parser_;
Telemetry telemetry_;
private:
bool decode_vlan();
bool decode_mpls();
bool decode_ipv4(bool is_parsing_upper = false);
bool decode_ipv6(bool is_parsing_upper = false);
bool decode_tcp(bool is_parsing_upper = false);
bool decode_udp(bool is_parsing_upper = false);
bool decode_sctp(bool is_parsing_upper = false);
bool decode_gtp_control();
bool decode_gtp_user();
bool decode_gtpv1_header();
// Decode the payload as a IPv4 or IPv6 packet encapsulated by a tunnel protocol;
// decoding stops at the transport-layer.
// The parameter, tunnel_protocol_name, is for purpose of logging error message.
// An example is "GTP-U".
bool decode_tunnelled_ip(const std::string& tunnel_protocol_name);
iwf *manager_;
ManualParserHelper helper_;
// Used by the various decoder stages.
xtreme::ParsedFrame* pf_;
const uint8_t* packet_data_;
uint32_t packet_len_;
uint32_t offset_;
uint16_t eType_;
uint8_t protocol_;
uint8_t upper_protocol_;
// Telemetry to capture characteristics of the traffic being decoded.
bool telemetry_enabled_;
uint32_t telemetry_period_;
uint32_t throttle_;
uint32_t throttle_threshold_;
uint32_t last_check_sec_;
Timestamp period_start_timestamp_;
};
ManualParserDataSink::Impl::Impl(iwf *manager) {
manager_ = manager;
drop_before_manual_parser_ = false;
try {
if (manager_) {
drop_before_manual_parser_ = manager_->GetCS().getCSParamAPI()
->get_bool("DEBUG/DROP_AT_MANUAL_PARSER_START");
}
if (drop_before_manual_parser_) {
LOG4CXX_INFO(g_logger, "Dropping frames before manual parsing");
}
} catch(...) {
}
throttle_ = 0;
throttle_threshold_ = 10000;
last_check_sec_ = 0;
telemetry_enabled_ = false;
telemetry_period_ = 300;
xtreme::config::CSParamAPI* config = nullptr;
if (manager_) {
config = manager_->GetCS().getCSParamAPI();
try {
telemetry_enabled_ = config->get_bool("IWF/manual_parser_telemetry_enabled");
} catch(...) {
}
try {
telemetry_period_ = config->get_uint("IWF/TELEMETRY_PERIOD");
} catch(...) {
}
}
}
ManualParserDataSink::Impl::~Impl() {
}
bool ManualParserDataSink::Impl::decode(Event* event) {
if (event->type() != kEVENT_FRAME) {
return false;
}
if (telemetry_enabled_) {
++telemetry_.frames;
if (++throttle_ > throttle_threshold_) {
throttle_ = 0;
const uint32_t this_secs = event->timestamp().sec_;
const uint32_t sec_diff = this_secs < last_check_sec_ ?
0 : this_secs - last_check_sec_;
if (sec_diff > 10) {
last_check_sec_ = this_secs;
Timestamp now = Timestamp::SystemNow();
if (period_start_timestamp_.sec_ == 0) {
period_start_timestamp_ = now;
} else {
Duration delta = now - period_start_timestamp_;
if (delta.sec() >= telemetry_period_) {
telemetry_.dump();
telemetry_.reset();
}
}
}
}
}
FrameEvent* frame = static_cast<FrameEvent*>(event);
pf_ = frame->parsed_frame();
packet_data_ = frame->payload();
packet_len_ = frame->payload_len();
offset_ = 0;
if (packet_len_ < sizeof(EthernetFrame)) {
LOG_DEBUG("ManualParser::decode: payload is too small to hold an ethernet frame, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
// See http://en.wikipedia.org/wiki/Ethernet_frame
helper_.set_ethernet_frame(pf_, reinterpret_cast<const EthernetFrame*>(packet_data_));
offset_ += sizeof *pf_->ethernet_frame_;
eType_ = pf_->ethernet_frame_->ether_type_;
bool mpls = false;
LOG_TRACE("dest=" << pf_->ethernet_frame_->dest_mac_addr() << " src="
<< pf_->ethernet_frame_->src_mac_addr() << " ether-type=" << dump_ether_type(eType_));
do {
if (eType_ == ETHER_PROTO_VLAN) {
if (pf_->vlan_ptr_ == nullptr) {
pf_->vlan_ptr_ = reinterpret_cast<const VlanTag*>(&pf_->ethernet_frame_->ether_type_);
if (telemetry_enabled_) ++telemetry_.vlan;
}
if (!decode_vlan()) {
return false;
}
} else if (eType_ == ETHER_PROTO_MPLS_UNICAST || eType_ == ETHER_PROTO_MPLS_MULTICAST) {
mpls = true;
if (!decode_mpls()) {
return false;
} else {
break;
}
} else if (eType_ != ETHER_PROTO_IPV4 && eType_ != ETHER_PROTO_IPV6) {
if (eType_ == ETHER_PROTO_ARP) {
if (telemetry_enabled_) {
++telemetry_.arp;
}
LOG_TRACE("ARP packet");
} else if (eType_ == ETHER_PROTO_RARP) {
if (telemetry_enabled_) {
++telemetry_.rarp;
}
LOG_TRACE("RARP packet");
} else {
if (telemetry_enabled_) {
++telemetry_.other_etypes;
}
LOG_TRACE("not ip-based ether-type=" << dump_ether_type(eType_));
}
return false;
}
} while (eType_ != ETHER_PROTO_IPV4 && eType_ != ETHER_PROTO_IPV6);
// 1. In some packets, the type in the ethernet frame is 0x0800 but the version number in the
// IPv4 header is 6. The ethernet frame type should have been 0x86DD to indicate it is an
// IPv6 packet.
// 2. When MPLS stack exist in the packet, the eType will be set to 0x8847 or 0x8848. And the
// following stack will be IP, therefore need to check the first byte of the coming data to
// determine the version of IP is used.
uint8_t ip_version = 0;
if (eType_ == ETHER_PROTO_IPV4 || eType_ == ETHER_PROTO_IPV6 || mpls) {
const IPv4Header* ip4 = reinterpret_cast<const IPv4Header*>(packet_data_ + offset_);
ip_version = ip4->version();
if (!mpls) {
if (ip_version == 6) {
eType_ = ETHER_PROTO_IPV6;
LOG_TRACE("ipv6 packet masquerading as ipv4");
}
}
}
if (telemetry_enabled_) {
if (mpls) {
++telemetry_.mpls;
}
if (ip_version == 4) {
++telemetry_.lower_ipv4;
} else if (ip_version == 6) {
++telemetry_.lower_ipv6;
}
}
if (eType_ == ETHER_PROTO_IPV4 || (mpls && ip_version == 4)) {
if (!decode_ipv4()) {
return false;
}
} else if (eType_ == ETHER_PROTO_IPV6 || (mpls && ip_version == 6)) {
if (!decode_ipv6()) {
return false;
}
} else {
LOG4CXX_ERROR(g_logger, "this can't happen");
return false;
}
if (telemetry_enabled_) {
++telemetry_.lower_protocols[protocol_];
}
if (const IPv4Header* ipv4 = pf_->lower_ipv4_header()) {
if (ipv4->offset()) {
// When IP fragments, only the first fragment contains the transport protocol header,
// the other fragments (non-zero offset) cannot be decoded.
++telemetry_.lower_protocols_ipv4_frags[protocol_];
return true;
}
} else if (const IPv6ExtHeaders* headers = pf_->lower_ipv6_ext_headers()) {
if (headers->fragment_present()) {
IPv6FragmentHeader f = headers->fragment_header();
if (f.fragment_offset()) {
// When IP fragments, only the first fragment contains the transport protocol
// header, the other fragments (non-zero offset) cannot be decoded.
++telemetry_.lower_protocols_ipv6_frags[protocol_];
return true;
}
}
}
if (protocol_ == UDP_PROTOCOL) {
if (!decode_udp()) {
return false;
}
} else if (protocol_ == TCP_PROTOCOL) {
if (!decode_tcp()) {
return false;
}
} else if (protocol_ == SCTP_PROTOCOL) {
if (!decode_sctp()) {
return false;
}
} else {
// TODO(fclim): handle other transport-layer protocols besides TCP, UDP, and SCTP.
LOG_TRACE("ether-type=" << dump_ether_type(eType_)
<< " protocol=" << static_cast<unsigned int>(protocol_));
}
return true;
}
bool ManualParserDataSink::Impl::decode_vlan() {
// See http://en.wikipedia.org/wiki/802.1Q_VLAN_tag
const VlanTag* vlan = &pf_->vlan_ptr_[pf_->vlan_count_];
if (offset_ + sizeof *vlan > packet_len_) {
LOG_DEBUG("ManualParser::decode: payload is too small to hold a VLAN tag, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
eType_ = *reinterpret_cast<const uint16_t*>(packet_data_ + offset_ + 2);
LOG_TRACE("vlan-tag=" << dump_vlan(vlan) << " " << *vlan
<< " next-ether-type=" << dump_ether_type(eType_));
++pf_->vlan_count_;
offset_ += sizeof *vlan;
return true;
}
bool ManualParserDataSink::Impl::decode_mpls() {
// See http://www.ietf.org/rfc/rfc3032.txt
const MplsEntry* mpls;
do {
if (offset_ + sizeof *mpls > packet_len_) {
LOG_DEBUG("ManualParser::decode: payload is too small to hold a MPLS tag,"
" packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
mpls = reinterpret_cast<const MplsEntry*>(packet_data_ + offset_);
LOG_TRACE("mpls(whole tag)=" << dump_mpls(mpls) << " " << *mpls);
// to record down the first label position
if (pf_->mpls_count_ == 0)
pf_->mpls_ptr_ = mpls;
++pf_->mpls_count_;
offset_ += sizeof *mpls;
} while (!mpls->is_bottom()); // loop until s bit(Bottom of Stack) is set to 1
return true;
}
bool ManualParserDataSink::Impl::decode_ipv4(bool is_parsing_upper) {
// See http://en.wikipedia.org/wiki/IPv4
if (offset_ + sizeof(IPv4Header) > packet_len_) {
if (is_parsing_upper) {
// Handle GTP Error Indicator 0x1a
if (const GTPv1Header* gtpv1_header = pf_->gtpv1_header()) {
if (gtpv1_header->message_type_ == 0x1a) {
return false;
}
}
if (const GTPv2Header* gtpv2_header = pf_->gtpv2_header()) {
if (gtpv2_header->message_type_ == 0x1a) {
return false;
}
}
}
LOG_DEBUG("ManualParser::decode: payload is too small to hold the IPv4 header, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
const IPv4Header* ipv4_header = reinterpret_cast<const IPv4Header*>(packet_data_ + offset_);
offset_ += sizeof *ipv4_header;
if (ipv4_header->ihl() > 5) {
if ((offset_ + (ipv4_header->ihl() - 5) * sizeof(uint32_t)) > packet_len_) {
LOG_DEBUG("ManualParser::decode: payload is too small to hold the IPv4 options, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
offset_ += (ipv4_header->ihl() - 5) * sizeof(uint32_t);
}
if (is_parsing_upper) {
upper_protocol_ = ipv4_header->protocol_;
helper_.set_upper_ipv4_header(pf_, ipv4_header);
pf_->upper_ipv4_options_.set_ipv4_header(ipv4_header);
} else {
protocol_ = ipv4_header->protocol_;
helper_.set_lower_ipv4_header(pf_, ipv4_header);
pf_->lower_ipv4_options_.set_ipv4_header(ipv4_header);
}
LOG_TRACE((is_parsing_upper ? "upper" : "lower") << " ipv4 src-ip=" << ipv4_header->src_ip_addr()
<< " dest-ip=" << ipv4_header->dest_ip_addr() << " protocol="
<< static_cast<unsigned int>(ipv4_header->protocol_));
return true;
}
bool ManualParserDataSink::Impl::decode_ipv6(bool is_parsing_upper) {
// See http://en.wikipedia.org/wiki/IPv6_packet
if (offset_ + sizeof(IPv6Header) > packet_len_) {
if (is_parsing_upper) {
// Handle GTP Error Indicator 0x1a
if (const GTPv1Header* gtpv1_header = pf_->gtpv1_header()) {
if (gtpv1_header->message_type_ == 0x1a) {
return false;
}
}
if (const GTPv2Header* gtpv2_header = pf_->gtpv2_header()) {
if (gtpv2_header->message_type_ == 0x1a) {
return false;
}
}
}
LOG_DEBUG("ManualParser::decode: payload is too small to hold the IPv6 header, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
const IPv6Header* ipv6_header = reinterpret_cast<const IPv6Header*>(packet_data_ + offset_);
IPv6ExtHeaders* ipv6_ext_headers = nullptr;
if (is_parsing_upper) {
helper_.set_upper_ipv6_header(pf_, ipv6_header);
ipv6_ext_headers = &pf_->upper_ipv6_ext_headers_;
ipv6_ext_headers->decode(packet_data_, packet_len_, offset_);
upper_protocol_ = ipv6_ext_headers->protocol();
} else {
helper_.set_lower_ipv6_header(pf_, ipv6_header);
ipv6_ext_headers = &pf_->lower_ipv6_ext_headers_;
ipv6_ext_headers->decode(packet_data_, packet_len_, offset_);
protocol_ = ipv6_ext_headers->protocol();
}
offset_ += sizeof *ipv6_header;
offset_ += ipv6_ext_headers->headers_length();
LOG_TRACE((is_parsing_upper ? "upper" : "lower") << " ipv6 src-ip=" << ipv6_header->source_addr()
<< " dest-ip=" << ipv6_header->dest_addr() << " protocol="
<< static_cast<unsigned int>(ipv6_ext_headers->protocol()));
return true;
}
bool ManualParserDataSink::Impl::decode_tcp(bool is_parsing_upper) {
// See http://en.wikipedia.org/wiki/Transmission_Control_Protocol
if (offset_ + sizeof(TCPHeader) > packet_len_) {
if (is_parsing_upper) {
// Handle GTP Error Indicator 0x1a
if (const GTPv1Header* gtpv1_header = pf_->gtpv1_header()) {
if (gtpv1_header->message_type_ == 0x1a) {
return false;
}
}
if (const GTPv2Header* gtpv2_header = pf_->gtpv2_header()) {
if (gtpv2_header->message_type_ == 0x1a) {
return false;
}
}
}
LOG_DEBUG("ManualParser::decode: payload is too small to hold the TCP header, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
const TCPHeader* tcp_header = reinterpret_cast<const TCPHeader*>(packet_data_ + offset_);
offset_ += sizeof *tcp_header;
TCPOptions* tcp_options = nullptr;
if (is_parsing_upper) {
helper_.set_upper_tcp_header(pf_, tcp_header);
tcp_options = &pf_->upper_tcp_options_;
} else {
helper_.set_lower_tcp_header(pf_, tcp_header);
tcp_options = &pf_->lower_tcp_options_;
}
tcp_options->set_tcp_header(tcp_header);
tcp_options->set_packet(packet_data_, packet_len_);
LOG_TRACE((is_parsing_upper ? "upper" : "lower") << " tcp src-port="
<< tcp_header->source_port() << " dest-port=" << tcp_header->dest_port());
return true;
}
bool ManualParserDataSink::Impl::decode_udp(bool is_parsing_upper) {
// See http://en.wikipedia.org/wiki/User_Datagram_Protocol
if (offset_ + sizeof(UDPHeader) > packet_len_) {
if (is_parsing_upper) {
// Handle GTP Error Indicator 0x1a
if (const GTPv1Header* gtpv1_header = pf_->gtpv1_header()) {
if (gtpv1_header->message_type_ == 0x1a) {
return false;
}
}
if (const GTPv2Header* gtpv2_header = pf_->gtpv2_header()) {
if (gtpv2_header->message_type_ == 0x1a) {
return false;
}
}
}
LOG_DEBUG("ManualParser::decode: payload is too small to hold the UDP header,"
" packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
const UDPHeader* udp_header = reinterpret_cast<const UDPHeader*>(packet_data_ + offset_);
offset_ += sizeof *udp_header;
if (is_parsing_upper) {
helper_.set_upper_udp_header(pf_, udp_header);
} else {
helper_.set_lower_udp_header(pf_, udp_header);
}
LOG_TRACE((is_parsing_upper ? "upper" : "lower") << " udp src-port=" << udp_header->source_port()
<< " dest-port=" << udp_header->dest_port() << " payload-length=" << udp_header->length());
if (!is_parsing_upper) {
if (pf_->is_gtp_u_packet()) {
if (telemetry_enabled_) ++telemetry_.up_frames;
if (!decode_gtp_user()) {
return false;
}
} else if (pf_->is_gtp_c_packet()) {
if (telemetry_enabled_) ++telemetry_.cp_frames;
if (!decode_gtp_control()) {
return false;
}
}
}
return true;
}
bool ManualParserDataSink::Impl::decode_sctp(bool is_parsing_upper) {
// See http://en.wikipedia.org/wiki/SCTP_packet_structure
if (offset_ + sizeof(SCTPHeader) > packet_len_) {
LOG_DEBUG("ManualParser::decode: payload is too small to hold the SCTP header, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
const SCTPHeader* sctp_header = reinterpret_cast<const SCTPHeader*>(packet_data_ + offset_);
offset_ += sizeof *sctp_header;
if (is_parsing_upper) {
helper_.set_upper_sctp_header(pf_, sctp_header);
} else {
helper_.set_lower_sctp_header(pf_, sctp_header);
}
#if 0
// below code has problem , deadloop sometimes.
uint8_t& sctp_chunks_count = is_parsing_upper ? pf_->upper_.sctp_chunks_count_
: pf_->sctp_chunks_count_;
const SCTPChunk** sctp_chunks = is_parsing_upper ? pf_->upper_.sctp_chunks_
: pf_->sctp_chunks_;
while (offset_ + sizeof(SCTPChunk) < packet_len_) {
const SCTPChunk* chunk = reinterpret_cast<const SCTPChunk*>(packet_data_ + offset_);
uint16_t length = chunk->length();
if (length == 0) {
LOG_DEBUG("ManualParser::decode: SCTP chunk has zero length");
break;
}
if (sctp_chunks_count < ParsedFrame::MAX_SCTP_CHUNKS) {
sctp_chunks[sctp_chunks_count++] = chunk;
}
uint16_t remainder = length % 4;
if (remainder) {
length += 4 - remainder;
}
offset_ += length;
if (!length) {
break;
}
}
#endif
LOG_TRACE((is_parsing_upper ? "upper" : "lower") << " sctp src-port=" << sctp_header->source_port()
<< " dest-port=" << sctp_header->dest_port());
return true;
}
bool ManualParserDataSink::Impl::decode_gtp_control() {
// See http://en.wikipedia.org/wiki/GPRS_Tunnelling_Protocol
if (offset_ + 8 > packet_len_) {
LOG_DEBUG("ManualParser::decode: payload is too small to hold the GTP-C header, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
const GTPv1Header* gtp1 = reinterpret_cast<const GTPv1Header*>(packet_data_ + offset_);
if (gtp1->version() == 0x01) {
if (!decode_gtpv1_header()) {
return false;
}
LOG_TRACE("GTPv1-C message-type=" << static_cast<int>(gtp1->message_type_));
// Handle GTP Error Indicator 0x1a
if (const GTPv1Header* gtpv1_header = pf_->gtpv1_header()) {
if (gtpv1_header->message_type_ == 0x1a) {
return true;
}
}
} else {
const GTPv2Header* gtpv2_header = reinterpret_cast<const GTPv2Header*>(packet_data_ + offset_);
helper_.set_gtpv2_header(pf_, gtpv2_header);
if (gtpv2_header->t_flag()) {
offset_ += 12;
} else {
offset_ += 8;
}
LOG_TRACE("GTPv2-C message-type=" << static_cast<int>(gtpv2_header->message_type_));
// Handle GTP Error Indicator 0x1a
if (gtpv2_header->message_type_ == 0x1a) {
return true;
}
}
return true;
}
bool ManualParserDataSink::Impl::decode_gtp_user() {
// See http://en.wikipedia.org/wiki/GPRS_Tunnelling_Protocol
if (offset_ + 8 > packet_len_) {
LOG_DEBUG("ManualParser::decode: payload is too small to hold the GTP-U header, "
"packet={ " << hex_dump(packet_data_, packet_len_) << " }");
return false;
}
if (!decode_gtpv1_header()) {
return false;
}
// Handle GTP Error Indicator 0x1a
if (const GTPv1Header* gtpv1_header = pf_->gtpv1_header()) {
if (gtpv1_header->message_type_ == 0x1a) {
return true;
}
}
// To confirm that decode_tunnelled_ip() only modifies the data members of parsed_frame->upper_,
// prints the pointers to the lower ip, etc before and after.
LOG_TRACE("GTP-U packet, lower-ipv4-header=" << pf_->lower_ipv4_header()
<< " lower-ipv6-header=" << pf_->lower_ipv6_header()
<< " lower-tcp-header=" << pf_->lower_tcp_header()
<< " lower-udp-header=" << pf_->lower_udp_header()
<< " lower-sctp-header=" << pf_->lower_sctp_header() << " message-type="
<< static_cast<int>(pf_->gtpv1_header()->message_type_));
static const std::string gtpu_str("GTP-U");
if (!decode_tunnelled_ip(gtpu_str)) {
return false;
}
LOG_TRACE("GTP-U packet, lower-ipv4-header=" << pf_->lower_ipv4_header()
<< " lower-ipv6-header=" << pf_->lower_ipv6_header()
<< " lower-tcp-header=" << pf_->lower_tcp_header()
<< " lower-udp-header=" << pf_->lower_udp_header()
<< " lower-sctp-header=" << pf_->lower_sctp_header()
<< " upper-ipv4-header=" << pf_->upper_ipv4_header()
<< " upper-ipv6-header=" << pf_->upper_ipv6_header()
<< " upper-tcp-header=" << pf_->upper_tcp_header()
<< " upper-udp-header=" << pf_->upper_udp_header()
<< " upper-sctp-header=" << pf_->upper_sctp_header());
return true;
}
bool ManualParserDataSink::Impl::decode_gtpv1_header() {
// See http://en.wikipedia.org/wiki/GPRS_Tunnelling_Protocol
// See 3GPP TS 29.281 V10.1.0 (2011-03)
const GTPv1Header* gtp1 = reinterpret_cast<const GTPv1Header*>(packet_data_ + offset_);
helper_.set_gtpv1_header(pf_, gtp1);
if (!(gtp1->e_flag() || gtp1->s_flag() || gtp1->pn_flag())) {
offset_ += 8;
} else {
if (offset_ + 12 > packet_len_) {
return false;
}
offset_ += 12;
if (gtp1->e_flag()) {
while (packet_data_[offset_ - 1]) {
uint8_t n = packet_data_[offset_];
if (n == 0) {
LOG_DEBUG("ManualParser::decode: GTPv1 extension header has zero length");
return false;
}
offset_ += 4 * n;
if (offset_ > packet_len_) {
return false;
}
}
}
}
return true;
}
bool ManualParserDataSink::Impl::decode_tunnelled_ip(const std::string& tunnel_protocol_name) {
const IPv4Header* ip4 = reinterpret_cast<const IPv4Header*>(packet_data_ + offset_);
if (ip4->version() == 4) {
if (telemetry_enabled_) ++telemetry_.upper_ipv4;
if (!decode_ipv4(true)) {
return false;
}
} else if (ip4->version() == 6) {
if (telemetry_enabled_) ++telemetry_.upper_ipv6;
if (!decode_ipv6(true)) {
return false;
}
} else {
if (telemetry_enabled_) ++telemetry_.upper_non_ip;
LOG_TRACE(tunnel_protocol_name << " packet not embedding IPv4 or IPv6");
return false;
}
if (telemetry_enabled_) ++telemetry_.upper_protocols[upper_protocol_];
if (const IPv4Header* ipv4 = pf_->upper_ipv4_header()) {
if (ipv4->offset()) {
// When IP fragments, only the first fragment contains the transport protocol header,
// the other fragments (non-zero offset) cannot be decoded.
++telemetry_.upper_protocols_ipv4_frags[upper_protocol_];
return true;
}
} else if (const IPv6ExtHeaders* headers = pf_->upper_ipv6_ext_headers()) {
if (headers->fragment_present()) {
IPv6FragmentHeader f = headers->fragment_header();
if (f.fragment_offset()) {
// When IP fragments, only the first fragment contains the transport protocol
// header, the other fragments (non-zero offset) cannot be decoded.
++telemetry_.upper_protocols_ipv6_frags[upper_protocol_];
return true;
}
}
}
if (upper_protocol_ == UDP_PROTOCOL) {
if (!decode_udp(true))
return false;
} else if (upper_protocol_ == TCP_PROTOCOL) {
if (!decode_tcp(true))
return false;
} else if (upper_protocol_ == SCTP_PROTOCOL) {
if (!decode_sctp(true))
return false;
} else {
LOG_TRACE(tunnel_protocol_name << " packet not embedding TCP, UDP, or SCTP");
}
return true;
}
void ManualParserDataSink::Telemetry::dump() const {
std::ostringstream s;
s << "frames=" << frames << " vlan=" << vlan << " mpls=" << mpls
<< " ipv4=" << lower_ipv4 << " ipv6=" << lower_ipv6
<< " arp=" << arp << " rarp=" << rarp << " other-etypes=" << other_etypes;
for (size_t i = 0; i < 0x8F; ++i) {
if (lower_protocols[i] == 0) {
continue;
}
if (g_protocol_names[i] == 0) {
s << " P=" << i;
} else {
s << " " << g_protocol_names[i];
}
s << ":" << lower_protocols[i];
}
s << " ipv4-frags ";
for (size_t i = 0; i < 0x8F; ++i) {
if (lower_protocols_ipv4_frags[i] == 0) {
continue;
}
if (g_protocol_names[i] == 0) {
s << " P=" << i;
} else {
s << " " << g_protocol_names[i];
}
s << ":" << lower_protocols_ipv4_frags[i];
}
s << " ipv6-frags ";
for (size_t i = 0; i < 0x8F; ++i) {
if (lower_protocols_ipv6_frags[i] == 0) {
continue;
}
if (g_protocol_names[i] == 0) {
s << " P=" << i;
} else {
s << " " << g_protocol_names[i];
}
s << ":" << lower_protocols_ipv6_frags[i];
}
s << " cp=" << cp_frames << " up=" << up_frames;
s << " upper-ipv4=" << upper_ipv4 << " upper-ipv6=" << upper_ipv6
<< " upper-non-ip=" << upper_non_ip;
for (size_t i = 0; i < 0x8F; ++i) {
if (upper_protocols[i] == 0) {
continue;
}
if (g_protocol_names[i] == 0) {
s << " P=" << i;
} else {
s << " " << g_protocol_names[i];
}
s << ":" << upper_protocols[i];
}
LOG4CXX_INFO(g_telemetry_logger, s.str())
}
ManualParserDataSink::ManualParserDataSink(iwf *manager)
: IDataSink(MANUAL_PARSING_DATA_SINK_TYPE)
, impl_(new Impl(manager)) {
}
ManualParserDataSink::~ManualParserDataSink() {
delete impl_;
}
void ManualParserDataSink::process(const Event* event) {
if (impl_->drop_before_manual_parser_ && event->type() == kEVENT_FRAME) {
delete event;
return;
}
impl_->decode(const_cast<Event*>(event));
if (data_sink_) {
data_sink_->process(event);
}
}
} // namespace iwf
} // namespace xtreme
| 37.560076 | 105 | 0.589003 | jia57196 |
aad5874acdd66e9037de46edf6f39957d593bd74 | 4,776 | cpp | C++ | src/system_model/system_model.cpp | ibrahimkakbar/ros-system_model | 0bf91e6bf2f6208d260319543b6407be3a48c217 | [
"MIT"
] | null | null | null | src/system_model/system_model.cpp | ibrahimkakbar/ros-system_model | 0bf91e6bf2f6208d260319543b6407be3a48c217 | [
"MIT"
] | null | null | null | src/system_model/system_model.cpp | ibrahimkakbar/ros-system_model | 0bf91e6bf2f6208d260319543b6407be3a48c217 | [
"MIT"
] | null | null | null | #include "system_model/system_model.hpp"
#include <system_model_msgs/variable.h>
#include <ros/console.h>
#include <ros/names.h>
#include <dlfcn.h>
using namespace system_model;
// CONSTRUCTORS
system_model_t::system_model_t(uint32_t n_variables, uint32_t n_observers)
: ukf_t(n_variables, n_observers)
{
// Initialize ROS node handle.
system_model_t::m_node = std::make_unique<ros::NodeHandle>();
// Read parameters.
ros::NodeHandle private_node("~");
// Set up default variable names.
system_model_t::m_variable_names.reserve(n_variables);
for(uint32_t i = 0; i < n_variables; ++i)
{
system_model_t::m_variable_names.push_back(std::to_string(i));
}
// Reserve space for state publishers.
system_model_t::m_state_publishers.reserve(n_variables);
// Set initial delta time.
system_model_t::m_dt = 0;
}
std::shared_ptr<system_model_t> system_model_t::load_plugin(const std::string& plugin_path)
{
// Check that path was provided (dl gets handle to program if empty)
if(plugin_path.empty())
{
ROS_ERROR("attempted to load plugin with empty path");
return nullptr;
}
// Open plugin shared object library.
void* so_handle = dlopen(plugin_path.c_str(), RTLD_NOW);
if(!so_handle)
{
ROS_ERROR_STREAM("failed to load model plugin (" << dlerror() << ")");
return nullptr;
}
// Get a reference to the instantiate symbol.
typedef system_model_t* (*instantiate_t)();
instantiate_t instantiate = reinterpret_cast<instantiate_t>(dlsym(so_handle, "instantiate"));
if(!instantiate)
{
ROS_ERROR_STREAM("failed to load model plugin (" << dlerror() << ")");
dlclose(so_handle);
return nullptr;
}
// Try to instantiate the plugin.
system_model_t* plugin = nullptr;
try
{
plugin = instantiate();
}
catch(const std::exception& error)
{
ROS_ERROR_STREAM("failed to instantiate model plugin (" << error.what() << ")");
dlclose(so_handle);
return nullptr;
}
// Return the plugin as a shared ptr with a custom deleter.
return std::shared_ptr<system_model_t>(plugin,
[so_handle](system_model_t* plugin){delete plugin; dlclose(so_handle);});
}
// METHODS
void system_model_t::set_variable_name(uint32_t index, const std::string& name)
{
// Check if index is valid.
if(!(index < system_model_t::m_variable_names.size()))
{
ROS_ERROR_STREAM("failed to set variable name (variable index " << index << " does not exist)");
return;
}
// Check if name is valid as a ROS graph resource name.
std::string error;
if(!ros::names::validate(name, error))
{
ROS_ERROR_STREAM("failed to set variable name (variable name is invalid: " << error << ")");
return;
}
// Update variable name.
system_model_t::m_variable_names.at(index) = name;
}
void system_model_t::run()
{
// Bring up state publishers.
ros::NodeHandle private_node("~");
for(uint32_t i = 0; i < system_model_t::n_variables(); ++i)
{
// Set up topic name.
std::string topic_name = ros::names::remap(ros::names::append("state", system_model_t::m_variable_names.at(i)));
// Publish topic.
system_model_t::m_state_publishers.push_back(private_node.advertise<system_model_msgs::variable>(topic_name, 10));
}
// Set up the loop rate timer.
double_t p_loop_rate = private_node.param<double_t>("loop_rate", 100);
ros::Rate loop(p_loop_rate);
// Initialize dt calculation.
ros::Time update_timestamp = ros::Time::now();
ros::Time current_timestamp;
// Loop while ROS ok.
while(ros::ok())
{
// Get current time and dt.
current_timestamp = ros::Time::now();
system_model_t::m_dt = (current_timestamp - update_timestamp).toSec();
update_timestamp = current_timestamp;
// Run callbacks to process observations.
ros::spinOnce();
// Run iteration.
system_model_t::iterate();
// Publish current state.
auto& state = system_model_t::state();
auto& covariance = system_model_t::covariance();
for(uint32_t i = 0; i < state.size(); ++i)
{
system_model_msgs::variable message;
message.value = state(i);
message.variance = covariance(i,i);
system_model_t::m_state_publishers.at(i).publish(message);
}
// Sleep for remaining loop time.
loop.sleep();
}
// Shutdown publishers.
system_model_t::m_state_publishers.clear();
}
double_t system_model_t::dt() const
{
return system_model_t::m_dt;
}
| 30.420382 | 122 | 0.639866 | ibrahimkakbar |
aad5fd8e304fb6426b06815722533ea84cee1950 | 2,479 | cpp | C++ | Software/LautIO/src/driver/amp.cpp | olell/LautIO | 3f3d597898e63726776e36444001607660b2d9c7 | [
"MIT"
] | 3 | 2021-04-19T16:21:47.000Z | 2021-07-09T18:26:39.000Z | Software/LautIO/src/driver/amp.cpp | olell/LautIO | 3f3d597898e63726776e36444001607660b2d9c7 | [
"MIT"
] | 8 | 2021-03-16T20:57:51.000Z | 2021-07-15T21:37:17.000Z | Software/LautIO/src/driver/amp.cpp | olell/LautIO | 3f3d597898e63726776e36444001607660b2d9c7 | [
"MIT"
] | null | null | null | /*
*
* This file is part of LautIO
*
* Copyright 2021 - olel
* LautIO is licensed under MIT License
* See LICENSE file for more information
*
*/
#include "stdint.h"
#include "Arduino.h"
#include "sys_config.h"
#include "util/log.h"
#include "driver/amp.h"
bool amp_ab_reset_state = 0;
bool amp_cd_reset_state = 0;
void init_amps() {
/*
This method initialises all amplifier pins and puts all amps in reset state.
*/
log_info("Initing Amplifiers");
// Pin Modes
pinMode(AMP_AB_OTW, INPUT);
pinMode(AMP_AB_FAULT, INPUT);
pinMode(AMP_AB_RESET, OUTPUT);
pinMode(AMP_CD_OTW, INPUT);
pinMode(AMP_CD_FAULT, INPUT);
pinMode(AMP_CD_RESET, OUTPUT);
log_debug("Amp AB OTW: %s", get_amp_otw_state(AMP_AB) ? "Yes" : "No");
log_debug("Amp AB Fault: %s", get_amp_fault_state(AMP_AB) ? "Yes" : "No");
log_debug("Amp CD OTW: %s", get_amp_otw_state(AMP_CD) ? "Yes" : "No");
log_debug("Amp CD Fault: %s", get_amp_fault_state(AMP_CD) ? "Yes" : "No");
// Put both amps in reset state
amp_set_reset_state(AMP_AB, 1);
amp_set_reset_state(AMP_CD, 1);
}
void amp_set_reset_state(uint8_t amp, uint8_t state) {
/*
This method puts an amp in the given reset state:
state 1: reset state
state 0: running
*/
if (amp == AMP_AB) {
log_debug("Putting Ch. A + B Amp in reset state %d", state);
digitalWrite(AMP_AB_RESET, 1 - state);
amp_ab_reset_state = state;
}
else if (amp == AMP_CD) {
log_debug("Putting Ch. C + D Amp in reset state %d", state);
digitalWrite(AMP_CD_RESET, 1 - state);
amp_cd_reset_state = state;
}
}
void reset_amp(uint8_t amp) {
/*
This method pulses the reset state (e.g. to reset after a fault condition is solved)
*/
amp_set_reset_state(amp, 1);
delay(50);
amp_set_reset_state(amp, 0);
}
bool get_amp_reset_state(uint8_t amp) {
// Get reset state of amp
if (amp == AMP_AB) return amp_ab_reset_state;
else return amp_cd_reset_state;
}
bool get_amp_otw_state(uint8_t amp) {
// Get Clipping / Over Temp Warning state
if (amp == AMP_AB) {
return digitalRead(AMP_AB_OTW) == 0;
}
else {
return digitalRead(AMP_CD_OTW) == 0;
}
}
bool get_amp_fault_state(uint8_t amp) {
// Get Fault state
if (amp == AMP_AB) {
return digitalRead(AMP_AB_FAULT) == 0;
}
else {
return digitalRead(AMP_CD_FAULT) == 0;
}
} | 24.303922 | 88 | 0.638161 | olell |
aad807720f53c483f3f535c63dab83810cdc2e2c | 644 | cpp | C++ | API/source/src/WektorC.cpp | HPytkiewicz/DronPodwodny | b63feaca2abb268ef0ab6e831bed663608fadcbb | [
"MIT"
] | null | null | null | API/source/src/WektorC.cpp | HPytkiewicz/DronPodwodny | b63feaca2abb268ef0ab6e831bed663608fadcbb | [
"MIT"
] | null | null | null | API/source/src/WektorC.cpp | HPytkiewicz/DronPodwodny | b63feaca2abb268ef0ab6e831bed663608fadcbb | [
"MIT"
] | null | null | null | #include "Wektor.cpp"
#include <iostream>
#include <iomanip>
template class Wektor<double, 2>;
template Wektor<double,2> operator *(double a, const Wektor<double,2> &Wektor2);
template std::ostream & operator <<(std::ostream &Strm, const Wektor<double, 2> &wektor);
template std::istream & operator >>(std::istream &Strm, Wektor<double, 2> &wektor);
template class Wektor<double, 3>;
template Wektor<double,3> operator *(double a, const Wektor<double,3> &Wektor2);
template std::ostream & operator <<(std::ostream &Strm, const Wektor<double, 3> &wektor);
template std::istream & operator >>(std::istream &Strm, Wektor<double, 3> &wektor);
| 37.882353 | 89 | 0.72205 | HPytkiewicz |
aadbe9c297dcf14b54d8ec30efc511e5f34e7c1c | 3,097 | cpp | C++ | TestConditionCode.cpp | andkrau/nuance | 32b9d6b9257c6c51944727456fce2e7caf074182 | [
"W3C"
] | null | null | null | TestConditionCode.cpp | andkrau/nuance | 32b9d6b9257c6c51944727456fce2e7caf074182 | [
"W3C"
] | null | null | null | TestConditionCode.cpp | andkrau/nuance | 32b9d6b9257c6c51944727456fce2e7caf074182 | [
"W3C"
] | null | null | null | #include "mpe.h"
bool MPE::TestConditionCode(const uint32 whichCondition) const
{
//This sequencing is correct for 32/64 bit ECU instructions. The decode
//handler for 16/48 bit ECU instructions converts the extracted condition
//to this sequence. VMLabs must die. Mission accomplished!
switch(whichCondition & 0x1FUL)
{
case 0:
//ne
return (tempCC & CC_ALU_ZERO) == 0;
case 1:
//c0z
return (tempCC & CC_COUNTER0_ZERO);
case 2:
//c1z
return (tempCC & CC_COUNTER1_ZERO);
case 3:
//cc
return (tempCC & CC_ALU_CARRY) == 0;
case 4:
//eq
return (tempCC & CC_ALU_ZERO);
case 5:
//cs
return (tempCC & CC_ALU_CARRY);
case 6:
//vc
return (tempCC & CC_ALU_OVERFLOW) == 0;
case 7:
//vs
return (tempCC & CC_ALU_OVERFLOW);
case 8:
//lt
return ((tempCC & (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW)) == CC_ALU_NEGATIVE) ||
((tempCC & (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW)) == CC_ALU_OVERFLOW);
case 9:
//mvc
return (tempCC & CC_MUL_OVERFLOW) == 0;
case 10:
//mvs
return (tempCC & CC_MUL_OVERFLOW);
case 11:
//hi
return (tempCC & (CC_ALU_CARRY | CC_ALU_ZERO)) == 0;
case 12:
//le
return (tempCC & CC_ALU_ZERO) || ((tempCC & (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW)) == CC_ALU_NEGATIVE) ||
((tempCC & (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW)) == CC_ALU_OVERFLOW);
case 13:
//ls
return (tempCC & (CC_ALU_CARRY | CC_ALU_ZERO));
case 14:
//pl
return (tempCC & CC_ALU_NEGATIVE) == 0;
case 15:
//mi
return (tempCC & CC_ALU_NEGATIVE);
case 16:
//gt
return ((tempCC & (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW | CC_ALU_ZERO)) == (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW)) ||
((tempCC & (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW | CC_ALU_ZERO)) == 0);
case 17:
//always
return true;
case 18:
//modmi
return (tempCC & CC_MODMI);
case 19:
//modpl
return (tempCC & CC_MODMI) == 0;
case 20:
//ge
return ((tempCC & (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW)) == (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW)) ||
((tempCC & (CC_ALU_NEGATIVE | CC_ALU_OVERFLOW)) == 0);
case 21:
//modge
return (tempCC & CC_MODGE);
case 22:
//modlt
return (tempCC & CC_MODGE) == 0;
case 23:
//never
return false;
case 24:
//c0ne
return (tempCC & CC_COUNTER0_ZERO) == 0;
case 25:
//never
return false;
case 26:
//never
return false;
case 27:
//cf0lo
return (tempCC & CC_COPROCESSOR0) == 0;
case 28:
//c1ne
return (tempCC & CC_COUNTER1_ZERO) == 0;
case 29:
//cf0hi
return (tempCC & CC_COPROCESSOR0);
case 30:
//cf1lo
return (tempCC & CC_COPROCESSOR1) == 0;
case 31:
//cf1hi
return (tempCC & CC_COPROCESSOR1);
}
return false;
}
| 26.930435 | 118 | 0.55247 | andkrau |
aadf7e152155b081274583b31025f99ca823fb6e | 5,510 | cpp | C++ | src/UI/SettingsDlg.cpp | ShiraNai7/rstpad | 754e6b34229585946c9238350ca1d94f17ea2678 | [
"MIT"
] | 44 | 2017-02-13T18:56:55.000Z | 2021-12-28T09:45:09.000Z | src/UI/SettingsDlg.cpp | ShiraNai7/rstpad | 754e6b34229585946c9238350ca1d94f17ea2678 | [
"MIT"
] | 2 | 2017-08-01T22:56:58.000Z | 2019-07-15T21:28:29.000Z | src/UI/SettingsDlg.cpp | ShiraNai7/rstpad | 754e6b34229585946c9238350ca1d94f17ea2678 | [
"MIT"
] | 8 | 2017-10-31T15:08:01.000Z | 2022-02-24T05:05:19.000Z | #include "SettingsDlg.h"
#include "ui_SettingsDlg.h"
#include "../App.h"
#include <Qt>
#include <QLineEdit>
#include <QTextOption>
#include <QCheckBox>
#include <QComboBox>
namespace RstPad {
SettingsDlg::SettingsDlg(QWidget *parent) :
QDialog(parent),
ui(new Ui::SettingsDlg)
{
ui->setupUi(this);
setWindowFlags((windowFlags() & ~Qt::WindowContextHelpButtonHint) | Qt::MSWindowsFixedSizeDialogHint);
setFixedSize(size());
ui->Orientation->addItem(tr("Horizontal"), static_cast<int>(EditorOrientation::Horizontal));
ui->Orientation->addItem(tr("Vertical"), static_cast<int>(EditorOrientation::Vertical));
ui->AutoscrollMode->addItem(tr("First visible line"), static_cast<int>(AutoscrollMode::FirstLine));
ui->AutoscrollMode->addItem(tr("Current line (cursor)"), static_cast<int>(AutoscrollMode::CurrentLine));
ui->AutoscrollMode->addItem(tr("Disabled"), static_cast<int>(AutoscrollMode::Disabled));
ui->WordWrapMode->addItem(tr("No wrap"), static_cast<int>(QTextOption::NoWrap));
ui->WordWrapMode->addItem(tr("Word wrap"), static_cast<int>(QTextOption::WordWrap));
ui->WordWrapMode->addItem(tr("Wrap anywhere"), static_cast<int>(QTextOption::WrapAnywhere));
ui->WordWrapMode->addItem(tr("Wrap anywhere but prefer word boundary"), static_cast<int>(QTextOption::WrapAtWordBoundaryOrAnywhere));
ui->Headings->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
ui->Headings->verticalHeader()->setSectionResizeMode(QHeaderView::Fixed);
}
SettingsDlg::~SettingsDlg()
{
delete ui;
}
void SettingsDlg::showEvent(QShowEvent * e)
{
QDialog::showEvent(e);
updateWidgets(APP->config()->all());
}
void SettingsDlg::updateWidgets(const QVariantMap &config)
{
ui->Orientation->setCurrentIndex(ui->Orientation->findData(config["orientation"]));
ui->AutoscrollMode->setCurrentIndex(ui->AutoscrollMode->findData(config["autoscrollMode"]));
ui->AutoscrollWaitDelay->setValue(config["autoscrollWaitDelay"].toInt());
ui->RstRendererDelay->setValue(config["rstRendererDelay"].toInt());
ui->PreviewZoomFactor->setValue(config["previewZoomFactor"].toDouble());
ui->WordWrapMode->setCurrentIndex(ui->WordWrapMode->findData(config["wordWrapMode"]));
ui->FontSize->setValue(config["fontSize"].toInt());
ui->SearchWrapAround->setChecked(config["searchWrapAround"].toBool());
ui->IndentSize->setValue(config["indentSize"].toInt());
ui->EnsureSingleEmptyLineAtEndOnSave->setChecked(config["ensureSingleEmptyLineAtEndOnSave"].toBool());
ui->TrimTrailingWhitespaceOnSave->setChecked(config["trimTrailingWhitespaceOnSave"].toBool());
ui->HrSymbol->setText(config["hrSymbol"].toString());
ui->HrWidth->setValue(config["hrWidth"].toInt());
for (int i = 1; i <= 6; ++i) {
auto row = i - 1;
auto symbolWidget = new QLineEdit();
symbolWidget->setMaxLength(1);
symbolWidget->setText(config.value(QString("headingSymbol%1").arg(i)).toString());
auto overlineWidget = new QCheckBox();
overlineWidget->setChecked(config.value(QString("headingOverline%1").arg(i)).toBool());
ui->Headings->setCellWidget(row, 0, symbolWidget);
ui->Headings->setCellWidget(row, 1, overlineWidget);
}
}
void SettingsDlg::updateConfig(Config &config)
{
QVariantMap values;
values.insert("orientation", ui->Orientation->currentData());
values.insert("autoscrollMode", ui->AutoscrollMode->currentData());
values.insert("autoscrollWaitDelay", ui->AutoscrollWaitDelay->value());
values.insert("rstRendererDelay", ui->RstRendererDelay->value());
values.insert("previewZoomFactor", ui->PreviewZoomFactor->value());
values.insert("wordWrapMode", ui->WordWrapMode->currentData());
values.insert("fontSize", ui->FontSize->value());
values.insert("searchWrapAround", ui->SearchWrapAround->isChecked());
values.insert("indentSize", ui->IndentSize->value());
values.insert("ensureSingleEmptyLineAtEndOnSave", ui->EnsureSingleEmptyLineAtEndOnSave->isChecked());
values.insert("trimTrailingWhitespaceOnSave", ui->TrimTrailingWhitespaceOnSave->isChecked());
values.insert("hrSymbol", ui->HrSymbol->text());
values.insert("hrWidth", ui->HrWidth->text());
for (int i = 1; i <= 6; ++i) {
auto row = i - 1;
values.insert(QString("headingSymbol%1").arg(i), static_cast<QLineEdit*>(ui->Headings->cellWidget(row, 0))->text());
values.insert(QString("headingOverline%1").arg(i), static_cast<QCheckBox*>(ui->Headings->cellWidget(row, 1))->isChecked());
}
config.set(values);
}
}
void RstPad::SettingsDlg::on_ButtonBox_clicked(QAbstractButton *button)
{
auto buttonGroup = qobject_cast<QDialogButtonBox*>(sender());
switch (buttonGroup->standardButton(button)) {
case QDialogButtonBox::RestoreDefaults:
updateWidgets(APP->config()->defaultValues());
break;
case QDialogButtonBox::Save:
updateConfig(*APP->config());
break;
default:
break;
}
}
| 43.730159 | 142 | 0.647731 | ShiraNai7 |
aae0cb37ec13ed23db0eda82896fe2487f52025a | 508 | cpp | C++ | honours_project/main.cpp | alexbarker/soc10101_honours_project | c29c10f0e5d7bed50819c948f841dd97e7d68809 | [
"MIT"
] | null | null | null | honours_project/main.cpp | alexbarker/soc10101_honours_project | c29c10f0e5d7bed50819c948f841dd97e7d68809 | [
"MIT"
] | null | null | null | honours_project/main.cpp | alexbarker/soc10101_honours_project | c29c10f0e5d7bed50819c948f841dd97e7d68809 | [
"MIT"
] | null | null | null | #include "engine.h"
#include "app.h"
#include "scenes/scene_splash.h"
#include <SFML/Audio.hpp>
// SOC10101 - Honours Project (40 Credits)
// Snake Prototype 3
// Version 0.x.x
// Alexander Barker
// 40333139
// Last Updated on 19th March 2019
// main.cpp - This file is used to start the engine with predefined size and name.
using namespace std;
SplashScene splash;
MenuScene menu;
SettingsScene settings;
TutorialScene tutorial;
int main() {
Engine::Start(1504, 846, "Honours Project", &splash);
}
| 20.32 | 82 | 0.730315 | alexbarker |
aae28e821c18fa9345b0ea45a42436cc109d76cf | 3,517 | cpp | C++ | tests/array/test_array_single_index_operator.cpp | BenKoehler/ndcontainer | 07cda63f8193425d4e6654eb72fd003a55ebf434 | [
"MIT"
] | null | null | null | tests/array/test_array_single_index_operator.cpp | BenKoehler/ndcontainer | 07cda63f8193425d4e6654eb72fd003a55ebf434 | [
"MIT"
] | null | null | null | tests/array/test_array_single_index_operator.cpp | BenKoehler/ndcontainer | 07cda63f8193425d4e6654eb72fd003a55ebf434 | [
"MIT"
] | null | null | null | /*
* MIT License
*
* Copyright (c) 2018-2020 Benjamin Köhler
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include "common.h"
#include "nd/array.h"
TEST(nd_array, single_index_operator)
{
{
constexpr nd::array<int, 3, 2, 1> a{0, 1, 2, 3, 4, 5};
for (std::size_t i = 0; i < a.num_values(); ++i)
{ EXPECT_EQ(a[i], i); }
}
{
constexpr nd::array<int, 5, 3, 1> a{4, 5, 3, 7, 8, 4, 7, 8, 4, 3, 5, 7, 2, 1, 4};
EXPECT_EQ(a[0], 4);
EXPECT_EQ(a[0], a.at_list<0>());
EXPECT_EQ(a[0], a.at_list(0));
EXPECT_EQ(a[1], 5);
EXPECT_EQ(a[1], a.at_list<1>());
EXPECT_EQ(a[1], a.at_list(1));
EXPECT_EQ(a[2], 3);
EXPECT_EQ(a[2], a.at_list<2>());
EXPECT_EQ(a[2], a.at_list(2));
EXPECT_EQ(a[3], 7);
EXPECT_EQ(a[3], a.at_list<3>());
EXPECT_EQ(a[3], a.at_list(3));
EXPECT_EQ(a[4], 8);
EXPECT_EQ(a[4], a.at_list<4>());
EXPECT_EQ(a[4], a.at_list(4));
EXPECT_EQ(a[5], 4);
EXPECT_EQ(a[5], a.at_list<5>());
EXPECT_EQ(a[5], a.at_list(5));
EXPECT_EQ(a[6], 7);
EXPECT_EQ(a[6], a.at_list<6>());
EXPECT_EQ(a[6], a.at_list(6));
EXPECT_EQ(a[7], 8);
EXPECT_EQ(a[7], a.at_list<7>());
EXPECT_EQ(a[7], a.at_list(7));
EXPECT_EQ(a[8], 4);
EXPECT_EQ(a[8], a.at_list<8>());
EXPECT_EQ(a[8], a.at_list(8));
EXPECT_EQ(a[9], 3);
EXPECT_EQ(a[9], a.at_list<9>());
EXPECT_EQ(a[9], a.at_list(9));
EXPECT_EQ(a[10], 5);
EXPECT_EQ(a[10], a.at_list<10>());
EXPECT_EQ(a[10], a.at_list(10));
EXPECT_EQ(a[11], 7);
EXPECT_EQ(a[11], a.at_list<11>());
EXPECT_EQ(a[11], a.at_list(11));
EXPECT_EQ(a[12], 2);
EXPECT_EQ(a[12], a.at_list<12>());
EXPECT_EQ(a[12], a.at_list(12));
EXPECT_EQ(a[13], 1);
EXPECT_EQ(a[13], a.at_list<13>());
EXPECT_EQ(a[13], a.at_list(13));
EXPECT_EQ(a[14], 4);
EXPECT_EQ(a[14], a.at_list<14>());
EXPECT_EQ(a[14], a.at_list(14));
}
{
nd::array<int, 2, 1> a{0, 1};
#ifdef ND_DEBUG
EXPECT_DEATH(a[2] = 0, "");
#endif
EXPECT_ANY_THROW(a.at_list(2) = 0);
EXPECT_EQ(a.at_list<0>(), 0);
EXPECT_EQ(a.at_list<1>(), 1);
a.at_list<0>() = 5;
a.at_list<1>() = 6;
EXPECT_EQ(a.at_list<0>(), 5);
EXPECT_EQ(a.at_list<1>(), 6);
}
} | 36.257732 | 89 | 0.571794 | BenKoehler |
aae4515bfba3d58c6dee873b8193419328a64e0b | 3,528 | cpp | C++ | components/common/sources/file_system/core/fs_crypto_parameters.cpp | untgames/funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 7 | 2016-03-30T17:00:39.000Z | 2017-03-27T16:04:04.000Z | components/common/sources/file_system/core/fs_crypto_parameters.cpp | untgames/Funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 4 | 2017-11-21T11:25:49.000Z | 2018-09-20T17:59:27.000Z | components/common/sources/file_system/core/fs_crypto_parameters.cpp | untgames/Funner | c91614cda55fd00f5631d2bd11c4ab91f53573a3 | [
"MIT"
] | 4 | 2016-11-29T15:18:40.000Z | 2017-03-27T16:04:08.000Z | #include "shared.h"
using namespace common;
/*
Описание реализации параметров шифрования
*/
struct FileCryptoParameters::Impl: public xtl::reference_counter
{
stl::string read_method;
stl::string write_method;
unsigned short key_bits;
xtl::uninitialized_storage<char> key;
Impl (const char* in_read_method, const char* in_write_method, const void* in_key, unsigned short in_key_bits)
: read_method (in_read_method)
, write_method (in_write_method)
, key_bits (in_key_bits)
{
size_t key_size = key_bits / CHAR_BIT;
if (key_bits % CHAR_BIT)
key_size++;
key.resize (key_size);
if (key_size)
memcpy (key.data (), in_key, key_size);
}
};
/*
Конструкторы / деструктор / присваивание
*/
FileCryptoParameters::FileCryptoParameters (const char* read_method, const char* write_method, const void* key, unsigned short key_bits)
{
static const char* METHOD_NAME = "common::FileFileCryptoParameters";
if (!read_method)
throw xtl::make_null_argument_exception (METHOD_NAME, "read_method");
if (!write_method)
throw xtl::make_null_argument_exception (METHOD_NAME, "write_method");
if (!key && key_bits)
throw xtl::make_null_argument_exception (METHOD_NAME, "key");
impl = new Impl (read_method, write_method, key, key_bits);
}
FileCryptoParameters::FileCryptoParameters (const char* read_method,const char* write_method,const char* key_string)
{
static const char* METHOD_NAME = "common::FileFileCryptoParameters";
if (!read_method)
throw xtl::make_null_argument_exception (METHOD_NAME, "read_method");
if (!write_method)
throw xtl::make_null_argument_exception (METHOD_NAME, "write_method");
if (!key_string)
throw xtl::make_null_argument_exception (METHOD_NAME, "key_string");
size_t key_length = strlen (key_string);
if (key_length % 2)
throw xtl::make_argument_exception (METHOD_NAME, "key_string", key_string, "Key string must have even value length");
if (key_length * CHAR_BIT > USHRT_MAX)
throw xtl::make_argument_exception (METHOD_NAME, "key_string", key_string, "Key string too long");
xtl::uninitialized_storage<char> key (key_length / 2);
compress_buffer (key_length, key_string, key.data ());
impl = new Impl (read_method, write_method, key.data (), (unsigned short)key.size () * CHAR_BIT);
}
FileCryptoParameters::FileCryptoParameters (const FileCryptoParameters& params)
: impl (params.impl)
{
addref (impl);
}
FileCryptoParameters::~FileCryptoParameters ()
{
release (impl);
}
FileCryptoParameters& FileCryptoParameters::operator = (const FileCryptoParameters& params)
{
addref (params.impl);
release (impl);
impl = params.impl;
return *this;
}
/*
Параметры
*/
//метод шифрования при чтении из файла
const char* FileCryptoParameters::ReadMethod () const
{
return impl->read_method.c_str ();
}
//метод шифрования при записи в файл
const char* FileCryptoParameters::WriteMethod () const
{
return impl->write_method.c_str ();
}
//указатель на буфер, содержащий ключ шифрования
const void* FileCryptoParameters::Key () const
{
static char empty_key = 0;
return impl->key.size () ? impl->key.data () : &empty_key;
}
//количество битов в ключе
unsigned short FileCryptoParameters::KeyBits () const
{
return impl->key_bits;
}
| 26.931298 | 137 | 0.686224 | untgames |
aae473c31447e2409e148edb1b2efd10e4ad59e2 | 3,629 | hpp | C++ | Opal Prospect/OpenGL/ArrayTextureAtlas.hpp | swbengs/OpalProspect | 5f77dd07c1bb4197673589ac3f42546a4d0329b3 | [
"MIT"
] | 2 | 2018-06-06T02:01:08.000Z | 2020-07-25T18:10:32.000Z | Opal Prospect/OpenGL/ArrayTextureAtlas.hpp | swbengs/OpalProspect | 5f77dd07c1bb4197673589ac3f42546a4d0329b3 | [
"MIT"
] | 10 | 2018-07-27T01:56:45.000Z | 2019-02-23T01:49:36.000Z | Opal Prospect/OpenGL/ArrayTextureAtlas.hpp | swbengs/OpalProspect | 5f77dd07c1bb4197673589ac3f42546a4d0329b3 | [
"MIT"
] | null | null | null | #pragma once
//std lib includes
#include <string>
#include <vector>
//other includes
/*
MIT License
Copyright (c) 2018 Scott Bengs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
/*
Class to load and store a texture that is array of textures. 256 max supported z depth with OpenGL 3.3. 4.0+ adds support for 1024 or more I believe. Also can load multiple files and combine them into a single array texture as long as they all
share the same individual size. Instead of a texture atlas, one big image that you divide with texture coordinates, you have lots of smaller textures of the same size. Such as 16x16px
*/
class ArrayTextureAtlas
{
public:
ArrayTextureAtlas();
void bind() const;
void unbind() const;
void createTexture(); //creates the id and loads the texture file the given filename
void destroy();
//gets
unsigned int getID() const;
std::string getFilename() const;
int getWidth() const;
int getHeight() const;
int getAtlasWidth() const;
int getAtlasHeight() const;
int getAtlasDepth() const;
size_t getAtlasCount() const;
//sets
void setTextureWidth(int width);
void setTextureHeight(int height);
void setFilename(std::string filename);
//loads the image and does everything but interact with opengl. Use this to test without having a context created
void testLoading(std::vector<unsigned char>& store_data);
private:
unsigned int id; //opengl ID to this texture
std::string name; //filename
std::vector<std::vector<unsigned char>> atlas_data; //this way we can have the images completely seperate. Each image is loaded into its own unsigned char vector we can access
//these two are given by file
int texture_width; //in pixels for each individual texture in the array
int texture_height;
//these 3 are calculated
int atlas_width; //atlas variables pertain to the count of textures in width and height
int atlas_height;
int atlas_depth;//in total layers. OpenGL 3.0 and above has 256 minimum. 4.0 and above has 2048 or more
void loadTexture(std::string filename, int& texture_width, int& texture_height, std::vector<std::vector<unsigned char>>& vector);
void flipVertical(int width, int height, std::vector<unsigned char>& vector);
void uploadTexture(int z_offset, void* data) const; //void pointers because we don't care what the data is. Just send it up byte by byte
void uploadCompleteTexture(int count, void* data) const;
void extractTexture(std::vector<unsigned char>& data, std::vector<unsigned char>& atlas, size_t start, int atlas_x, int atlas_y, int pixel_size) const;
};
| 41.712644 | 243 | 0.751171 | swbengs |
aaeb66ff725b18134cbc4740e9fdcff2c5ffd85f | 2,175 | cc | C++ | third-party/qthread/qthread-src/test/benchmarks/finepoints/partSendPrototype/mpiBaseTest1.cc | jhh67/chapel | f041470e9b88b5fc4914c75aa5a37efcb46aa08f | [
"ECL-2.0",
"Apache-2.0"
] | 1,602 | 2015-01-06T11:26:31.000Z | 2022-03-30T06:17:21.000Z | third-party/qthread/qthread-src/test/benchmarks/finepoints/partSendPrototype/mpiBaseTest1.cc | jhh67/chapel | f041470e9b88b5fc4914c75aa5a37efcb46aa08f | [
"ECL-2.0",
"Apache-2.0"
] | 11,789 | 2015-01-05T04:50:15.000Z | 2022-03-31T23:39:19.000Z | third-party/qthread/qthread-src/test/benchmarks/finepoints/partSendPrototype/mpiBaseTest1.cc | jhh67/chapel | f041470e9b88b5fc4914c75aa5a37efcb46aa08f | [
"ECL-2.0",
"Apache-2.0"
] | 498 | 2015-01-08T18:58:18.000Z | 2022-03-20T15:37:45.000Z | //#include <omp.h>
#include <mpi.h>
#include <qthread/qthread.h>
#include <qthread/barrier.h>
#include <qthread/qloop.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
typedef struct args {
int rank;
int numIterations;
char* sendBuf;
char* recvBuf;
int numThreads;
size_t threadPart;
int other;
MPI_Request *requests;
} arg_t;
static qt_barrier_t *wait_on_me;
static double start;
static void worker(unsigned long tid, unsigned long, void *arg) {
arg_t *a = (arg_t*)arg;
int rc;
int iteration;
//int rank = a->rank;
int numIterations = a->numIterations;
char* sendBuf = a->sendBuf;
char* recvBuf = a->recvBuf;
//int numThreads = a->numThreads;
size_t threadPart = a->threadPart;
int other = a->other;
MPI_Request *requests = a->requests;
rc = MPI_Recv_init( (char*) recvBuf + tid * threadPart, threadPart, MPI_CHAR, other, tid, MPI_COMM_WORLD, &requests[tid*2 + 0] );
assert( rc == MPI_SUCCESS );
rc = MPI_Send_init( (char*) sendBuf + tid * threadPart, threadPart, MPI_CHAR, other, tid, MPI_COMM_WORLD, &requests[tid*2 + 1] );
assert( rc == MPI_SUCCESS );
if(tid == 0)
start = MPI_Wtime();
for ( iteration = 0; iteration < numIterations; iteration++ ) {
if(tid == 0) {
rc = MPI_Barrier(MPI_COMM_WORLD);
assert( rc == MPI_SUCCESS );
}
qt_barrier_enter(wait_on_me);
rc = MPI_Start(&requests[tid*2 + 0]);
assert( rc == MPI_SUCCESS );
rc = MPI_Start(&requests[tid*2 + 1]);
assert( rc == MPI_SUCCESS );
rc = MPI_Waitall( 2, &requests[ tid*2 ], MPI_STATUS_IGNORE );
assert( rc == MPI_SUCCESS );
}
MPI_Request_free( &requests[tid*2 + 0] );
MPI_Request_free( &requests[tid*2 + 1] );
}
double doTest1( int rank, int numIterations, char* sendBuf, char* recvBuf, int numThreads, size_t threadPart )
{
arg_t arg;
int other = (rank + 1) % 2;
MPI_Request requests[2*numThreads];
arg.rank = rank;
arg.numIterations = numIterations;
arg.sendBuf = sendBuf;
arg.recvBuf = recvBuf;
arg.numThreads = numThreads;
arg.threadPart = threadPart;
arg.other = other;
arg.requests = requests;
qt_loop(0, numThreads, worker, &arg);
return MPI_Wtime() - start;
}
| 24.715909 | 130 | 0.682759 | jhh67 |
aaf3d1f5fb113b051f372b00669f0e9c677b2907 | 13,803 | cpp | C++ | depends/work/build/i686-w64-mingw32/qt/5.9.7-f2560c1efa6/qtbase/src/corelib/io/qsavefile.cpp | GrinCash/Grinc-core | 1377979453ba84082f70f9c128be38e57b65a909 | [
"MIT"
] | null | null | null | depends/work/build/i686-w64-mingw32/qt/5.9.7-f2560c1efa6/qtbase/src/corelib/io/qsavefile.cpp | GrinCash/Grinc-core | 1377979453ba84082f70f9c128be38e57b65a909 | [
"MIT"
] | null | null | null | depends/work/build/i686-w64-mingw32/qt/5.9.7-f2560c1efa6/qtbase/src/corelib/io/qsavefile.cpp | GrinCash/Grinc-core | 1377979453ba84082f70f9c128be38e57b65a909 | [
"MIT"
] | null | null | null | /****************************************************************************
**
** Copyright (C) 2012 David Faure <faure@kde.org>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qsavefile.h"
#ifndef QT_NO_TEMPORARYFILE
#include "qplatformdefs.h"
#include "private/qsavefile_p.h"
#include "qfileinfo.h"
#include "qabstractfileengine_p.h"
#include "qdebug.h"
#include "qtemporaryfile.h"
#include "private/qiodevice_p.h"
#include "private/qtemporaryfile_p.h"
#ifdef Q_OS_UNIX
#include <errno.h>
#endif
QT_BEGIN_NAMESPACE
QSaveFilePrivate::QSaveFilePrivate()
: writeError(QFileDevice::NoError),
useTemporaryFile(true),
directWriteFallback(false)
{
}
QSaveFilePrivate::~QSaveFilePrivate()
{
}
/*!
\class QSaveFile
\inmodule QtCore
\brief The QSaveFile class provides an interface for safely writing to files.
\ingroup io
\reentrant
\since 5.1
QSaveFile is an I/O device for writing text and binary files, without losing
existing data if the writing operation fails.
While writing, the contents will be written to a temporary file, and if
no error happened, commit() will move it to the final file. This ensures that
no data at the final file is lost in case an error happens while writing,
and no partially-written file is ever present at the final location. Always
use QSaveFile when saving entire documents to disk.
QSaveFile automatically detects errors while writing, such as the full partition
situation, where write() cannot write all the bytes. It will remember that
an error happened, and will discard the temporary file in commit().
Much like with QFile, the file is opened with open(). Data is usually read
and written using QDataStream or QTextStream, but you can also call the
QIODevice-inherited functions read(), readLine(), readAll(), write().
Unlike QFile, calling close() is not allowed. commit() replaces it. If commit()
was not called and the QSaveFile instance is destroyed, the temporary file is
discarded.
To abort saving due to an application error, call cancelWriting(), so that
even a call to commit() later on will not save.
\sa QTextStream, QDataStream, QFileInfo, QDir, QFile, QTemporaryFile
*/
#ifdef QT_NO_QOBJECT
QSaveFile::QSaveFile(const QString &name)
: QFileDevice(*new QSaveFilePrivate)
{
Q_D(QSaveFile);
d->fileName = name;
}
#else
/*!
Constructs a new file object to represent the file with the given \a name.
*/
QSaveFile::QSaveFile(const QString &name)
: QFileDevice(*new QSaveFilePrivate, 0)
{
Q_D(QSaveFile);
d->fileName = name;
}
/*!
Constructs a new file object with the given \a parent.
*/
QSaveFile::QSaveFile(QObject *parent)
: QFileDevice(*new QSaveFilePrivate, parent)
{
}
/*!
Constructs a new file object with the given \a parent to represent the
file with the specified \a name.
*/
QSaveFile::QSaveFile(const QString &name, QObject *parent)
: QFileDevice(*new QSaveFilePrivate, parent)
{
Q_D(QSaveFile);
d->fileName = name;
}
#endif
/*!
Destroys the file object, discarding the saved contents unless commit() was called.
*/
QSaveFile::~QSaveFile()
{
Q_D(QSaveFile);
QFileDevice::close();
if (d->fileEngine) {
d->fileEngine->remove();
delete d->fileEngine;
d->fileEngine = 0;
}
}
/*!
Returns the name set by setFileName() or to the QSaveFile
constructor.
\sa setFileName()
*/
QString QSaveFile::fileName() const
{
return d_func()->fileName;
}
/*!
Sets the \a name of the file. The name can have no path, a
relative path, or an absolute path.
\sa QFile::setFileName(), fileName()
*/
void QSaveFile::setFileName(const QString &name)
{
d_func()->fileName = name;
}
/*!
Opens the file using OpenMode \a mode, returning true if successful;
otherwise false.
Important: the \a mode must include QIODevice::WriteOnly.
It may also have additional flags, such as QIODevice::Text and QIODevice::Unbuffered.
QIODevice::ReadWrite and QIODevice::Append are not supported at the moment.
\sa QIODevice::OpenMode, setFileName()
*/
bool QSaveFile::open(OpenMode mode)
{
Q_D(QSaveFile);
if (isOpen()) {
qWarning("QSaveFile::open: File (%s) already open", qPrintable(fileName()));
return false;
}
unsetError();
if ((mode & (ReadOnly | WriteOnly)) == 0) {
qWarning("QSaveFile::open: Open mode not specified");
return false;
}
// In the future we could implement ReadWrite by copying from the existing file to the temp file...
if ((mode & ReadOnly) || (mode & Append)) {
qWarning("QSaveFile::open: Unsupported open mode 0x%x", int(mode));
return false;
}
// check if existing file is writable
QFileInfo existingFile(d->fileName);
if (existingFile.exists() && !existingFile.isWritable()) {
d->setError(QFileDevice::WriteError, QSaveFile::tr("Existing file %1 is not writable").arg(d->fileName));
d->writeError = QFileDevice::WriteError;
return false;
}
if (existingFile.isDir()) {
d->setError(QFileDevice::WriteError, QSaveFile::tr("Filename refers to a directory"));
d->writeError = QFileDevice::WriteError;
return false;
}
// Resolve symlinks. Don't use QFileInfo::canonicalFilePath so it still give the expected
// target even if the file does not exist
d->finalFileName = d->fileName;
if (existingFile.isSymLink()) {
int maxDepth = 128;
while (--maxDepth && existingFile.isSymLink())
existingFile.setFile(existingFile.symLinkTarget());
if (maxDepth > 0)
d->finalFileName = existingFile.filePath();
}
d->fileEngine = new QTemporaryFileEngine(QTemporaryFileEngine::Win32NonShared);
// if the target file exists, we'll copy its permissions below,
// but until then, let's ensure the temporary file is not accessible
// to a third party
int perm = (existingFile.exists() ? 0600 : 0666);
static_cast<QTemporaryFileEngine *>(d->fileEngine)->initialize(d->finalFileName, perm);
// Same as in QFile: QIODevice provides the buffering, so there's no need to request it from the file engine.
if (!d->fileEngine->open(mode | QIODevice::Unbuffered)) {
QFileDevice::FileError err = d->fileEngine->error();
#ifdef Q_OS_UNIX
if (d->directWriteFallback && err == QFileDevice::OpenError && errno == EACCES) {
delete d->fileEngine;
d->fileEngine = QAbstractFileEngine::create(d->finalFileName);
if (d->fileEngine->open(mode | QIODevice::Unbuffered)) {
d->useTemporaryFile = false;
QFileDevice::open(mode);
return true;
}
err = d->fileEngine->error();
}
#endif
if (err == QFileDevice::UnspecifiedError)
err = QFileDevice::OpenError;
d->setError(err, d->fileEngine->errorString());
delete d->fileEngine;
d->fileEngine = 0;
return false;
}
d->useTemporaryFile = true;
QFileDevice::open(mode);
if (existingFile.exists())
setPermissions(existingFile.permissions());
return true;
}
/*!
\reimp
This method has been made private so that it cannot be called, in order to prevent mistakes.
In order to finish writing the file, call commit().
If instead you want to abort writing, call cancelWriting().
*/
void QSaveFile::close()
{
qFatal("QSaveFile::close called");
}
/*!
Commits the changes to disk, if all previous writes were successful.
It is mandatory to call this at the end of the saving operation, otherwise the file will be
discarded.
If an error happened during writing, deletes the temporary file and returns \c false.
Otherwise, renames it to the final fileName and returns \c true on success.
Finally, closes the device.
\sa cancelWriting()
*/
bool QSaveFile::commit()
{
Q_D(QSaveFile);
if (!d->fileEngine)
return false;
if (!isOpen()) {
qWarning("QSaveFile::commit: File (%s) is not open", qPrintable(fileName()));
return false;
}
QFileDevice::close(); // calls flush()
// Sync to disk if possible. Ignore errors (e.g. not supported).
d->fileEngine->syncToDisk();
if (d->useTemporaryFile) {
if (d->writeError != QFileDevice::NoError) {
d->fileEngine->remove();
d->writeError = QFileDevice::NoError;
delete d->fileEngine;
d->fileEngine = 0;
return false;
}
// atomically replace old file with new file
// Can't use QFile::rename for that, must use the file engine directly
Q_ASSERT(d->fileEngine);
if (!d->fileEngine->renameOverwrite(d->finalFileName)) {
d->setError(d->fileEngine->error(), d->fileEngine->errorString());
d->fileEngine->remove();
delete d->fileEngine;
d->fileEngine = 0;
return false;
}
}
delete d->fileEngine;
d->fileEngine = 0;
return true;
}
/*!
Cancels writing the new file.
If the application changes its mind while saving, it can call cancelWriting(),
which sets an error code so that commit() will discard the temporary file.
Alternatively, it can simply make sure not to call commit().
Further write operations are possible after calling this method, but none
of it will have any effect, the written file will be discarded.
This method has no effect when direct write fallback is used. This is the case
when saving over an existing file in a readonly directory: no temporary file can
be created, so the existing file is overwritten no matter what, and cancelWriting()
cannot do anything about that, the contents of the existing file will be lost.
\sa commit()
*/
void QSaveFile::cancelWriting()
{
Q_D(QSaveFile);
if (!isOpen())
return;
d->setError(QFileDevice::WriteError, QSaveFile::tr("Writing canceled by application"));
d->writeError = QFileDevice::WriteError;
}
/*!
\reimp
*/
qint64 QSaveFile::writeData(const char *data, qint64 len)
{
Q_D(QSaveFile);
if (d->writeError != QFileDevice::NoError)
return -1;
const qint64 ret = QFileDevice::writeData(data, len);
if (d->error != QFileDevice::NoError)
d->writeError = d->error;
return ret;
}
/*!
Allows writing over the existing file if necessary.
QSaveFile creates a temporary file in the same directory as the final
file and atomically renames it. However this is not possible if the
directory permissions do not allow creating new files.
In order to preserve atomicity guarantees, open() fails when it
cannot create the temporary file.
In order to allow users to edit files with write permissions in a
directory with restricted permissions, call setDirectWriteFallback() with
\a enabled set to true, and the following calls to open() will fallback to
opening the existing file directly and writing into it, without the use of
a temporary file.
This does not have atomicity guarantees, i.e. an application crash or
for instance a power failure could lead to a partially-written file on disk.
It also means cancelWriting() has no effect, in such a case.
Typically, to save documents edited by the user, call setDirectWriteFallback(true),
and to save application internal files (configuration files, data files, ...), keep
the default setting which ensures atomicity.
\sa directWriteFallback()
*/
void QSaveFile::setDirectWriteFallback(bool enabled)
{
Q_D(QSaveFile);
d->directWriteFallback = enabled;
}
/*!
Returns \c true if the fallback solution for saving files in read-only
directories is enabled.
\sa setDirectWriteFallback()
*/
bool QSaveFile::directWriteFallback() const
{
Q_D(const QSaveFile);
return d->directWriteFallback;
}
QT_END_NAMESPACE
#ifndef QT_NO_QOBJECT
#include "moc_qsavefile.cpp"
#endif
#endif // QT_NO_TEMPORARYFILE
| 32.554245 | 113 | 0.683475 | GrinCash |
aaf75fdb1ea2ae1d25317dd54f71fe36a26d5ee8 | 9,991 | cpp | C++ | Battle.cpp | Ricecrackie/Fantasy-Battle | 058dc323101d405e222e9c8f135500044ce6e180 | [
"Apache-2.0"
] | null | null | null | Battle.cpp | Ricecrackie/Fantasy-Battle | 058dc323101d405e222e9c8f135500044ce6e180 | [
"Apache-2.0"
] | null | null | null | Battle.cpp | Ricecrackie/Fantasy-Battle | 058dc323101d405e222e9c8f135500044ce6e180 | [
"Apache-2.0"
] | null | null | null | #include "Battle.h"
#include "Tower.h"
#include "Character/Boss.h"
#include "Character/StrongEnemy.h"
#include "Character/WeakEnemy.h"
#include <random>
#include "QRandomGenerator"
extern int random_number(const int&, const int&);
extern const int BossATK;
extern const int BossDEF;
extern const int StrongEnemyATK;
extern const int StrongEnemyDEF;
extern const int WeakEnemyATK;
extern const int WeakEnemyDEF;
// generates a random power up
int random_power_up(const int begin, const int end) {
std::random_device dev;
std::mt19937 rng(dev());
std::uniform_int_distribution<std::mt19937::result_type> dist6(begin,end);
return dist6(rng);
}
// call constructor to create a Battle Object by passing the player and enemy objects to the constructor
Battle::Battle(Character* player, Enemy** enemy) : player(player), playerOriginalATK(player->ATK), playerOriginalDEF(player->DEF) {
Player* play = dynamic_cast<Player*>(player);
int num_of_enemy = play->tower.get_floors()[play->tower.get_current_floor_index()].get_number_of_enemy();
this->enemy = enemy;
current_round = new Round();
}
// returns the character's status
std::string Battle::view_status(Character& chara) const {
return chara.info();
}
// returns the values called by the function
bool Battle::get_isPlayerWin() const {return isPlayerWin;}
bool Battle::get_isPlayerLose() const {return isPlayerLose;}
Round*& Battle::get_current_round() {return current_round;}
int Battle::get_round_counter() const {return round_counter;}
Enemy** Battle::get_enemy() const {return enemy;}
// Check if the player has defeated all the enemies or lost all their health
bool Battle::isSomebodyWin() {
Player* temp = dynamic_cast<Player*>(player);
if (player->HP == 0) {
isPlayerLose = true;
return true;
}
else if (temp->tower.get_floors()[temp->tower.get_current_floor_index()].get_enemy_HP() == 0) {
isPlayerWin = true;
return true;
}
else {
return false;
}
}
// Battle proceeds to the next round and outputs the actions done on each turn
void Battle::go_to_next_round() { // The winning condition is always checked.
player->AP = player->get_AP_max(); // Restore the AP of players & enemies.
Player* play = dynamic_cast<Player*>(player);
for (int i = 0; i < play->tower.get_floors()[play->tower.get_current_floor_index()].get_number_of_enemy(); ++i) {
enemy[i]->AP = enemy[i]->get_AP_max();
} //
for (int i = 0; i < action_effect.size(); ++i) { // Execute post-action effect of skills from previous rounds.
if (isSomebodyWin()) return;
if (action_effect[i]->skill != nullptr) {
std::string continuous_effect = action_effect[i]->skill->continuous_effect(action_effect[i]->receiver, action_effect[i]->doer);
if (continuous_effect != "") {cout << continuous_effect << endl;}
--action_effect_count[i];
}
} //
if (isSomebodyWin()) return;
cout << "Round " << round_counter << endl; // Execute and display actions in the current round's action list.
for (int j = 0; j < current_round->action_list.size(); ++j) {
if (isSomebodyWin()) return;
int isPowerup = QRandomGenerator::global()->bounded(4);
int PowerUp_index = QRandomGenerator::global()->bounded(1, 6);
if (isPowerup != 3) {
PowerUp_index = 0;
}
cout << current_round->action_doer_process(current_round->action_list[j], power_up[PowerUp_index]) << endl;
cout << current_round->action_receiver_process(current_round->action_list[j], power_up[PowerUp_index]) << endl;
if (current_round->action_list[j]->get_type() == Action::type::USE_A_SKILL) { // Add actions in action list to action effect list
if (action_effect.size() != 0) {
action_effect.push_back(current_round->action_list[j]);
action_effect_count.push_back(current_round->action_list[j]->get_skill()->rounds_of_effect);
}
else {
action_effect.resize(1);
action_effect[0] = current_round->action_list[j];
action_effect_count.resize(1);
action_effect_count[0] = current_round->action_list[j]->get_skill()->rounds_of_effect;
}
}
} //
if (isSomebodyWin()) return;
int i = 0;
while (i < action_effect.size()) { // Clear actions that finish all post-action effect execution from the action effect list
if (action_effect_count[i] == 0) {
std::string undo = action_effect[i]->get_skill()->undo_effect();
if (undo != "") {cout << undo << endl;}
delete action_effect[i];
action_effect.erase(action_effect.begin()+i);
action_effect_count.erase(action_effect_count.begin()+i);
continue;
}
else {
++i;
continue;
}
}
delete current_round;
current_round = new Round;
player->AP = player->get_AP_max();
round_counter++;
}
// sets the status of Win or Lose
void Battle::setIsPlayerWin(bool isPlayerWin) {this->isPlayerWin = isPlayerWin;}
void Battle::setIsPlayerLose(bool isPlayerLose) {this->isPlayerLose = isPlayerLose;}
// returns the player pointer
Character* Battle::get_player() const{return player;}
// To determine whether the enemy would use buff skills like Strengthen or Defence. The chances are 20% (1/5).
bool useBuffSkill() {
int temp = QRandomGenerator::global()->bounded(1, 6);
if (temp == 1) return true;
else return false;
}
// checks if the Enemy has enough MP to use the skill
bool Battle::isEnemyMPenough(Enemy* enemy, Skill* skill) {
if (enemy->MP >= skill->get_MP_cost()) return true;
else return false;
}
// generates a random action by the enemy
Action* Battle::enemy_random_action(Enemy* enemy) {
int WeakEnemyBuffSkillIndices = 1;
int WeakEnemyAttackSkillIndices = 0;
int StrongEnemyBuffSkillIndices[2] = {1, 2};
int StrongEnemyAttackSkillIndices[2] = {0, 3};
int BossBuffSkillIndices[4] = {1, 2, 7, 8};
int BossAttackSkillIndices[5] = {0, 3, 4, 5, 6};
int pick;
while (true) {
switch (enemy->get_type()) {
case Enemy::enemy_type::WeakEnemy:
if (useBuffSkill()) {
if (isEnemyMPenough(enemy, enemy->learned_skill[WeakEnemyBuffSkillIndices]))
return new Action(enemy, enemy, enemy->learned_skill[WeakEnemyBuffSkillIndices]);
else break;
}
else {
return new Action(enemy, player, enemy->learned_skill[WeakEnemyAttackSkillIndices]);
}
case Enemy::enemy_type::StrongEnemy:
if (useBuffSkill()) {
pick = QRandomGenerator::global()->bounded(2);
if (isEnemyMPenough(enemy, enemy->learned_skill[StrongEnemyBuffSkillIndices[pick]]))
return new Action(enemy, enemy, enemy->learned_skill[StrongEnemyBuffSkillIndices[pick]]);
else break;
}
else {
pick = QRandomGenerator::global()->bounded(2);
if (isEnemyMPenough(enemy, enemy->learned_skill[StrongEnemyAttackSkillIndices[pick]]))
return new Action(enemy, player, enemy->learned_skill[StrongEnemyAttackSkillIndices[pick]]);
else break;
}
case Enemy::enemy_type::Boss:
if (useBuffSkill()) {
pick = QRandomGenerator::global()->bounded(4);
if (isEnemyMPenough(enemy, enemy->learned_skill[BossBuffSkillIndices[pick]]))
return new Action(enemy, enemy, enemy->learned_skill[BossBuffSkillIndices[pick]]);
else break;
}
else {
pick = QRandomGenerator::global()->bounded(5);
if (isEnemyMPenough(enemy, enemy->learned_skill[BossAttackSkillIndices[pick]]))
return new Action (enemy, player, enemy->learned_skill[BossAttackSkillIndices[pick]]);
else break;
}
}
}
}
// generates the list of actions of the enemy
void Battle::generate_enemy_actionlist() {
Enemy** enemies = dynamic_cast<Player*>(player)->tower.get_floors()[dynamic_cast<Player*>(player)->tower.get_current_floor_index()].get_enemy();
for (int i = 0; i < dynamic_cast<Player*>(player)->tower.get_floors()[dynamic_cast<Player*>(player)->tower.get_current_floor_index()].get_number_of_enemy(); ++i) {
if (enemies[i]->HP == 0) continue;
Action* action = enemy_random_action(enemies[i]);
if (current_round->action_list.size() == 0) {
current_round->action_list.resize(1);
current_round->action_list[0] = action;
}
else {
current_round->action_list.push_back(action);
}
}
}
// destructor of Battle Object, deallocates the memory of current round and resets the values
Battle::~Battle() {
player->ATK = playerOriginalATK;
player->DEF = playerOriginalDEF;
Player* play = dynamic_cast<Player*>(player);
for (int i = 0; i < play->tower.get_floors()[play->tower.get_current_floor_index()].get_number_of_enemy(); ++i) {
int ATK; int DEF;
switch(static_cast<int>(play->tower.get_floors()[play->tower.get_current_floor_index()].get_enemy()[i]->get_type())) {
case 1: ATK = WeakEnemyATK; DEF = WeakEnemyDEF; break;
case 2: ATK = StrongEnemyATK; DEF = StrongEnemyDEF; break;
case 3: ATK = BossATK; DEF = BossDEF; break;
}
play->tower.get_floors()[play->tower.get_current_floor_index()].get_enemy()[i]->ATK = ATK;
play->tower.get_floors()[play->tower.get_current_floor_index()].get_enemy()[i]->DEF = DEF;
}
delete current_round;
}
| 44.404444 | 167 | 0.635172 | Ricecrackie |
aafb5597cd8fc9e872eee0246773aa0a3fd3d72e | 10,324 | cpp | C++ | render.cpp | darkoppressor/huberts-island-level-editor | a1d7b0ccc20b8d463b7c26886349e5f0b0ee0d8c | [
"MIT"
] | null | null | null | render.cpp | darkoppressor/huberts-island-level-editor | a1d7b0ccc20b8d463b7c26886349e5f0b0ee0d8c | [
"MIT"
] | null | null | null | render.cpp | darkoppressor/huberts-island-level-editor | a1d7b0ccc20b8d463b7c26886349e5f0b0ee0d8c | [
"MIT"
] | null | null | null | /* Copyright (c) 2012-2013 Cheese and Bacon Games, LLC */
/* See the file docs/COPYING.txt for copying permission. */
#include "render.h"
#include "world.h"
using namespace std;
SDL_Surface* optimize_image_opengl(SDL_Surface* surface){
SDL_PixelFormat RGBAFormat;
RGBAFormat.palette=0;
RGBAFormat.colorkey=0;
RGBAFormat.alpha=0;
RGBAFormat.BitsPerPixel=32;
RGBAFormat.BytesPerPixel=4;
if(SDL_BYTEORDER==SDL_BIG_ENDIAN){
RGBAFormat.Rmask=0xFF000000; RGBAFormat.Rshift=0; RGBAFormat.Rloss=0;
RGBAFormat.Gmask=0x00FF0000; RGBAFormat.Gshift=8; RGBAFormat.Gloss=0;
RGBAFormat.Bmask=0x0000FF00; RGBAFormat.Bshift=16; RGBAFormat.Bloss=0;
RGBAFormat.Amask=0x000000FF; RGBAFormat.Ashift=24; RGBAFormat.Aloss=0;
}
else{
RGBAFormat.Rmask=0x000000FF; RGBAFormat.Rshift=24; RGBAFormat.Rloss=0;
RGBAFormat.Gmask=0x0000FF00; RGBAFormat.Gshift=16; RGBAFormat.Gloss=0;
RGBAFormat.Bmask=0x00FF0000; RGBAFormat.Bshift=8; RGBAFormat.Bloss=0;
RGBAFormat.Amask=0xFF000000; RGBAFormat.Ashift=0; RGBAFormat.Aloss=0;
}
SDL_Surface* conv=SDL_ConvertSurface(surface,&RGBAFormat,SDL_SWSURFACE);
return conv;
}
SDL_Surface* load_image_opengl(string filename){
SDL_Surface* loaded_image=0;
SDL_Surface* optimized_image=0;
//Load the image.
loaded_image=IMG_Load(filename.c_str());
if(loaded_image!=0){
optimized_image=optimize_image_opengl(loaded_image);
SDL_FreeSurface(loaded_image);
}
//Return the optimized image.
return optimized_image;
}
GLuint surface_to_texture(SDL_Surface* surface){
//This texture will be returned at the end of this function.
GLuint texture;
//Have OpenGL generate a texture object handle for us.
glGenTextures(1,&texture);
//Bind the texture object.
glBindTexture(GL_TEXTURE_2D,texture);
//Set the texture's properties:
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_CLAMP);
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_NEAREST);///GL_LINEAR
glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_NEAREST);///GL_LINEAR
//Edit the texture object's image data using the information our image gives us:
glTexImage2D(GL_TEXTURE_2D,0,surface->format->BytesPerPixel,surface->w,surface->h,0,GL_RGBA,GL_UNSIGNED_BYTE,surface->pixels);
return texture;
}
GLuint load_texture(string filename){
//This will temporarily store the name of the image we are loading.
SDL_Surface* surface=0;
//Load the image.
surface=load_image_opengl(filename.c_str());
GLuint texture=surface_to_texture(surface);
//We have copied the image data into the new texture, so delete the image data.
SDL_FreeSurface(surface);
//Return the new texture we have created.
return texture;
}
//Render a full texture to the screen.
void render_texture(double x,double y,double w,double h,GLuint source,double opacity){
//Bind the texture object.
glBindTexture(GL_TEXTURE_2D,source);
//Move to the offset of the image we want to place.
glTranslated(x,y,0);
glColor4d(1.0,1.0,1.0,opacity);
//Start quad.
glBegin(GL_QUADS);
//Apply the texture to the screen:
glTexCoord2d(0,0); glVertex3d(0,0,0);
glTexCoord2d(1,0); glVertex3d(w,0,0);
glTexCoord2d(1,1); glVertex3d(w,h,0);
glTexCoord2d(0,1); glVertex3d(0,h,0);
//End quad.
glEnd();
//Reset.
glLoadIdentity();
}
//Render a sprite from a spritesheet to the screen.
void render_sprite(double x,double y,double w,double h,GLuint source,SDL_Rect* texture_clip,double opacity,bool flip,double angle){
//Bind the texture object.
glBindTexture(GL_TEXTURE_2D,source);
//Move to the offset of the image we want to place.
glTranslated(x,y,0);
glTranslated(texture_clip->w/2.0,texture_clip->h/2.0,0);
glRotated(angle,0,0,-1);
glTranslated(-texture_clip->w/2.0,-texture_clip->h/2.0,0);
glColor4d(1.0,1.0,1.0,opacity);
//Start quad.
glBegin(GL_QUADS);
//Apply the texture to the screen:
//If flip is false, just apply the texture to the screen normally.
if(flip==false){
//Bottom left corner.
glTexCoord2d((texture_clip->x)/w,(texture_clip->y+texture_clip->h)/h);
glVertex3d(0,texture_clip->h,0);
//Bottom right corner.
glTexCoord2d((texture_clip->x+texture_clip->w)/w,(texture_clip->y+texture_clip->h)/h);
glVertex3d(texture_clip->w,texture_clip->h,0);
//Top right corner.
glTexCoord2d((texture_clip->x+texture_clip->w)/w,(texture_clip->y)/h);
glVertex3d(texture_clip->w,0,0);
//Top left corner.
glTexCoord2d((texture_clip->x)/w,(texture_clip->y)/h);
glVertex3d(0,0,0);
}
//If flip is true, flip the image on the x-axis.
if(flip==true){
//Bottom right corner.
glTexCoord2d((texture_clip->x+texture_clip->w)/w,(texture_clip->y+texture_clip->h)/h);
//Bottom left corner.
glVertex3d(0,texture_clip->h,0);
//Bottom left corner.
glTexCoord2d((texture_clip->x)/w,(texture_clip->y+texture_clip->h)/h);
//Bottom right corner.
glVertex3d(texture_clip->w,texture_clip->h,0);
//Top left corner.
glTexCoord2d((texture_clip->x)/w,(texture_clip->y)/h);
//Top right corner.
glVertex3d(texture_clip->w,0,0);
//Top right corner.
glTexCoord2d((texture_clip->x+texture_clip->w)/w,(texture_clip->y)/h);
//Top left corner.
glVertex3d(0,0,0);
}
//End quad.
glEnd();
//Reset.
glLoadIdentity();
}
void render_rectangle(double x,double y,double w,double h,double opacity,double r,double g,double b){
//Bind the texture object.
glBindTexture(GL_TEXTURE_2D,NULL);
//Move to the offset of the image we want to place.
glTranslated(x,y,0);
glColor4d(r,g,b,opacity);
//Start quad.
glBegin(GL_QUADS);
//Apply the texture to the screen:
glTexCoord2d(0,0); glVertex3d(0,0,0);
glTexCoord2d(1,0); glVertex3d(w,0,0);
glTexCoord2d(1,1); glVertex3d(w,h,0);
glTexCoord2d(0,1); glVertex3d(0,h,0);
//End quad.
glEnd();
//Reset.
glLoadIdentity();
}
//Render text to the screen using a bitmap font.
void render_font(double x,double y,double w,double h,GLuint source,SDL_Rect* texture_clip=NULL,short font_color,double opacity){
//Move to the offset of the image we want to place.
glTranslated(x,y,0);
//Set the font colors.
if(font_color==COLOR_BLACK){
glColor4d(0.0,0.0,0.0,opacity);
}
else if(font_color==COLOR_GRAY){
glColor4d(0.5,0.5,0.5,opacity);
}
else if(font_color==COLOR_WHITE){
glColor4d(1.0,1.0,1.0,opacity);
}
else if(font_color==COLOR_BROWN){
glColor4d(0.588235,0.294117,0.0,opacity);
}
else if(font_color==COLOR_DARK_BROWN){
glColor4d(0.435294,0.207843,0.101960,opacity);
}
else if(font_color==COLOR_LIGHT_BROWN){
glColor4d(0.803921,0.498039,0.196078,opacity);
}
else if(font_color==COLOR_SAND){
//glColor4d(0.956862,0.761994,0.376470,opacity);
glColor4d(0.908001,0.850002,0.704004,opacity);
}
else if(font_color==COLOR_YELLOW){
glColor4d(1.0,1.0,0.0,opacity);
}
else if(font_color==COLOR_SYSTEM){
glColor4d(1.0,0.847058,0.0,opacity);
}
else if(font_color==COLOR_GOLD){
glColor4d(0.831372,0.686274,0.215686,opacity);
}
else if(font_color==COLOR_ORANGE){
glColor4d(1.0,0.623529,0.0,opacity);
}
else if(font_color==COLOR_PUMPKIN){
glColor4d(1.0,0.458823,0.094117,opacity);
}
else if(font_color==COLOR_RED){
glColor4d(1.0,0.0,0.0,opacity);
}
else if(font_color==COLOR_DARK_RED){
glColor4d(0.807843,0.086274,0.125490,opacity);
}
else if(font_color==COLOR_FLAME){
glColor4d(0.886274,0.345098,0.133333,opacity);
}
else if(font_color==COLOR_PINK){
glColor4d(1.0,0.752941,0.796078,opacity);
}
else if(font_color==COLOR_ROSE){
glColor4d(1.0,0.0,0.498039,opacity);
}
else if(font_color==COLOR_SHOCKING_PINK){
glColor4d(0.988235,0.058823,0.752941,opacity);
}
else if(font_color==COLOR_PURPLE){
glColor4d(0.5,0.0,0.5,opacity);
}
else if(font_color==COLOR_VIOLET){
glColor4d(0.545,0.0,1.0,opacity);
}
else if(font_color==COLOR_INDIGO){
glColor4d(0.435,0.0,1.0,opacity);
}
else if(font_color==COLOR_BLUE){
glColor4d(0.0,0.0,1.0,opacity);
}
else if(font_color==COLOR_SKY_BLUE){
glColor4d(0.324999,0.754994,0.913001,opacity);
}
else if(font_color==COLOR_UN_BLUE){
glColor4d(0.356862,0.572549,0.898039,opacity);
}
else if(font_color==COLOR_GREEN){
glColor4d(0.0,1.0,0.0,opacity);
}
else if(font_color==COLOR_JUNGLE){
glColor4d(0.160784,0.670588,0.529411,opacity);
}
else if(font_color==COLOR_SPRING){
glColor4d(0.0,1.0,0.498039,opacity);
}
else if(font_color==COLOR_DIRT){
glColor4d(0.705882,0.635294,0.431372,opacity);
}
else if(font_color==COLOR_WATER_TROPICAL_SHALLOW){
glColor4d(0.098039,0.776470,0.992156,opacity);
}
else if(font_color==COLOR_WATER_TROPICAL_DEEP){
glColor4d(0.117647,0.501960,0.886274,opacity);
}
//Start quad.
glBegin(GL_QUADS);
//Apply the texture to the screen:
//Bottom left corner.
glTexCoord2d((texture_clip->x)/w,(texture_clip->y+texture_clip->h)/h);
//Bottom left corner.
glVertex3d(0,texture_clip->h,0);
//Bottom right corner.
glTexCoord2d((texture_clip->x+texture_clip->w)/w,(texture_clip->y+texture_clip->h)/h);
//Bottom right corner.
glVertex3d(texture_clip->w,texture_clip->h,0);
//Top right corner.
glTexCoord2d((texture_clip->x+texture_clip->w)/w,(texture_clip->y)/h);
//Top right corner.
glVertex3d(texture_clip->w,0,0);
//Top left corner.
glTexCoord2d((texture_clip->x)/w,(texture_clip->y)/h);
//Top left corner.
glVertex3d(0,0,0);
//End quad.
glEnd();
//Reset.
glLoadIdentity();
}
| 27.384615 | 131 | 0.663696 | darkoppressor |
aafccea20f3d3ed3259de1bdc59dfce3e7078bba | 2,041 | cpp | C++ | test/test_ekf.cpp | Amit10311/robot_localization | 7a2219c0579cfcad27fb59f1a7650bdc26f8ff72 | [
"BSD-3-Clause"
] | null | null | null | test/test_ekf.cpp | Amit10311/robot_localization | 7a2219c0579cfcad27fb59f1a7650bdc26f8ff72 | [
"BSD-3-Clause"
] | null | null | null | test/test_ekf.cpp | Amit10311/robot_localization | 7a2219c0579cfcad27fb59f1a7650bdc26f8ff72 | [
"BSD-3-Clause"
] | null | null | null | #include "robot_localization/ekf.h"
#include <gtest/gtest.h>
TEST (EkfTest, Measurements)
{
RobotLocalization::Ekf ekf;
Eigen::VectorXd measurement(12);
for(size_t i = 0; i < 12; ++i)
{
measurement[i] = i;
}
Eigen::MatrixXd measurementCovariance(12, 12);
for(size_t i = 0; i < 12; ++i)
{
measurementCovariance(i, i) = 0.5;
}
std::vector<int> updateVector(12, true);
// Ensure that measurements are being placed in the queue correctly
ekf.enqueueMeasurement("odom0",
measurement,
measurementCovariance,
updateVector,
1000);
std::map<std::string, Eigen::VectorXd> postUpdateStates;
ekf.integrateMeasurements(1001,
postUpdateStates);
EXPECT_EQ(ekf.getState(), measurement);
EXPECT_EQ(ekf.getEstimateErrorCovariance(), measurementCovariance);
// Now fuse another measurement and check the output.
// We know what the filter's state should be when
// this is complete, so we'll check the difference and
// make sure it's suitably small.
Eigen::VectorXd measurement2 = measurement;
measurement2 *= 2.0;
ekf.enqueueMeasurement("odom0",
measurement,
measurementCovariance,
updateVector,
1002);
ekf.integrateMeasurements(1003,
postUpdateStates);
measurement[0] = -2.8975;
measurement[1] = -0.42068;
measurement[2] = 5.5751;
measurement[3] = 2.7582;
measurement[4] = -2.0858;
measurement[5] = -2.0859;
measurement[6] = 3.7596;
measurement[7] = 4.3694;
measurement[8] = 5.1206;
measurement[9] = 9.2408;
measurement[10] = 9.8034;
measurement[11] = 11.796;
measurement = measurement.eval() - ekf.getState();
for(size_t i = 0; i < 12; ++i)
{
EXPECT_LT(::fabs(measurement[i]), 0.001);
}
}
int main(int argc, char **argv)
{
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
| 25.197531 | 69 | 0.603626 | Amit10311 |
c903f80e9487e23ffb635ef1feb8fe82732a6364 | 34,819 | cpp | C++ | src/ogeScript.cpp | suxinde2009/oge2d | 8386762bed546db083f77736e7da0010cdd0082b | [
"MIT"
] | null | null | null | src/ogeScript.cpp | suxinde2009/oge2d | 8386762bed546db083f77736e7da0010cdd0082b | [
"MIT"
] | null | null | null | src/ogeScript.cpp | suxinde2009/oge2d | 8386762bed546db083f77736e7da0010cdd0082b | [
"MIT"
] | null | null | null | /*
-----------------------------------------------------------------------------
This source file is part of Open Game Engine 2D.
It is licensed under the terms of the MIT license.
For the latest info, see http://oge2d.sourceforge.net
Copyright (c) 2010-2012 Lin Jia Jun (Joe Lam)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#include "ogeScript.h"
#include "ogeCommon.h"
#include "scriptarray.h"
#include "scriptstdstring.h"
//#include "scriptstring.h"
#include "scriptmath.h"
#include "scriptfile.h"
#include "scriptdictionary.h"
#include "SDL.h"
#include <iostream>
#include <sstream>
#define _OGE_DEBUG_NOP_ 0
#define _OGE_DEBUG_ADD_BP_ 1
#define _OGE_DEBUG_DEL_BP_ 2
#define _OGE_DEBUG_NEXT_INST_ 3
#define _OGE_DEBUG_NEXT_LINE_ 4
#define _OGE_DEBUG_CONTINUE_ 5
#define _OGE_DEBUG_STOP_ 6
static int g_debugcmd = 0; // 0: no action
static asIScriptContext* g_suspendedctx = NULL;
static CogeScripter* g_scripter = NULL;
static CogeScript* g_currentscript = NULL;
static CogeBreakpoint g_breakpoints[_OGE_MAX_BP_COUNT_];
void OGE_ScriptMessageCallback(const asSMessageInfo *msg, void *param)
{
const char *type = "ERR ";
if( msg->type == asMSGTYPE_WARNING )
type = "WARN";
else if( msg->type == asMSGTYPE_INFORMATION )
type = "INFO";
OGE_Log("%s (%d, %d) : %s : %s\n", msg->section, msg->row, msg->col, type, msg->message);
}
void OGE_ScriptLineCallback(asIScriptContext* ctx, void* obj)
{
if(ctx == NULL || g_scripter == NULL) return;
int iDebugMode = g_scripter->GetDebugMode();
if(iDebugMode <= 0) return;
if(iDebugMode == Debug_Local)
{
g_scripter->GetScriptDebugger()->LineCallback(ctx);
}
else if(iDebugMode == Debug_Remote)
{
if(g_debugcmd == _OGE_DEBUG_NEXT_INST_ || g_debugcmd == _OGE_DEBUG_NEXT_LINE_)
{
g_debugcmd = _OGE_DEBUG_NOP_;
g_suspendedctx = ctx;
ctx->Suspend();
return;
}
asIScriptEngine* engine = ctx->GetEngine();
if(!engine) return;
//int funcid = ctx->GetCurrentFunction();
//asIScriptFunction* func = engine->GetFunctionDescriptorById(funcid);
asIScriptFunction* func = ctx->GetFunction();
if(!func) return;
const char* scriptFileName = func->GetScriptSectionName();
//int lineNumber = ctx->GetCurrentLineNumber();
int lineNumber = ctx->GetLineNumber();
for(int i=0; i<_OGE_MAX_BP_COUNT_; i++)
{
if(g_breakpoints[i].used == false) continue;
if(g_breakpoints[i].line == lineNumber)
{
if(g_breakpoints[i].filename.compare(scriptFileName) == 0)
{
g_debugcmd = _OGE_DEBUG_NOP_;
g_suspendedctx = ctx;
ctx->Suspend();
return;
}
}
}
}
}
/*------------------ CogeScriptBinaryStream ------------------*/
CogeScriptBinaryStream::CogeScriptBinaryStream()
{
Clear();
}
CogeScriptBinaryStream::~CogeScriptBinaryStream()
{
Clear();
}
void CogeScriptBinaryStream::SetReadBuffer(char* pReadBuffer, int iReadBufSize)
{
m_pReadBuffer = pReadBuffer;
m_iReadBufSize = iReadBufSize;
m_iReadPos = 0;
}
void CogeScriptBinaryStream::SetWriteBuffer(char* pWriteBuffer, int iWriteBufSize)
{
m_pWriteBuffer = pWriteBuffer;
m_iWriteBufSize = iWriteBufSize;
m_iWritePos = 0;
}
void CogeScriptBinaryStream::Clear()
{
m_pReadBuffer = NULL;
m_pWriteBuffer = NULL;
m_iReadBufSize = 0;
m_iWriteBufSize = 0;
m_iReadPos = 0;
m_iWritePos = 0;
}
int CogeScriptBinaryStream::GetReadSize()
{
return m_iReadPos;
}
int CogeScriptBinaryStream::GetWriteSize()
{
return m_iWritePos;
}
void CogeScriptBinaryStream::Read(void *ptr, asUINT size)
{
if(m_pReadBuffer == NULL || m_iReadBufSize <= 0) return;
char* pBuf = m_pReadBuffer + m_iReadPos;
memcpy(ptr, pBuf, size);
m_iReadPos += size;
}
void CogeScriptBinaryStream::Write(const void *ptr, asUINT size)
{
if(m_pWriteBuffer == NULL || m_iWriteBufSize <= 0) return;
char* pBuf = m_pWriteBuffer + m_iWritePos;
memcpy(pBuf, ptr, size);
m_iWritePos += size;
}
/*------------------ CogeScriptDebugger ------------------*/
void CogeScriptDebugger::Output(const std::string &str)
{
std::string sText = str;
if(sText.length() == 0) return;
if(sText[sText.length() - 1] != '\n') sText = sText + "\n";
sText = "[OGE_DBG]" + sText;
CDebugger::Output(sText);
std::cout.flush();
}
std::string CogeScriptDebugger::ToString(void *value, asUINT typeId, bool expandMembers, bool isString, asIScriptEngine *engine)
{
if(!isString) return CDebugger::ToString(value, typeId, expandMembers, engine);
else
{
if( typeId & asTYPEID_OBJHANDLE )
{
value = *(void**)value;
return CDebugger::ToString(value, typeId, expandMembers, engine);
}
else
{
std::string sValue = *(std::string*)value;
return sValue;
}
}
}
void CogeScriptDebugger::ListLocalVariables(asIScriptContext *ctx)
{
asIScriptFunction *func = ctx->GetFunction();
if( !func ) return;
std::stringstream s;
for( asUINT n = 0; n < func->GetVarCount(); n++ )
{
if( ctx->IsVarInScope(n) )
{
bool bIsStrType = false;
std::string sDefine = func->GetVarDecl(n);
if(sDefine.find("string ") != std::string::npos) bIsStrType = true;
else if(sDefine.find("string&") != std::string::npos) bIsStrType = true;
if(bIsStrType)
s << sDefine << " = " << ToString(ctx->GetAddressOfVar(n), ctx->GetVarTypeId(n), false, bIsStrType, ctx->GetEngine()) << std::endl;
else
s << sDefine << " = " << CDebugger::ToString(ctx->GetAddressOfVar(n), ctx->GetVarTypeId(n), false, ctx->GetEngine()) << std::endl;
//s << func->GetVarDecl(n) << " = " << ToString(ctx->GetAddressOfVar(n), ctx->GetVarTypeId(n), false, ctx->GetEngine()) << endl;
}
}
Output(s.str());
}
void CogeScriptDebugger::ListGlobalVariables(asIScriptContext *ctx)
{
// Determine the current module from the function
asIScriptFunction *func = ctx->GetFunction();
if( !func ) return;
asIScriptModule *mod = ctx->GetEngine()->GetModule(func->GetModuleName(), asGM_ONLY_IF_EXISTS);
if( !mod ) return;
std::stringstream s;
for( asUINT n = 0; n < mod->GetGlobalVarCount(); n++ )
{
int typeId;
const char *varName = 0, *nameSpace = 0;
mod->GetGlobalVar(n, &varName, &nameSpace, &typeId);
bool bIsStrType = false;
std::string sDefine = mod->GetGlobalVarDeclaration(n);
if(sDefine.find("string ") != std::string::npos) bIsStrType = true;
if(bIsStrType)
s << sDefine << " = " << ToString(mod->GetAddressOfGlobalVar(n), typeId, false, bIsStrType, ctx->GetEngine()) << std::endl;
else
s << sDefine << " = " << CDebugger::ToString(mod->GetAddressOfGlobalVar(n), typeId, false, ctx->GetEngine()) << std::endl;
//s << mod->GetGlobalVarDeclaration(n) << " = " << ToString(mod->GetAddressOfGlobalVar(n), typeId, false, ctx->GetEngine()) << endl;
}
Output(s.str());
}
/*------------------ CogeScripter ------------------*/
CogeScripter::CogeScripter()
:m_pScriptEngine(NULL)
,m_pScriptBuilder(NULL)
,m_pScriptDebugger(NULL)
{
m_iState = -1;
m_iNextId = 0;
m_iDebugMode = 0; // no debug ...
g_currentscript = NULL;
m_iBinaryMode = 0; // default text code input
m_pOnCheckDebugRequest = NULL;
for(int i=0; i<_OGE_MAX_BP_COUNT_; i++) g_breakpoints[i].used = false;
m_pScriptEngine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
if(m_pScriptEngine)
{
m_pScriptEngine->SetEngineProperty(asEP_SCRIPT_SCANNER, 0); // the script file is not strict with unicode input ...
m_pScriptEngine->SetMessageCallback(asFUNCTION(OGE_ScriptMessageCallback), 0, asCALL_CDECL);
RegisterScriptArray(m_pScriptEngine, true);
//RegisterScriptString(m_pScriptEngine);
RegisterStdString(m_pScriptEngine);
RegisterStdStringUtils(m_pScriptEngine);
RegisterScriptMath(m_pScriptEngine);
RegisterScriptFile(m_pScriptEngine);
RegisterScriptDictionary(m_pScriptEngine);
//RegisterScriptByteArray(m_pScriptEngine);
m_pScriptBuilder = new CScriptBuilder();
//m_pScriptDebugger = new CDebugger();
m_pScriptDebugger = new CogeScriptDebugger();
m_iState = 0;
}
if(m_iState >= 0) g_scripter = this;
else g_scripter = NULL;
}
CogeScripter::~CogeScripter()
{
g_scripter = NULL;
m_iState = -1;
m_iDebugMode = 0; // no debug ...
g_currentscript = NULL;
m_iBinaryMode = 0;
DelAllScripts();
if(m_pScriptBuilder) delete m_pScriptBuilder;
if(m_pScriptDebugger) delete m_pScriptDebugger;
if(m_pScriptEngine) m_pScriptEngine->Release();
}
int CogeScripter::SetDebugMode(int value)
{
if(m_iState < 0) return m_iState;
if(value < 0) m_iDebugMode = 0;
else m_iDebugMode = value;
if(m_iDebugMode > 0)
{
ogeScriptMap::iterator it;
CogeScript* pMatchedScript = NULL;
it = m_ScriptMap.begin();
while (it != m_ScriptMap.end())
{
pMatchedScript = it->second;
pMatchedScript->SetDebugMode(value);
it++;
}
ogeScriptList::iterator itx;
itx = m_ScriptList.begin();
while (itx != m_ScriptList.end())
{
pMatchedScript = *itx;
pMatchedScript->SetDebugMode(value);
itx++;
}
}
return m_iDebugMode;
}
int CogeScripter::GetDebugMode()
{
return m_iDebugMode;
}
int CogeScripter::SetBinaryMode(int value)
{
if(m_iBinaryMode != value)
{
m_iBinaryMode = value;
}
return m_iBinaryMode;
}
int CogeScripter::GetBinaryMode()
{
return m_iBinaryMode;
}
bool CogeScripter::IsSuspended()
{
return g_suspendedctx != NULL;
}
CogeScript* CogeScripter::NewSingleScript(const std::string& sScriptName, const std::string& sFileName)
{
if(!m_pScriptEngine) return NULL;
//CogeScript* pTheNewScript = NULL;
/*
ogeScriptMap::iterator it;
it = m_ScriptMap.find(sScriptName);
if (it != m_ScriptMap.end())
{
OGE_Log("The script name '%s' is in use.\n", sScriptName.c_str());
return NULL;
}
*/
int r = -1;
r = m_pScriptBuilder->StartNewModule(m_pScriptEngine, sScriptName.c_str());
if( r < 0 )
{
OGE_Log("Failed to create a new script module: %s\n", sScriptName.c_str());
return NULL;
}
r = m_pScriptBuilder->AddSectionFromFile(sFileName.c_str());
if( r < 0 )
{
OGE_Log("Failed to load script from file: %s\n", sFileName.c_str());
m_pScriptEngine->DiscardModule(sScriptName.c_str());
return NULL;
}
r = m_pScriptBuilder->BuildModule();
if( r < 0 )
{
OGE_Log("Failed to build script module: %s\n", sScriptName.c_str());
m_pScriptEngine->DiscardModule(sScriptName.c_str());
return NULL;
}
// if load script successfully then prepare the Script class ...
CogeScript* pTheNewScript = new CogeScript(sScriptName, this);
if (pTheNewScript->m_iState < 0)
{
m_pScriptEngine->DiscardModule(sScriptName.c_str());
delete pTheNewScript;
return NULL;
}
//m_ScriptMap.insert(ogeScriptMap::value_type(sScriptName, pTheNewScript));
return pTheNewScript;
}
CogeScript* CogeScripter::NewSingleScriptFromBuffer(const std::string& sScriptName, char* pInputBuffer, int iBufferSize)
{
if(!m_pScriptEngine) return NULL;
bool bIsBinary = m_iBinaryMode > 0;
//CogeScript* pTheNewScript = NULL;
/*
ogeScriptMap::iterator it;
it = m_ScriptMap.find(sScriptName);
if (it != m_ScriptMap.end())
{
OGE_Log("The script name '%s' is in use.\n", sScriptName.c_str());
return NULL;
}
*/
if(bIsBinary)
{
asIScriptModule* pModule = m_pScriptEngine->GetModule(sScriptName.c_str(), asGM_ALWAYS_CREATE);
if(pModule == NULL)
{
OGE_Log("Failed to create an empty new script module: %s\n", sScriptName.c_str());
return NULL;
}
}
else
{
int r = m_pScriptBuilder->StartNewModule(m_pScriptEngine, sScriptName.c_str());
if( r < 0 )
{
OGE_Log("Failed to create a new script module: %s\n", sScriptName.c_str());
return NULL;
}
}
CogeScript* pTheNewScript = new CogeScript(sScriptName, this);
if (pTheNewScript->m_iState < 0)
{
m_pScriptEngine->DiscardModule(sScriptName.c_str());
delete pTheNewScript;
return NULL;
}
if(bIsBinary)
{
int iRealReadSize = pTheNewScript->LoadBinaryCode(pInputBuffer, iBufferSize);
if(iRealReadSize < 0)
{
m_pScriptEngine->DiscardModule(sScriptName.c_str());
delete pTheNewScript;
return NULL;
}
}
else
{
// ensure the input buffer is like a valid string ...
pInputBuffer[iBufferSize] = '\0';
// the char buffer must be full text code without any #include ...
//std::string sSectionName = sScriptName + "_FullTextSection";
std::string sSectionName = sScriptName + "_FTS";
int r = m_pScriptBuilder->AddSectionFromMemory(pInputBuffer, sSectionName.c_str());
if( r < 0 )
{
OGE_Log("Failed to load script from buffer: %s\n", sSectionName.c_str());
m_pScriptEngine->DiscardModule(sScriptName.c_str());
delete pTheNewScript;
return NULL;
}
r = m_pScriptBuilder->BuildModule();
if( r < 0 )
{
OGE_Log("Failed to build script module: %s\n", sScriptName.c_str());
m_pScriptEngine->DiscardModule(sScriptName.c_str());
delete pTheNewScript;
return NULL;
}
}
//m_ScriptMap.insert(ogeScriptMap::value_type(sScriptName, pTheNewScript));
return pTheNewScript;
}
CogeScript* CogeScripter::NewFixedScript(const std::string& sFileName)
{
//std::string sScriptName = "_" + OGE_itoa(m_ScriptList.size());
std::string sScriptName = "_" + OGE_itoa(GetNextScriptId());
CogeScript* pTheNewScript = NewSingleScript(sScriptName, sFileName);
if(pTheNewScript == NULL) return NULL;
m_ScriptList.push_back(pTheNewScript);
return pTheNewScript;
}
CogeScript* CogeScripter::NewFixedScriptFromBuffer(char* pInputBuffer, int iBufferSize)
{
//std::string sScriptName = "_" + OGE_itoa(m_ScriptList.size());
std::string sScriptName = "_" + OGE_itoa(GetNextScriptId());
CogeScript* pTheNewScript = NewSingleScriptFromBuffer(sScriptName, pInputBuffer, iBufferSize);
if(pTheNewScript == NULL) return NULL;
m_ScriptList.push_back(pTheNewScript);
return pTheNewScript;
}
CogeScript* CogeScripter::NewScript(const std::string& sScriptName, const std::string& sFileName)
{
ogeScriptMap::iterator it;
it = m_ScriptMap.find(sScriptName);
if (it != m_ScriptMap.end())
{
OGE_Log("The script name '%s' is in use.\n", sScriptName.c_str());
return NULL;
}
CogeScript* pTheNewScript = NewSingleScript(sScriptName, sFileName);
if(pTheNewScript == NULL) return NULL;
m_ScriptMap.insert(ogeScriptMap::value_type(sScriptName, pTheNewScript));
return pTheNewScript;
}
CogeScript* CogeScripter::NewScriptFromBuffer(const std::string& sScriptName, char* pInputBuffer, int iBufferSize)
{
ogeScriptMap::iterator it;
it = m_ScriptMap.find(sScriptName);
if (it != m_ScriptMap.end())
{
OGE_Log("The script name '%s' is in use.\n", sScriptName.c_str());
return NULL;
}
CogeScript* pTheNewScript = NewSingleScriptFromBuffer(sScriptName, pInputBuffer, iBufferSize);
if(pTheNewScript == NULL) return NULL;
m_ScriptMap.insert(ogeScriptMap::value_type(sScriptName, pTheNewScript));
return pTheNewScript;
}
int CogeScripter::SaveBinaryCode(const std::string& sScriptName, char* pOutputBuffer, int iBufferSize)
{
CogeScript* pScript = FindScript(sScriptName);
if(pScript && pScript->GetState() >= 0) return pScript->SaveBinaryCode(pOutputBuffer, iBufferSize);
else return 0;
}
CogeScript* CogeScripter::FindScript(const std::string& sScriptName)
{
ogeScriptMap::iterator it;
it = m_ScriptMap.find(sScriptName);
if (it != m_ScriptMap.end()) return it->second;
else return NULL;
}
CogeScript* CogeScripter::GetScript(const std::string& sScriptName, const std::string& sFileName)
{
CogeScript* pMatchedScript = FindScript(sScriptName);
if (!pMatchedScript) pMatchedScript = NewScript(sScriptName, sFileName);
//if (pMatchedScript) pMatchedScript->Hire();
return pMatchedScript;
}
CogeScript* CogeScripter::GetScriptFromBuffer(const std::string& sScriptName, char* pInputBuffer, int iBufferSize)
{
CogeScript* pMatchedScript = FindScript(sScriptName);
if (!pMatchedScript) pMatchedScript = NewScriptFromBuffer(sScriptName, pInputBuffer, iBufferSize);
return pMatchedScript;
}
CogeScript* CogeScripter::GetCurrentScript()
{
return g_currentscript;
}
CScriptBuilder* CogeScripter::GetScriptBuilder()
{
return m_pScriptBuilder;
}
CDebugger* CogeScripter::GetScriptDebugger()
{
return m_pScriptDebugger;
}
void CogeScripter::AddBreakPoint(const std::string& sFileName, int iLineNumber)
{
if(m_pScriptDebugger) m_pScriptDebugger->AddFileBreakPoint(sFileName, iLineNumber);
}
int CogeScripter::HandleDebugRequest(int iSize, char* pInBuf, char* pOutBuf)
{
if(m_iDebugMode != Debug_Remote) return 0;
int iCmd = OGE_BufGetInt(pInBuf, 0);
switch(iCmd)
{
case _OGE_DEBUG_NOP_:
{
g_debugcmd = _OGE_DEBUG_NOP_;
break;
}
case _OGE_DEBUG_ADD_BP_:
{
g_debugcmd = _OGE_DEBUG_NOP_;
int iFreeIdx = -1;
for(int i=0; i<_OGE_MAX_BP_COUNT_; i++)
{
if(g_breakpoints[i].used == false)
{
iFreeIdx = i;
break;
}
}
if(iFreeIdx >= 0)
{
g_breakpoints[iFreeIdx].line = OGE_BufGetInt(pInBuf, 4);
int iFileNameSize = OGE_BufGetInt(pInBuf, 8);
g_breakpoints[iFreeIdx].filename = OGE_BufGetStr(pInBuf, 12, iFileNameSize);
g_breakpoints[iFreeIdx].used = true;
}
break;
}
case _OGE_DEBUG_DEL_BP_:
{
g_debugcmd = _OGE_DEBUG_NOP_;
int iDelIdx = OGE_BufGetInt(pInBuf, 4);
if(iDelIdx >= 0 && iDelIdx < _OGE_MAX_BP_COUNT_)
{
g_breakpoints[iDelIdx].used = false;
}
break;
}
case _OGE_DEBUG_NEXT_INST_:
{
g_debugcmd = _OGE_DEBUG_NEXT_INST_;
break;
}
case _OGE_DEBUG_NEXT_LINE_:
{
g_debugcmd = _OGE_DEBUG_NEXT_LINE_;
break;
}
case _OGE_DEBUG_CONTINUE_:
{
g_debugcmd = _OGE_DEBUG_CONTINUE_;
break;
}
case _OGE_DEBUG_STOP_: break;
}
return 0;
}
int CogeScripter::DelScript(const std::string& sScriptName)
{
CogeScript* pMatchedScript = FindScript(sScriptName);
if (pMatchedScript)
{
//pMatchedScript->Fire();
if (pMatchedScript->m_iTotalUsers > 0) return 0;
m_ScriptMap.erase(sScriptName);
delete pMatchedScript;
return 1;
}
return -1;
}
int CogeScripter::DelScript(CogeScript* pScript)
{
if(!pScript) return 0;
bool bFound = false;
if(!bFound)
{
ogeScriptMap::iterator it;
CogeScript* pMatchedScript = NULL;
it = m_ScriptMap.begin();
while (it != m_ScriptMap.end())
{
pMatchedScript = it->second;
if(pMatchedScript == pScript)
{
bFound = true;
break;
}
it++;
}
if(bFound)
{
m_ScriptMap.erase(it);
if(pMatchedScript) delete pMatchedScript;
}
}
if(!bFound)
{
ogeScriptList::iterator itx;
CogeScript* pMatchedScript = NULL;
itx = m_ScriptList.begin();
while (itx != m_ScriptList.end())
{
pMatchedScript = *itx;
if(pMatchedScript == pScript)
{
bFound = true;
break;
}
itx++;
}
if(bFound)
{
m_ScriptList.erase(itx);
if(pMatchedScript) delete pMatchedScript;
}
}
if(bFound) return 1;
else return 0;
}
void CogeScripter::DelAllScripts()
{
// free all Scripts
ogeScriptMap::iterator it;
CogeScript* pMatchedScript = NULL;
it = m_ScriptMap.begin();
while (it != m_ScriptMap.end())
{
pMatchedScript = it->second;
m_ScriptMap.erase(it);
delete pMatchedScript;
it = m_ScriptMap.begin();
}
ogeScriptList::iterator itx;
pMatchedScript = NULL;
itx = m_ScriptList.begin();
while (itx != m_ScriptList.end())
{
pMatchedScript = *itx;
m_ScriptList.erase(itx);
delete pMatchedScript;
itx = m_ScriptList.begin();
}
}
int CogeScripter::GetState()
{
return m_iState;
}
int CogeScripter::GetNextScriptId()
{
m_iNextId++;
return m_iNextId;
}
void CogeScripter::RegisterCheckDebugRequestFunction(void* pOnCheckDebugRequest)
{
m_pOnCheckDebugRequest = pOnCheckDebugRequest;
}
int CogeScripter::RegisterFunction(void* f, const char* fname)
{
if(!m_pScriptEngine) return -1;
return m_pScriptEngine->RegisterGlobalFunction(fname, asFUNCTION(f), asCALL_CDECL);
}
int CogeScripter::RegisterTypedef(const std::string& newtype, const std::string& newdef)
{
if(!m_pScriptEngine) return -1;
return m_pScriptEngine->RegisterTypedef(newtype.c_str(), newdef.c_str());
}
int CogeScripter::RegisterEnum(const std::string& enumtype)
{
if(!m_pScriptEngine) return -1;
return m_pScriptEngine->RegisterEnum(enumtype.c_str());
}
int CogeScripter::RegisterEnumValue(const std::string& enumtype, const std::string& name, int value)
{
if(!m_pScriptEngine) return -1;
return m_pScriptEngine->RegisterEnumValue(enumtype.c_str(), name.c_str(), value);
}
int CogeScripter::BeginConfigGroup(const std::string& groupname)
{
if(!m_pScriptEngine) return -1;
return m_pScriptEngine->BeginConfigGroup(groupname.c_str());
}
int CogeScripter::EndConfigGroup()
{
if(!m_pScriptEngine) return -1;
return m_pScriptEngine->EndConfigGroup();
}
int CogeScripter::RemoveConfigGroup(const std::string& groupname)
{
if(!m_pScriptEngine) return -1;
return m_pScriptEngine->RemoveConfigGroup(groupname.c_str());
}
int CogeScripter::GC(int iFlags)
{
if(!m_pScriptEngine) return -1;
if(iFlags == 0) iFlags = asGC_FULL_CYCLE | asGC_DESTROY_GARBAGE;
return m_pScriptEngine->GarbageCollect(iFlags);
}
/*------------------ CogeScript ------------------*/
CogeScript::CogeScript(const std::string& sName, CogeScripter* pScripter)
{
m_iResult = 0;
m_iDebugMode = 0; // no debug ...
m_iTotalUsers = 0;
m_iState = -1;
m_pBinStream = new CogeScriptBinaryStream();
m_pScripter = pScripter;
if(!m_pScripter) return;
if(m_pScripter->m_pScriptEngine == NULL) return;
m_pScriptModule = pScripter->m_pScriptEngine->GetModule(sName.c_str());
if(!m_pScriptModule) return;
m_pContext = NULL;
m_sName = sName;
m_pContext = m_pScripter->m_pScriptEngine->CreateContext();
if(!m_pContext) return;
if(m_pScripter->m_iDebugMode > 0)
m_pContext->SetLineCallback(asFUNCTION(OGE_ScriptLineCallback), &m_iResult, asCALL_CDECL);
m_iState = 0;
}
CogeScript::~CogeScript()
{
m_iState = -1;
if(m_pBinStream)
{
delete m_pBinStream;
m_pBinStream = NULL;
}
if(m_pContext)
{
switch(m_pContext->GetState())
{
case asEXECUTION_SUSPENDED:
case asEXECUTION_ACTIVE:
m_pContext->Abort();
break;
case asEXECUTION_PREPARED:
case asEXECUTION_ERROR:
m_pContext->Unprepare();
break;
case asEXECUTION_FINISHED:
case asEXECUTION_ABORTED:
case asEXECUTION_EXCEPTION:
case asEXECUTION_UNINITIALIZED:
break;
}
m_pContext->Release();
}
if(m_pScriptModule)
{
if(m_pScripter && m_pScripter->m_pScriptEngine)
{
m_pScripter->m_pScriptEngine->DiscardModule(m_sName.c_str());
m_pScriptModule = NULL;
}
}
}
int CogeScript::GetState()
{
return m_iState;
}
const std::string& CogeScript::GetName()
{
return m_sName;
}
int CogeScript::GetFunctionCount()
{
if(m_iState < 0 || m_pScriptModule == NULL) return 0;
return m_pScriptModule->GetFunctionCount();
}
std::string CogeScript::GetFunctionNameByIndex(int idx)
{
if(m_iState < 0 || m_pScriptModule == NULL) return "";
//asIScriptFunction* pDescr = m_pScriptModule->GetFunctionDescriptorByIndex(idx);
asIScriptFunction* pFunc = m_pScriptModule->GetFunctionByIndex(idx);
if(pFunc == NULL) return "";
return pFunc->GetName();
}
int CogeScript::GetVarCount()
{
if(m_iState < 0 || m_pScriptModule == NULL) return 0;
return m_pScriptModule->GetGlobalVarCount();
}
std::string CogeScript::GetVarNameByIndex(int idx)
{
if(m_iState < 0 || m_pScriptModule == NULL) return "";
//return m_pScriptModule->GetGlobalVarName(idx);
return m_pScriptModule->GetGlobalVarDeclaration(idx);
}
int CogeScript::LoadBinaryCode(char* pInputBuf, int iBufferSize)
{
int iLoadedSize = -1;
if(pInputBuf && iBufferSize > 0 && m_iState >= 0)
{
if(m_pScriptModule)
{
m_pBinStream->SetReadBuffer(pInputBuf, iBufferSize);
m_pScriptModule->LoadByteCode(m_pBinStream);
iLoadedSize = m_pBinStream->GetReadSize();
m_pBinStream->Clear();
}
}
return iLoadedSize;
}
int CogeScript::SaveBinaryCode(char* pOutputBuf, int iBufferSize)
{
int iSavedSize = -1;
if(pOutputBuf && iBufferSize > 0 && m_iState >= 0)
{
if(m_pScriptModule)
{
m_pBinStream->SetWriteBuffer(pOutputBuf, iBufferSize);
m_pScriptModule->SaveByteCode(m_pBinStream);
iSavedSize = m_pBinStream->GetWriteSize();
m_pBinStream->Clear();
}
}
return iSavedSize;
}
int CogeScript::SetDebugMode(int value)
{
if(value < 0) m_iDebugMode = 0;
else m_iDebugMode = value;
if(m_iDebugMode > 0)
{
m_pContext->SetLineCallback(asFUNCTION(OGE_ScriptLineCallback), &m_iResult, asCALL_CDECL);
}
return m_iDebugMode;
}
int CogeScript::GetDebugMode()
{
if(m_pScripter) return m_pScripter->m_iDebugMode;
else return this->m_iDebugMode;
}
int CogeScript::GetRuntimeState()
{
//if(!m_pContext) return -1;
if(m_iState < 0) return -1;
return m_pContext->GetState();
}
bool CogeScript::IsSuspended()
{
if(m_iState < 0) return false;
return m_pContext->GetState() == asEXECUTION_SUSPENDED;
}
bool CogeScript::IsFinished()
{
if(m_iState < 0) return true;
return m_pContext->GetState() == asEXECUTION_FINISHED;
}
void CogeScript::Fire()
{
m_iTotalUsers--;
if (m_iTotalUsers < 0) m_iTotalUsers = 0;
}
void CogeScript::Hire()
{
if (m_iTotalUsers < 0) m_iTotalUsers = 0;
m_iTotalUsers++;
}
int CogeScript::Pause()
{
if(m_iState < 0) return -1;
return m_pContext->Suspend();
}
int CogeScript::Resume()
{
if(m_iState < 0) return -1;
if(m_pContext->GetState() != asEXECUTION_SUSPENDED) return -1;
g_currentscript = this;
return m_pContext->Execute();
}
int CogeScript::Execute()
{
if(m_iState < 0) return -1;
g_currentscript = this;
return m_pContext->Execute();
}
int CogeScript::Stop()
{
//if(!m_pContext) return -1;
if(m_iState < 0) return -1;
int iRsl = -1;
switch(m_pContext->GetState())
{
case asEXECUTION_SUSPENDED:
case asEXECUTION_ACTIVE:
m_pContext->Abort();
iRsl = 2;
break;
case asEXECUTION_PREPARED:
case asEXECUTION_ERROR:
m_pContext->Unprepare();
iRsl = 1;
break;
case asEXECUTION_FINISHED:
case asEXECUTION_ABORTED:
case asEXECUTION_EXCEPTION:
case asEXECUTION_UNINITIALIZED:
iRsl = 0;
break;
}
return iRsl;
}
int CogeScript::Reset()
{
if(m_iState < 0) return -1;
int iRsl = -1;
switch(m_pContext->GetState())
{
case asEXECUTION_SUSPENDED:
case asEXECUTION_ACTIVE:
m_pContext->Abort();
iRsl = 2;
break;
case asEXECUTION_PREPARED:
case asEXECUTION_ERROR:
m_pContext->Unprepare();
iRsl = 1;
break;
case asEXECUTION_FINISHED:
case asEXECUTION_ABORTED:
case asEXECUTION_EXCEPTION:
case asEXECUTION_UNINITIALIZED:
iRsl = 0;
break;
}
return iRsl;
}
int CogeScript::PrepareFunction(const std::string& sFunctionName)
{
if(m_iState < 0) return -1;
//return m_pScripter->m_pScriptEngine->GetFunctionIDByName(m_sName.c_str(), sFunctionName.c_str());
return m_pScriptModule->GetFunctionIdByName(sFunctionName.c_str());
}
int CogeScript::PrepareFunction(int iFunctionID)
{
if(m_iState < 0) return -1;
switch(m_pContext->GetState())
{
case asEXECUTION_SUSPENDED:
case asEXECUTION_ACTIVE:
return -1;
break;
case asEXECUTION_PREPARED:
case asEXECUTION_ERROR:
m_pContext->Unprepare();
break;
case asEXECUTION_FINISHED:
case asEXECUTION_ABORTED:
case asEXECUTION_EXCEPTION:
case asEXECUTION_UNINITIALIZED:
break;
}
return m_pContext->Prepare(iFunctionID);
}
bool CogeScript::IsFunctionReady(int iFunctionID)
{
if(m_iState < 0) return false;
//return m_pContext->GetCurrentFunction() == iFunctionID;
if( m_pContext->GetState() == asEXECUTION_SUSPENDED || m_pContext->GetState() == asEXECUTION_ACTIVE )
{
return m_pContext->GetFunction() && m_pContext->GetFunction()->GetId() == iFunctionID;
}
return false;
}
int CogeScript::CallFunction(int iFunctionID)
{
if(m_iState < 0) return -1;
switch(m_pContext->GetState())
{
case asEXECUTION_SUSPENDED:
case asEXECUTION_ACTIVE:
return -1;
break;
case asEXECUTION_PREPARED:
case asEXECUTION_ERROR:
m_pContext->Unprepare();
break;
case asEXECUTION_FINISHED:
case asEXECUTION_ABORTED:
case asEXECUTION_EXCEPTION:
case asEXECUTION_UNINITIALIZED:
break;
}
int rsl = 0;
if (m_pContext->Prepare(iFunctionID) >= 0)
{
int iCmdResult = 0;
g_currentscript = this;
rsl = m_pContext->Execute();
if(m_iDebugMode == Debug_Remote)
{
while(rsl == asEXECUTION_SUSPENDED)
{
while(g_debugcmd != _OGE_DEBUG_NEXT_INST_
&& g_debugcmd != _OGE_DEBUG_NEXT_LINE_
&& g_debugcmd != _OGE_DEBUG_CONTINUE_)
{
SDL_Delay(10); // cool down cpu time ...
//iScanResult = OGE_ScanDebugRequest(g_currentscript);
//if(iScanResult < 0) break;
if(m_pScripter && m_pScripter->m_pOnCheckDebugRequest)
{
ogeCommonFunction callback = (ogeCommonFunction)m_pScripter->m_pOnCheckDebugRequest;
iCmdResult = callback();
if(iCmdResult < 0) break;
}
}
if(iCmdResult < 0)
{
g_debugcmd = _OGE_DEBUG_STOP_;
g_suspendedctx = NULL;
this->Stop();
break;
}
SDL_Delay(10); // cool down cpu time ...
if(g_debugcmd == _OGE_DEBUG_CONTINUE_) g_suspendedctx = NULL;
g_currentscript = this;
rsl = m_pContext->Execute();
}
}
}
return rsl;
}
int CogeScript::CallFunction(const std::string& sFunctionName)
{
int id = PrepareFunction(sFunctionName);
if (id >= 0) return CallFunction(id);
return -1;
}
int CogeScript::CallGC(int iFlags)
{
if(m_pScripter == NULL) return -1;
return m_pScripter->GC(iFlags);
//return 0;
}
| 26.062126 | 148 | 0.615325 | suxinde2009 |
c90519cdacb02dd5b87932dacb0744d245efcb82 | 2,970 | cpp | C++ | functions/wrapper.cpp | nrandell/mlx90640-library | 84ec44a16dea57305cd744532123f208e1a06a46 | [
"Apache-2.0"
] | null | null | null | functions/wrapper.cpp | nrandell/mlx90640-library | 84ec44a16dea57305cd744532123f208e1a06a46 | [
"Apache-2.0"
] | null | null | null | functions/wrapper.cpp | nrandell/mlx90640-library | 84ec44a16dea57305cd744532123f208e1a06a46 | [
"Apache-2.0"
] | null | null | null | #include "MLX90640_I2C_Driver.h"
#include "MLX90640_API.h"
extern "C"
{
void WRAP_MLX90640_I2CInit()
{
MLX90640_I2CInit();
}
int WRAP_MLX90640_I2CRead(uint8_t slaveAddr, uint16_t startAddress, uint16_t nMemAddressRead, uint16_t *data)
{
return MLX90640_I2CRead(slaveAddr, startAddress, nMemAddressRead, data);
}
int WRAP_MLX90640_I2CWrite(uint8_t slaveAddr, uint16_t writeAddress, uint16_t data)
{
return MLX90640_I2CWrite(slaveAddr, writeAddress, data);
}
void WRAP_MLX90640_I2CFreqSet(int freq)
{
MLX90640_I2CFreqSet(freq);
}
int WRAP_MLX90640_DumpEE(uint8_t slaveAddr, uint16_t *eeData) {
return MLX90640_DumpEE(slaveAddr, eeData);
}
int WRAP_MLX90640_GetFrameData(uint8_t slaveAddr, uint16_t *frameData) {
return MLX90640_GetFrameData(slaveAddr, frameData);
}
int WRAP_MLX90640_ExtractParameters(uint16_t *eeData, paramsMLX90640 *mlx90640) {
return MLX90640_ExtractParameters(eeData, mlx90640);
}
float WRAP_MLX90640_GetVdd(uint16_t *frameData, const paramsMLX90640 *params) {
return MLX90640_GetVdd(frameData, params);
}
float WRAP_MLX90640_GetTa(uint16_t *frameData, const paramsMLX90640 *params) {
return MLX90640_GetTa(frameData, params);
}
void WRAP_MLX90640_GetImage(uint16_t *frameData, const paramsMLX90640 *params, float *result) {
WRAP_MLX90640_GetImage(frameData, params, result);
}
void WRAP_MLX90640_CalculateTo(uint16_t *frameData, const paramsMLX90640 *params, float emissivity, float tr, float *result) {
return MLX90640_CalculateTo(frameData, params, emissivity, tr, result);
}
int WRAP_MLX90640_SetResolution(uint8_t slaveAddr, uint8_t resolution) {
return MLX90640_SetResolution(slaveAddr, resolution);
}
int WRAP_MLX90640_GetCurResolution(uint8_t slaveAddr) {
return MLX90640_GetCurResolution(slaveAddr);
}
int WRAP_MLX90640_SetRefreshRate(uint8_t slaveAddr, uint8_t refreshRate) {
return MLX90640_SetRefreshRate(slaveAddr, refreshRate);
}
int WRAP_MLX90640_GetRefreshRate(uint8_t slaveAddr) {
return MLX90640_GetRefreshRate(slaveAddr);
}
int WRAP_MLX90640_GetSubPageNumber(uint16_t *frameData) {
return MLX90640_GetSubPageNumber(frameData);
}
int WRAP_MLX90640_GetCurMode(uint8_t slaveAddr) {
return MLX90640_GetCurMode(slaveAddr);
}
int WRAP_MLX90640_SetInterleavedMode(uint8_t slaveAddr) {
return MLX90640_SetInterleavedMode(slaveAddr);
}
int WRAP_MLX90640_SetChessMode(uint8_t slaveAddr) {
return MLX90640_SetChessMode(slaveAddr);
}
void WRAP_MLX90640_BadPixelsCorrection(uint16_t *pixels, float *to, int mode, paramsMLX90640 *params) {
MLX90640_BadPixelsCorrection(pixels, to, mode, params);
}
}
| 33 | 131 | 0.707744 | nrandell |
c90577a0fb4c50e8650c8032cb1cf8a08e936173 | 6,285 | cpp | C++ | Chapter_14/src/Gui.cpp | 9ndres/Ray-Tracing-Gems-II | 5fef3b49375c823431ef06f8c67d1b44b432304a | [
"MIT"
] | 603 | 2021-08-04T11:46:33.000Z | 2022-03-28T12:12:31.000Z | Chapter_14/src/Gui.cpp | 9ndres/Ray-Tracing-Gems-II | 5fef3b49375c823431ef06f8c67d1b44b432304a | [
"MIT"
] | 4 | 2021-07-09T09:00:43.000Z | 2021-07-20T09:44:54.000Z | Chapter_14/src/Gui.cpp | 9ndres/Ray-Tracing-Gems-II | 5fef3b49375c823431ef06f8c67d1b44b432304a | [
"MIT"
] | 45 | 2021-08-04T18:57:37.000Z | 2022-03-11T11:33:49.000Z | /* Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of NVIDIA CORPORATION nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "Gui.h"
#include "imgui/imgui.h"
#include "imgui/imgui_impl_win32.h"
#include "imgui/imgui_impl_dx12.h"
IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam);
void Gui::Init(D3D12Global &d3d, HWND window) {
IMGUI_CHECKVERSION();
ImGui::CreateContext();
ImGuiIO& io = ImGui::GetIO(); (void)io;
ImGui::StyleColorsDark();
{
D3D12_DESCRIPTOR_HEAP_DESC desc = {};
desc.Type = D3D12_DESCRIPTOR_HEAP_TYPE_CBV_SRV_UAV;
desc.NumDescriptors = 1;
desc.Flags = D3D12_DESCRIPTOR_HEAP_FLAG_SHADER_VISIBLE;
if (d3d.device->CreateDescriptorHeap(&desc, IID_PPV_ARGS(&g_pd3dSrvDescHeap)) != S_OK)
return;
}
// Setup Platform/Renderer bindings
ImGui_ImplWin32_Init((void*)window);
ImGui_ImplDX12_Init(d3d.device, NUM_FRAMES_IN_FLIGHT,
DXGI_FORMAT_R8G8B8A8_UNORM, g_pd3dSrvDescHeap,
g_pd3dSrvDescHeap->GetCPUDescriptorHandleForHeapStart(),
g_pd3dSrvDescHeap->GetGPUDescriptorHandleForHeapStart());
}
void Gui::Update(D3D12Global& d3d, float elapsedTime)
{
if (!d3d.renderGui) return;
// Start the Dear ImGui frame
ImGui_ImplDX12_NewFrame();
ImGui_ImplWin32_NewFrame();
ImGui::NewFrame();
// Size the debug window based on the application height
ImGui::SetNextWindowSize(ImVec2(ImGui::GetWindowWidth() * dpiScaling, d3d.height - 40.f));
ImGui::Begin("Path Tracer", NULL, ImGuiWindowFlags_AlwaysAutoResize);
// We must select font scale inside of Begin/End
ImGui::SetWindowFontScale(dpiScaling);
Text("Frame Time: %.02fms", elapsedTime);
}
void Gui::Render(D3D12Global &d3d, D3D12Resources &resources) {
if (!d3d.renderGui) return;
ImGui::End();
UINT backBufferIdx = d3d.swapChain->GetCurrentBackBufferIndex();
d3d.cmdAlloc[d3d.frameIndex]->Reset();
D3D12_RESOURCE_BARRIER barrier = {};
barrier.Type = D3D12_RESOURCE_BARRIER_TYPE_TRANSITION;
barrier.Flags = D3D12_RESOURCE_BARRIER_FLAG_NONE;
barrier.Transition.pResource = d3d.backBuffer[d3d.frameIndex];
barrier.Transition.Subresource = D3D12_RESOURCE_BARRIER_ALL_SUBRESOURCES;
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_PRESENT;
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_RENDER_TARGET;
ImVec4 clear_color = ImVec4(0.45f, 0.55f, 0.60f, 1.00f);
D3D12_CPU_DESCRIPTOR_HANDLE renderTargetViewHandle = resources.rtvHeap->GetCPUDescriptorHandleForHeapStart();
UINT renderTargetViewDescriptorSize = resources.rtvDescSize;
renderTargetViewHandle.ptr += (SIZE_T(renderTargetViewDescriptorSize) * d3d.frameIndex);
d3d.cmdList->Reset(d3d.cmdAlloc[d3d.frameIndex], NULL);
d3d.cmdList->ResourceBarrier(1, &barrier);
d3d.cmdList->OMSetRenderTargets(1, &renderTargetViewHandle, FALSE, NULL);
d3d.cmdList->SetDescriptorHeaps(1, &g_pd3dSrvDescHeap);
ImGui::Render();
ImGui_ImplDX12_RenderDrawData(ImGui::GetDrawData(), d3d.cmdList);
barrier.Transition.StateBefore = D3D12_RESOURCE_STATE_RENDER_TARGET;
barrier.Transition.StateAfter = D3D12_RESOURCE_STATE_PRESENT;
d3d.cmdList->ResourceBarrier(1, &barrier);
d3d.cmdList->Close();
d3d.cmdQueue->ExecuteCommandLists(1, (ID3D12CommandList* const*)&d3d.cmdList);
}
void Gui::SetDpiScaling(float newDpiScaling) {
dpiScaling = newDpiScaling;
}
bool Gui::CallWndProcHandler(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) {
return ImGui_ImplWin32_WndProcHandler(hWnd, msg, wParam, lParam);
}
bool Gui::WantCaptureMouse()
{
ImGuiIO& io = ImGui::GetIO();
return io.WantCaptureMouse;
}
void Gui::Text(const char* text) {
ImGui::Text(text);
}
void Gui::Text(const char* text, double x) {
ImGui::Text(text, x);
}
bool Gui::SliderFloat(const char* label, float* v, float min, float max) {
return ImGui::SliderFloat(label, v, min, max);
}
bool Gui::SliderInt(const char* label, int* v, int min, int max) {
return ImGui::SliderInt(label, v, min, max);
}
bool Gui::DragInt(const char* label, int* v, int min, int max) {
return ImGui::DragInt(label, v, 1, min, max);
}
bool Gui::DragFloat(const char* label, float* v, float min, float max) {
return ImGui::DragFloat(label, v, (max - min) * 0.01f, min, max);
}
bool Gui::Combo(const char* label, int* currentItem, const char* options) {
return ImGui::Combo(label, currentItem, options);
}
bool Gui::Button(const char* label, float width, float height)
{
return ImGui::Button(label, ImVec2(width * dpiScaling, height * dpiScaling));
}
bool Gui::Checkbox(const char* label, bool* v) {
return ImGui::Checkbox(label, v);
}
void Gui::Separator() {
ImGui::Separator();
}
void Gui::SameLine() {
ImGui::SameLine();
}
void Gui::Indent(float v) {
ImGui::Indent(v);
}
void Gui::Destroy() {
ImGui_ImplDX12_Shutdown();
ImGui_ImplWin32_Shutdown();
ImGui::DestroyContext();
g_pd3dSrvDescHeap->Release();
g_pd3dSrvDescHeap = nullptr;
}
| 33.790323 | 110 | 0.760223 | 9ndres |
c90fe1fe059e66be2d19893cc552b95727357d11 | 6,428 | cpp | C++ | lib/targets/cuda/comm_target.cpp | Marcogarofalo/quda | 7dd7ba316d5f872d1a332bdf55a2204a1a4a7dda | [
"MIT"
] | null | null | null | lib/targets/cuda/comm_target.cpp | Marcogarofalo/quda | 7dd7ba316d5f872d1a332bdf55a2204a1a4a7dda | [
"MIT"
] | null | null | null | lib/targets/cuda/comm_target.cpp | Marcogarofalo/quda | 7dd7ba316d5f872d1a332bdf55a2204a1a4a7dda | [
"MIT"
] | null | null | null | #include <comm_quda.h>
#include <quda_api.h>
#include <quda_cuda_api.h>
#include <algorithm>
#include <shmem_helper.cuh>
#define CHECK_CUDA_ERROR(func) \
quda::target::cuda::set_runtime_error(func, #func, __func__, __FILE__, __STRINGIFY__(__LINE__));
bool comm_peer2peer_possible(int local_gpuid, int neighbor_gpuid)
{
int canAccessPeer[2];
CHECK_CUDA_ERROR(cudaDeviceCanAccessPeer(&canAccessPeer[0], local_gpuid, neighbor_gpuid));
CHECK_CUDA_ERROR(cudaDeviceCanAccessPeer(&canAccessPeer[1], neighbor_gpuid, local_gpuid));
// require symmetric peer-to-peer access to enable peer-to-peer
return canAccessPeer[0] && canAccessPeer[1];
}
int comm_peer2peer_performance(int local_gpuid, int neighbor_gpuid)
{
int accessRank[2] = {};
if (comm_peer2peer_possible(local_gpuid, neighbor_gpuid)) {
CHECK_CUDA_ERROR(
cudaDeviceGetP2PAttribute(&accessRank[0], cudaDevP2PAttrPerformanceRank, local_gpuid, neighbor_gpuid));
CHECK_CUDA_ERROR(
cudaDeviceGetP2PAttribute(&accessRank[1], cudaDevP2PAttrPerformanceRank, neighbor_gpuid, local_gpuid));
}
// return the slowest direction of access (lower is faster)
return std::max(accessRank[0], accessRank[1]);
}
void comm_create_neighbor_memory(void *remote[QUDA_MAX_DIM][2], void *local)
{
// handles for obtained ghost pointers
cudaIpcMemHandle_t remote_handle[2][QUDA_MAX_DIM];
#ifndef NVSHMEM_COMMS
for (int dim = 0; dim < 4; ++dim) {
if (comm_dim(dim) == 1) continue;
for (int dir = 0; dir < 2; ++dir) {
MsgHandle *sendHandle = nullptr;
MsgHandle *receiveHandle = nullptr;
int disp = (dir == 1) ? +1 : -1;
// first set up receive
if (comm_peer2peer_enabled(1 - dir, dim)) {
receiveHandle = comm_declare_receive_relative(&remote_handle[1 - dir][dim], dim, -disp, sizeof(remote_handle));
}
// now send
cudaIpcMemHandle_t local_handle;
if (comm_peer2peer_enabled(dir, dim)) {
CHECK_CUDA_ERROR(cudaIpcGetMemHandle(&local_handle, local));
sendHandle = comm_declare_send_relative(&local_handle, dim, disp, sizeof(local_handle));
}
if (receiveHandle) comm_start(receiveHandle);
if (sendHandle) comm_start(sendHandle);
if (receiveHandle) comm_wait(receiveHandle);
if (sendHandle) comm_wait(sendHandle);
if (sendHandle) comm_free(sendHandle);
if (receiveHandle) comm_free(receiveHandle);
}
}
#endif
// open the remote memory handles and set the send ghost pointers
for (int dim = 0; dim < 4; ++dim) {
#ifndef NVSHMEM_COMMS
// TODO: We maybe can force loopback comms to use the IB path here
if (comm_dim(dim) == 1) continue;
#endif
// even if comm_dim(2) == 2, we might not have p2p enabled in both directions, so check this
const int num_dir = (comm_dim(dim) == 2 && comm_peer2peer_enabled(0, dim) && comm_peer2peer_enabled(1, dim)) ? 1 : 2;
for (int dir = 0; dir < num_dir; dir++) {
remote[dim][dir] = nullptr;
#ifndef NVSHMEM_COMMS
if (!comm_peer2peer_enabled(dir, dim)) continue;
CHECK_CUDA_ERROR(cudaIpcOpenMemHandle(&remote[dim][dir], remote_handle[dir][dim], cudaIpcMemLazyEnablePeerAccess));
#else
remote[dim][dir] = nvshmem_ptr(static_cast<char *>(local), comm_neighbor_rank(dir, dim));
#endif
}
if (num_dir == 1) remote[dim][1] = remote[dim][0];
}
}
#ifndef NVSHMEM_COMMS
void comm_destroy_neighbor_memory(void *remote[QUDA_MAX_DIM][2])
{
for (int dim = 0; dim < 4; ++dim) {
if (comm_dim(dim) == 1) continue;
const int num_dir = (comm_dim(dim) == 2 && comm_peer2peer_enabled(0, dim) && comm_peer2peer_enabled(1, dim)) ? 1 : 2;
if (comm_peer2peer_enabled(1, dim)) {
// only close this handle if it doesn't alias the back ghost
if (num_dir == 2 && remote[dim][1]) CHECK_CUDA_ERROR(cudaIpcCloseMemHandle(remote[dim][1]));
}
if (comm_peer2peer_enabled(0, dim)) {
if (remote[dim][0]) CHECK_CUDA_ERROR(cudaIpcCloseMemHandle(remote[dim][0]));
}
} // iterate over dim
}
#else
void comm_destroy_neighbor_memory(void *[QUDA_MAX_DIM][2]) { }
#endif
void comm_create_neighbor_event(qudaEvent_t remote[2][QUDA_MAX_DIM], qudaEvent_t local[2][QUDA_MAX_DIM])
{
// handles for obtained events
cudaIpcEventHandle_t ipcRemoteEventHandle[2][QUDA_MAX_DIM];
for (int dim = 0; dim < 4; ++dim) {
if (comm_dim(dim) == 1) continue;
for (int dir = 0; dir < 2; ++dir) {
MsgHandle *sendHandle = nullptr;
MsgHandle *receiveHandle = nullptr;
int disp = (dir == 1) ? +1 : -1;
// first set up receive
if (comm_peer2peer_enabled(1 - dir, dim)) {
receiveHandle = comm_declare_receive_relative(&ipcRemoteEventHandle[1 - dir][dim], dim, -disp,
sizeof(ipcRemoteEventHandle[1 - dir][dim]));
}
cudaIpcEventHandle_t handle;
// now send
if (comm_peer2peer_enabled(dir, dim)) {
cudaEvent_t event;
CHECK_CUDA_ERROR(cudaEventCreate(&event, cudaEventDisableTiming | cudaEventInterprocess));
local[dir][dim].event = reinterpret_cast<void *>(event);
CHECK_CUDA_ERROR(cudaIpcGetEventHandle(&handle, event));
sendHandle = comm_declare_send_relative(&handle, dim, disp, sizeof(handle));
}
if (receiveHandle) comm_start(receiveHandle);
if (sendHandle) comm_start(sendHandle);
if (receiveHandle) comm_wait(receiveHandle);
if (sendHandle) comm_wait(sendHandle);
if (sendHandle) comm_free(sendHandle);
if (receiveHandle) comm_free(receiveHandle);
}
}
for (int dim = 0; dim < 4; ++dim) {
if (comm_dim(dim) == 1) continue;
for (int dir = 0; dir < 2; ++dir) {
if (!comm_peer2peer_enabled(dir, dim)) continue;
cudaEvent_t event;
CHECK_CUDA_ERROR(cudaIpcOpenEventHandle(&event, ipcRemoteEventHandle[dir][dim]));
remote[dir][dim].event = reinterpret_cast<void *>(event);
}
}
}
void comm_destroy_neighbor_event(qudaEvent_t[2][QUDA_MAX_DIM], qudaEvent_t local[2][QUDA_MAX_DIM])
{
for (int dim = 0; dim < 4; ++dim) {
if (comm_dim(dim) == 1) continue;
for (int dir = 0; dir < 2; dir++) {
cudaEvent_t &event = reinterpret_cast<cudaEvent_t &>(local[dir][dim].event);
if (comm_peer2peer_enabled(dir, dim)) CHECK_CUDA_ERROR(cudaEventDestroy(event));
}
} // iterate over dim
}
| 37.156069 | 121 | 0.671437 | Marcogarofalo |
c910eea999b17044cd9f674f2095ae6742803d40 | 682 | cpp | C++ | cards/WymianaKart.cpp | programistagd/TrachOnline | 2acd9ffac0add87fd0f1824ae2b75132933496c7 | [
"MIT"
] | 3 | 2016-06-07T11:55:23.000Z | 2016-06-09T17:17:52.000Z | cards/WymianaKart.cpp | radeusgd/TrachOnline | 2acd9ffac0add87fd0f1824ae2b75132933496c7 | [
"MIT"
] | 25 | 2016-06-13T16:14:18.000Z | 2017-07-29T08:12:23.000Z | cards/WymianaKart.cpp | radeusgd/TrachOnline | 2acd9ffac0add87fd0f1824ae2b75132933496c7 | [
"MIT"
] | null | null | null | #include "cards/WymianaKart.hpp"
#include "GameServer.hpp"
using namespace Cards;
string WymianaKart::getName(){
return "wymiana_kart";
}
bool WymianaKart::canBePlayedAt(CardPtr card, GameServer* game){
if(card==nullptr) return true;
return false;
}
CardPtr WymianaKart::makeNew(){
return make_shared<WymianaKart>();
}
void WymianaKart::played(GameServer& game){
int to = WymianaKart::to.playerId;//TODO get rid of shadowing
for(auto c : game.players[to].hand) game.recycleCard(c);
game.players[to].hand.clear();
game.fillCards(game.players[to]);
}
bool WymianaKart::canBeTargetedAt(Target t){
if(t.cardId==-1) return true;
return false;
}
| 22.733333 | 65 | 0.71261 | programistagd |
c9114b64a479bbb8f2ae530ee6235965133f18e4 | 1,440 | cpp | C++ | cpp/MergekSortedLists.cpp | thinksource/code_interview | 08be992240508b73894eaf6b8c025168fd19df19 | [
"Apache-2.0"
] | 12 | 2015-03-12T03:27:26.000Z | 2021-03-11T09:26:16.000Z | cpp/MergekSortedLists.cpp | thinksource/code_interview | 08be992240508b73894eaf6b8c025168fd19df19 | [
"Apache-2.0"
] | null | null | null | cpp/MergekSortedLists.cpp | thinksource/code_interview | 08be992240508b73894eaf6b8c025168fd19df19 | [
"Apache-2.0"
] | 11 | 2015-01-28T16:45:40.000Z | 2017-03-28T20:01:38.000Z | /**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
struct ListNodeWrapper{
ListNode* node;
int listIndex;
};
bool Compare(ListNodeWrapper lw1, ListNodeWrapper lw2)
{
return lw1.node->val > lw2.node->val;
}
class Solution {
public:
ListNode *mergeKLists(vector<ListNode *> &lists) {
priority_queue<ListNodeWrapper, vector<ListNodeWrapper>, function<bool(ListNodeWrapper, ListNodeWrapper)>> pq(Compare);
vector<int> indexes(lists.size());
for(int i=0;i<lists.size();i++) {
if(lists[i] == NULL) {
continue;
}
ListNodeWrapper lw;
lw.node = lists[i];
lw.listIndex = i;
pq.push(lw);
lists[i] = lists[i]->next;
}
ListNode *res = new ListNode(0);
ListNode *p = res;
while(!pq.empty()){
ListNodeWrapper lw= pq.top();
pq.pop();
p->next = lw.node;
p = p->next;
if(lists[lw.listIndex] !=NULL) {
ListNodeWrapper lw1;
lw1.node = lists[lw.listIndex];
lw1.listIndex = lw.listIndex;
pq.push(lw1);
lists[lw.listIndex] = lists[lw.listIndex]->next;
}
p->next = NULL;
}
return res->next;
}
};
| 26.666667 | 127 | 0.509722 | thinksource |
c913e129515426561924bec1f5f394858259527f | 7,579 | hpp | C++ | include/GlobalNamespace/Levenshtein.hpp | RedBrumbler/virtuoso-codegen | e83f6f0f9b47bec4b6dd976b21edc1d46bf3cfe3 | [
"Unlicense"
] | null | null | null | include/GlobalNamespace/Levenshtein.hpp | RedBrumbler/virtuoso-codegen | e83f6f0f9b47bec4b6dd976b21edc1d46bf3cfe3 | [
"Unlicense"
] | null | null | null | include/GlobalNamespace/Levenshtein.hpp | RedBrumbler/virtuoso-codegen | e83f6f0f9b47bec4b6dd976b21edc1d46bf3cfe3 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
#include "beatsaber-hook/shared/utils/byref.hpp"
// Including type: UnityEngine.MonoBehaviour
#include "UnityEngine/MonoBehaviour.hpp"
// Including type: System.Int32
#include "System/Int32.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
#include "beatsaber-hook/shared/utils/typedefs-array.hpp"
#include "beatsaber-hook/shared/utils/typedefs-string.hpp"
// Completed includes
// Begin forward declares
// Forward declaring namespace: GlobalNamespace
namespace GlobalNamespace {
// Forward declaring type: NGramGenerator
class NGramGenerator;
}
// Forward declaring namespace: UnityEngine::UI
namespace UnityEngine::UI {
// Forward declaring type: Text
class Text;
}
// Forward declaring namespace: System::Collections::Generic
namespace System::Collections::Generic {
// Forward declaring type: List`1<T>
template<typename T>
class List_1;
}
// Completed forward declares
// Type namespace:
namespace GlobalNamespace {
// Forward declaring type: Levenshtein
class Levenshtein;
}
#include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
NEED_NO_BOX(::GlobalNamespace::Levenshtein);
DEFINE_IL2CPP_ARG_TYPE(::GlobalNamespace::Levenshtein*, "", "Levenshtein");
// Type namespace:
namespace GlobalNamespace {
// Size: 0x32
#pragma pack(push, 1)
// Autogenerated type: Levenshtein
// [TokenAttribute] Offset: FFFFFFFF
class Levenshtein : public ::UnityEngine::MonoBehaviour {
public:
// Nested type: ::GlobalNamespace::Levenshtein::LevenshteinDistance
class LevenshteinDistance;
// Nested type: ::GlobalNamespace::Levenshtein::$$c
class $$c;
#ifdef USE_CODEGEN_FIELDS
public:
#else
#ifdef CODEGEN_FIELD_ACCESSIBILITY
CODEGEN_FIELD_ACCESSIBILITY:
#else
protected:
#endif
#endif
// public NGramGenerator NGramHandler
// Size: 0x8
// Offset: 0x18
::GlobalNamespace::NGramGenerator* NGramHandler;
// Field size check
static_assert(sizeof(::GlobalNamespace::NGramGenerator*) == 0x8);
// public UnityEngine.UI.Text[] ButtonLabels
// Size: 0x8
// Offset: 0x20
::ArrayW<::UnityEngine::UI::Text*> ButtonLabels;
// Field size check
static_assert(sizeof(::ArrayW<::UnityEngine::UI::Text*>) == 0x8);
// private System.Collections.Generic.List`1<System.String> corpus
// Size: 0x8
// Offset: 0x28
::System::Collections::Generic::List_1<::StringW>* corpus;
// Field size check
static_assert(sizeof(::System::Collections::Generic::List_1<::StringW>*) == 0x8);
// private System.Boolean isUppercase
// Size: 0x1
// Offset: 0x30
bool isUppercase;
// Field size check
static_assert(sizeof(bool) == 0x1);
// private System.Boolean isFirstLetterUpper
// Size: 0x1
// Offset: 0x31
bool isFirstLetterUpper;
// Field size check
static_assert(sizeof(bool) == 0x1);
public:
// Deleting conversion operator: operator ::System::IntPtr
constexpr operator ::System::IntPtr() const noexcept = delete;
// static field const value: static private System.Int32 maxWordLength
static constexpr const int maxWordLength = 15;
// Get static field: static private System.Int32 maxWordLength
static int _get_maxWordLength();
// Set static field: static private System.Int32 maxWordLength
static void _set_maxWordLength(int value);
// static field const value: static private System.Int32 maxLevenshteinCost
static constexpr const int maxLevenshteinCost = 7;
// Get static field: static private System.Int32 maxLevenshteinCost
static int _get_maxLevenshteinCost();
// Set static field: static private System.Int32 maxLevenshteinCost
static void _set_maxLevenshteinCost(int value);
// static field const value: static private System.Int32 minLevenshteinCost
static constexpr const int minLevenshteinCost = 1;
// Get static field: static private System.Int32 minLevenshteinCost
static int _get_minLevenshteinCost();
// Set static field: static private System.Int32 minLevenshteinCost
static void _set_minLevenshteinCost(int value);
// Get instance field reference: public NGramGenerator NGramHandler
::GlobalNamespace::NGramGenerator*& dyn_NGramHandler();
// Get instance field reference: public UnityEngine.UI.Text[] ButtonLabels
::ArrayW<::UnityEngine::UI::Text*>& dyn_ButtonLabels();
// Get instance field reference: private System.Collections.Generic.List`1<System.String> corpus
::System::Collections::Generic::List_1<::StringW>*& dyn_corpus();
// Get instance field reference: private System.Boolean isUppercase
bool& dyn_isUppercase();
// Get instance field reference: private System.Boolean isFirstLetterUpper
bool& dyn_isFirstLetterUpper();
// private System.Void Start()
// Offset: 0x138C774
void Start();
// public System.Void RunAutoComplete(System.String input)
// Offset: 0x138C848
void RunAutoComplete(::StringW input);
// public System.Void .ctor()
// Offset: 0x138D034
// Implemented from: UnityEngine.MonoBehaviour
// Base method: System.Void MonoBehaviour::.ctor()
// Base method: System.Void Behaviour::.ctor()
// Base method: System.Void Component::.ctor()
// Base method: System.Void Object::.ctor()
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static Levenshtein* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::GlobalNamespace::Levenshtein::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<Levenshtein*, creationType>()));
}
}; // Levenshtein
#pragma pack(pop)
static check_size<sizeof(Levenshtein), 49 + sizeof(bool)> __GlobalNamespace_LevenshteinSizeCheck;
static_assert(sizeof(Levenshtein) == 0x32);
}
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: GlobalNamespace::Levenshtein::Start
// Il2CppName: Start
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::Levenshtein::*)()>(&GlobalNamespace::Levenshtein::Start)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::Levenshtein*), "Start", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: GlobalNamespace::Levenshtein::RunAutoComplete
// Il2CppName: RunAutoComplete
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (GlobalNamespace::Levenshtein::*)(::StringW)>(&GlobalNamespace::Levenshtein::RunAutoComplete)> {
static const MethodInfo* get() {
static auto* input = &::il2cpp_utils::GetClassFromName("System", "String")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(GlobalNamespace::Levenshtein*), "RunAutoComplete", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{input});
}
};
// Writing MetadataGetter for method: GlobalNamespace::Levenshtein::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
| 43.809249 | 170 | 0.727537 | RedBrumbler |
c9157ede81b6c55289ae23dd53dd870006d85b88 | 385 | hpp | C++ | core/code/core/LanguageTypes.hpp | iboB/word-grid | d1029323d5c51499298f3ed19390928371cb70a6 | [
"MIT"
] | 2 | 2019-07-01T00:10:43.000Z | 2019-09-18T19:37:38.000Z | core/code/core/LanguageTypes.hpp | iboB/word-grid | d1029323d5c51499298f3ed19390928371cb70a6 | [
"MIT"
] | null | null | null | core/code/core/LanguageTypes.hpp | iboB/word-grid | d1029323d5c51499298f3ed19390928371cb70a6 | [
"MIT"
] | 2 | 2019-07-17T17:44:16.000Z | 2020-12-21T07:56:11.000Z | // word-grid
// Copyright (c) 2019-2021 Borislav Stanimirov
//
// Distributed under the MIT Software License
// See accompanying file LICENSE.txt or copy at
// https://opensource.org/licenses/MIT
//
#pragma once
#include "GridElement.hpp"
#include <vector>
namespace core
{
using Alphabet = std::vector<GridElement>;
using Specials = std::vector<GridElement>;
} // namespace core
| 18.333333 | 47 | 0.735065 | iboB |
c9217162272e6f713c48fdf56e5724b5dfc7ca21 | 227,750 | cpp | C++ | test/grapheme_iterator_05.cpp | jan-moeller/text | c61e51c82dfb0ae6e74200c01ce040fa6db730c4 | [
"BSL-1.0"
] | null | null | null | test/grapheme_iterator_05.cpp | jan-moeller/text | c61e51c82dfb0ae6e74200c01ce040fa6db730c4 | [
"BSL-1.0"
] | null | null | null | test/grapheme_iterator_05.cpp | jan-moeller/text | c61e51c82dfb0ae6e74200c01ce040fa6db730c4 | [
"BSL-1.0"
] | null | null | null | // Warning! This file is autogenerated.
#include <boost/text/grapheme_iterator.hpp>
#include <boost/text/utf8.hpp>
#include <gtest/gtest.h>
#include <algorithm>
TEST(grapheme, iterator_05_0_fwd)
{
// ÷ 0600 × 1F1E6 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_0_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_0_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_0_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_0_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x1F1E6 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_1_fwd)
{
// ÷ 0600 × 0308 ÷ 1F1E6 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_1_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_1_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_1_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_1_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x1F1E6 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_2_fwd)
{
// ÷ 0600 × 0600 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] ARABIC NUMBER SIGN (Prepend) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_2_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_2_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_2_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_2_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0600 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_3_fwd)
{
// ÷ 0600 × 0308 ÷ 0600 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_3_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_3_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_3_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_3_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x0600 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_4_fwd)
{
// ÷ 0600 × 0903 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_4_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_4_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_4_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_4_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0903 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_5_fwd)
{
// ÷ 0600 × 0308 × 0903 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_5_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_5_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_5_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_5_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x0903 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_6_fwd)
{
// ÷ 0600 × 1100 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_6_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_6_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_6_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_6_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x1100 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_7_fwd)
{
// ÷ 0600 × 0308 ÷ 1100 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_7_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_7_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_7_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_7_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x1100 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_8_fwd)
{
// ÷ 0600 × 1160 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL JUNGSEONG FILLER (V) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_8_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_8_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_8_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_8_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x1160 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_9_fwd)
{
// ÷ 0600 × 0308 ÷ 1160 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_9_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_9_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_9_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_9_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x1160 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_10_fwd)
{
// ÷ 0600 × 11A8 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_10_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_10_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_10_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_10_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x11A8 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_11_fwd)
{
// ÷ 0600 × 0308 ÷ 11A8 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_11_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_11_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_11_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_11_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x11A8 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_12_fwd)
{
// ÷ 0600 × AC00 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL SYLLABLE GA (LV) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_12_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_12_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_12_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_12_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0xAC00 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_13_fwd)
{
// ÷ 0600 × 0308 ÷ AC00 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_13_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_13_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_13_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_13_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC00 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_14_fwd)
{
// ÷ 0600 × AC01 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL SYLLABLE GAG (LVT) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0xAC01 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_14_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0xAC01 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_14_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0xAC01 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_14_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0xAC01 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_14_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0xAC01 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_15_fwd)
{
// ÷ 0600 × 0308 ÷ AC01 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC01 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_15_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC01 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_15_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC01 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_15_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC01 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_15_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0xAC01 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_16_fwd)
{
// ÷ 0600 × 231A ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] WATCH (ExtPict) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x231A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_16_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x231A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_16_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x231A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_16_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x231A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_16_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x231A };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_17_fwd)
{
// ÷ 0600 × 0308 ÷ 231A ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x231A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_17_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x231A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_17_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x231A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_17_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x231A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_17_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x231A };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_18_fwd)
{
// ÷ 0600 × 0300 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0300 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_18_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0300 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_18_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0300 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_18_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0300 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_18_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0300 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_19_fwd)
{
// ÷ 0600 × 0308 × 0300 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x0300 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_19_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x0300 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_19_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x0300 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_19_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x0300 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_19_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x0300 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_20_fwd)
{
// ÷ 0600 × 200D ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x200D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_20_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x200D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_20_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x200D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_20_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x200D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_20_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x200D };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_21_fwd)
{
// ÷ 0600 × 0308 × 200D ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x200D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_21_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x200D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_21_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x200D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_21_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x200D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_21_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x200D };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_22_fwd)
{
// ÷ 0600 × 0378 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] <reserved-0378> (Other) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0378 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_22_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0378 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_22_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0378 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_22_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0378 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_22_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0378 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_23_fwd)
{
// ÷ 0600 × 0308 ÷ 0378 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] <reserved-0378> (Other) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0x0378 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_23_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0x0378 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_23_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0x0378 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_23_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0x0378 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_23_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0600, 0x0308, 0x0378 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_24_fwd)
{
// ÷ 0600 ÷ D800 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) ÷ [5.0] <surrogate-D800> (Control) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0xD800 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_24_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0xD800 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_24_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0xD800 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_24_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0xD800 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
// Skipping from-utf8 test due to presence of surrogate code point.
TEST(grapheme, iterator_05_25_fwd)
{
// ÷ 0600 × 0308 ÷ D800 ÷
// ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] <surrogate-D800> (Control) ÷ [0.3]
{
uint32_t const cps[] = { 0x0600, 0x0308, 0xD800 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_25_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0600, 0x0308, 0xD800 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_25_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0600, 0x0308, 0xD800 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_25_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0600, 0x0308, 0xD800 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
// Skipping from-utf8 test due to presence of surrogate code point.
TEST(grapheme, iterator_05_26_fwd)
{
// ÷ 0903 ÷ 0020 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] SPACE (Other) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0020 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_26_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0020 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_26_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0020 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_26_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0020 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_26_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0020 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_27_fwd)
{
// ÷ 0903 × 0308 ÷ 0020 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x0020 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_27_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x0020 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_27_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x0020 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_27_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x0020 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_27_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x0020 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_28_fwd)
{
// ÷ 0903 ÷ 000D ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [5.0] <CARRIAGE RETURN (CR)> (CR) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x000D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_28_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x000D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_28_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x000D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_28_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x000D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_28_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x000D };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_29_fwd)
{
// ÷ 0903 × 0308 ÷ 000D ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] <CARRIAGE RETURN (CR)> (CR) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x000D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_29_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x000D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_29_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x000D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_29_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x000D };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_29_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x000D };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_30_fwd)
{
// ÷ 0903 ÷ 000A ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [5.0] <LINE FEED (LF)> (LF) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x000A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_30_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x000A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_30_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x000A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_30_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x000A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_30_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x000A };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_31_fwd)
{
// ÷ 0903 × 0308 ÷ 000A ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] <LINE FEED (LF)> (LF) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x000A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_31_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x000A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_31_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x000A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_31_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x000A };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_31_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x000A };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_32_fwd)
{
// ÷ 0903 ÷ 0001 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [5.0] <START OF HEADING> (Control) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0001 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_32_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0001 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_32_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0001 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_32_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0001 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_32_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0001 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_33_fwd)
{
// ÷ 0903 × 0308 ÷ 0001 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] <START OF HEADING> (Control) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x0001 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_33_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x0001 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_33_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x0001 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_33_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x0001 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_33_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x0001 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_34_fwd)
{
// ÷ 0903 × 034F ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x034F };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_34_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x034F };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_34_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x034F };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_34_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x034F };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_34_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x034F };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_35_fwd)
{
// ÷ 0903 × 0308 × 034F ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x034F };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_35_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x034F };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_35_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x034F };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_35_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x034F };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_35_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x034F };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_36_fwd)
{
// ÷ 0903 ÷ 1F1E6 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_36_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_36_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_36_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_36_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x1F1E6 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_37_fwd)
{
// ÷ 0903 × 0308 ÷ 1F1E6 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_37_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_37_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_37_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x1F1E6 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_37_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x1F1E6 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_38_fwd)
{
// ÷ 0903 ÷ 0600 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_38_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_38_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_38_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_38_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0600 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_39_fwd)
{
// ÷ 0903 × 0308 ÷ 0600 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_39_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_39_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_39_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x0600 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_39_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x0600 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_40_fwd)
{
// ÷ 0903 × 0903 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_40_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_40_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_40_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_40_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0903 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_41_fwd)
{
// ÷ 0903 × 0308 × 0903 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_41_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_41_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
}
}
TEST(grapheme, iterator_05_41_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x0903 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_41_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x0903 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_42_fwd)
{
// ÷ 0903 ÷ 1100 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_42_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_42_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_42_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_42_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x1100 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_43_fwd)
{
// ÷ 0903 × 0308 ÷ 1100 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_43_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_43_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_43_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x1100 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_43_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x1100 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_44_fwd)
{
// ÷ 0903 ÷ 1160 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_44_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_44_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_44_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_44_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x1160 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_45_fwd)
{
// ÷ 0903 × 0308 ÷ 1160 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_45_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_45_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_45_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x1160 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_45_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x1160 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_46_fwd)
{
// ÷ 0903 ÷ 11A8 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_46_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_46_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_46_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_46_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x11A8 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_47_fwd)
{
// ÷ 0903 × 0308 ÷ 11A8 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_47_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_47_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_47_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0x11A8 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_47_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0x11A8 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_48_fwd)
{
// ÷ 0903 ÷ AC00 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_48_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_48_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 2);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
}
}
TEST(grapheme, iterator_05_48_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 2, cps + 2);
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 1);
++it;
EXPECT_EQ(it.base(), cps + 1);
EXPECT_EQ((*it).begin(), cps + 1);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_48_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0xAC00 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 2),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 2, cps + 2),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[1]);
++it;
EXPECT_EQ(*it.base(), cps[1]);
EXPECT_EQ(*it->begin(), cps[1]);
EXPECT_EQ(it.base().base(), cus + cp_indices[1]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[1]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_49_fwd)
{
// ÷ 0903 × 0308 ÷ AC00 ÷
// ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3]
{
uint32_t const cps[] = { 0x0903, 0x0308, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_49_rev)
{
{
// reverse
uint32_t const cps[] = { 0x0903, 0x0308, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_49_fab)
{
{
// forth and back
uint32_t const cps[] = { 0x0903, 0x0308, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps, cps + 3);
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
}
}
TEST(grapheme, iterator_05_49_baf)
{
{
// back and forth
uint32_t const cps[] = { 0x0903, 0x0308, 0xAC00 };
boost::text::grapheme_iterator<uint32_t const *> it(cps, cps + 3, cps + 3);
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
--it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
--it;
EXPECT_EQ(it.base(), cps + 0);
EXPECT_EQ((*it).begin(), cps + 0);
EXPECT_EQ((*it).end(), cps + 2);
++it;
EXPECT_EQ(it.base(), cps + 2);
EXPECT_EQ((*it).begin(), cps + 2);
EXPECT_EQ((*it).end(), cps + 3);
++it;
EXPECT_EQ(it.base(), cps + 3);
EXPECT_EQ((*it).begin(), (*it).end());
}
}
TEST(grapheme, iterator_05_49_utf8)
{
{
// from UTF8
uint32_t const cps[] = { 0x0903, 0x0308, 0xAC00 };
char cus[1024] = { 0 };
int cp_indices[1024] = { 0 };
std::copy(
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps, cps + 3),
boost::text::utf8::from_utf32_iterator<uint32_t const *>(cps, cps + 3, cps + 3),
cus);
boost::text::utf8::null_sentinel sentinel;
int * index_it = cp_indices;
for (boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel> it(cus, cus, boost::text::utf8::null_sentinel{}); ; ++it) {
*index_it++ = it.base() - cus;
if (it == sentinel)
break;
}
using iter_t = boost::text::utf8::to_utf32_iterator<char const *, boost::text::utf8::null_sentinel>;
boost::text::grapheme_iterator<iter_t, boost::text::utf8::null_sentinel> it(
iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, iter_t{cus, cus, boost::text::utf8::null_sentinel{}}, sentinel);
EXPECT_EQ(*it.base(), cps[0]);
EXPECT_EQ(*it->begin(), cps[0]);
EXPECT_EQ(*it->end(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[0]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[0]);
EXPECT_EQ(it->end().base(), cus + cp_indices[2]);
++it;
EXPECT_EQ(*it.base(), cps[2]);
EXPECT_EQ(*it->begin(), cps[2]);
EXPECT_EQ(it.base().base(), cus + cp_indices[2]);
EXPECT_EQ(it->begin().base(), cus + cp_indices[2]);
EXPECT_EQ(it->end().base(), cus + cp_indices[3]);
++it;
EXPECT_EQ(it.base().base(), cus + cp_indices[3]);
EXPECT_EQ(it->begin(), (*it).end());
}
}
| 28.723673 | 157 | 0.506828 | jan-moeller |
c922cf0de9e9e884099c3aebf660c3b338e6381d | 8,126 | cpp | C++ | libs2eplugins/src/s2e/Plugins/StaticAnalysis/EdgeDetector.cpp | sebastianpoeplau/s2e | 995cac6126e7d80337e8c4a72bfa9a87eea7eb68 | [
"MIT"
] | 55 | 2019-12-20T03:25:14.000Z | 2022-01-16T07:19:47.000Z | libs2eplugins/src/s2e/Plugins/StaticAnalysis/EdgeDetector.cpp | Moirai7/s2e | 5a321f76d1a862c3898b9d24de621109b0c12b7d | [
"MIT"
] | 2 | 2020-11-02T08:01:00.000Z | 2022-03-27T02:59:18.000Z | libs2eplugins/src/s2e/Plugins/StaticAnalysis/EdgeDetector.cpp | Moirai7/s2e | 5a321f76d1a862c3898b9d24de621109b0c12b7d | [
"MIT"
] | 11 | 2020-08-06T03:59:45.000Z | 2022-02-25T02:31:59.000Z | ///
/// Copyright (C) 2013-2015, Dependable Systems Laboratory, EPFL
///
/// Permission is hereby granted, free of charge, to any person obtaining a copy
/// of this software and associated documentation files (the "Software"), to deal
/// in the Software without restriction, including without limitation the rights
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
/// copies of the Software, and to permit persons to whom the Software is
/// furnished to do so, subject to the following conditions:
///
/// The above copyright notice and this permission notice shall be included in all
/// copies or substantial portions of the Software.
///
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
/// SOFTWARE.
///
#include <llvm/Support/CommandLine.h>
#include <s2e/ConfigFile.h>
#include <s2e/S2E.h>
#include <s2e/S2EExecutor.h>
#include <s2e/Utils.h>
#include <sstream>
#include "EdgeDetector.h"
namespace s2e {
namespace plugins {
namespace {
// XXX: should go in the config file
llvm::cl::opt<bool> DebugEdgeDetector("s2e-debug-edge-detector", llvm::cl::init(false));
} // namespace
S2E_DEFINE_PLUGIN(EdgeDetector, "Fires an event when a specified sequence of instructions has been executed",
"EdgeDetector", "ModuleExecutionDetector");
void EdgeDetector::initialize() {
m_detector = s2e()->getPlugin<ModuleExecutionDetector>();
readConfig(getConfigKey(), this);
m_detector->onModuleTranslateBlockStart.connect(sigc::mem_fun(*this, &EdgeDetector::onModuleTranslateBlockStart));
m_detector->onModuleTransition.connect(sigc::mem_fun(*this, &EdgeDetector::onModuleTransition));
}
void EdgeDetector::readConfig(const std::string &configKey, IEdgeAdder *adder) {
ConfigFile *cfg = s2e()->getConfig();
ConfigFile::string_list keys = cfg->getListKeys(configKey);
foreach2 (it, keys.begin(), keys.end()) {
const std::string &moduleId = *it;
ModuleExecutionCfg moduleConfig;
if (!m_detector->getModuleConfig(moduleId, moduleConfig)) {
getWarningsStream() << "EdgeDetector: "
<< "module id " << moduleId << " not availble in ModuleExecutionDetector\n";
continue;
}
std::stringstream ss;
ss << configKey << "." << moduleId;
ConfigFile::string_list edge_keys = cfg->getListKeys(ss.str());
foreach2 (eit, edge_keys.begin(), edge_keys.end()) {
const std::string edge_key = *eit;
std::stringstream ss1;
ss1 << ss.str() << "." << edge_key;
ConfigFile::integer_list il = cfg->getIntegerList(ss1.str());
if (il.size() != 2) {
getWarningsStream() << "EdgeDetector entry " << ss1.str()
<< " must be of the form {sourcePc, destPc}\n";
continue;
}
getDebugStream() << "EdgeDetector: " << moduleConfig.moduleName << ": " << hexval(il[0]) << " => "
<< hexval(il[1]) << "\n";
adder->addEdge(moduleConfig.moduleName, il[0], il[1], EDGE_NONE);
}
}
}
void EdgeCollection::addEdge(const std::string &moduleName, uint64_t start, uint64_t end, EdgeType type) {
m_edges[moduleName][start].push_back(EdgeTargetType(end, type));
}
bool EdgeCollection::findEdge(const std::string &moduleName, uint64_t start, uint64_t end, EdgeType *result) {
ModuleEdges::iterator it = m_edges.find(moduleName);
if (it == m_edges.end()) {
return false;
}
Edges &edges = (*it).second;
Edges::iterator eit = edges.find(start);
if (eit == edges.end()) {
return false;
}
EdgeTargets &targets = (*eit).second;
foreach2 (tit, targets.begin(), targets.end()) {
if ((*tit).first == end) {
*result = (*tit).second;
return true;
}
}
return false;
}
void EdgeDetector::addEdge(const std::string &moduleName, uint64_t start, uint64_t end, EdgeType type) {
getDebugStream() << "EdgeDetector: adding edge " << moduleName << " " << hexval(start) << " => " << hexval(end)
<< " type:" << type << "\n";
m_edges.addEdge(moduleName, start, end, type);
}
bool EdgeDetector::findEdge(const std::string &moduleName, uint64_t start, uint64_t end, EdgeType *result) {
return m_edges.findEdge(moduleName, start, end, result);
}
//////////////////////////////////////////////////////
void EdgeDetector::onModuleTransition(S2EExecutionState *state, ModuleDescriptorConstPtr prevModule,
ModuleDescriptorConstPtr nextModule) {
/**
* This handles the case when an exception that is thrown during translation.
* We don't want the signals to be attached for code outside of the module.
*/
m_ins_connection.disconnect();
m_mod_connection.disconnect();
}
void EdgeDetector::onModuleTranslateBlockStart(ExecutionSignal *signal, S2EExecutionState *state,
const ModuleDescriptor &module, TranslationBlock *tb, uint64_t pc) {
/* Disconnect any stale handlers */
m_ins_connection.disconnect();
m_mod_connection.disconnect();
/* Check if we have edges that belong to this module. */
EdgeCollection::const_iterator it = m_edges.find(module.Name);
if (it == m_edges.end()) {
return;
}
m_ins_connection = s2e()->getCorePlugin()->onTranslateInstructionEnd.connect(sigc::bind(
sigc::mem_fun(*this, &EdgeDetector::onTranslateInstructionEnd),
(-module.LoadBase + module.NativeBase) /* Pass an addend to convert the program counter */, &(*it).second));
m_mod_connection = m_detector->onModuleTranslateBlockComplete.connect(
sigc::mem_fun(*this, &EdgeDetector::onModuleTranslateBlockComplete));
}
void EdgeDetector::onTranslateInstructionEnd(ExecutionSignal *signal, S2EExecutionState *state, TranslationBlock *tb,
uint64_t pc, uint64_t addend, const EdgeCollection::Edges *_edges) {
// If pc is in the source list, add a signal to monitor the destination.
// There may be multiple destinations (i.e., >=2 edges from the same source).
uint64_t modulePc = pc + addend;
const EdgeCollection::Edges &edges = *_edges;
EdgeCollection::Edges::const_iterator it = edges.find(modulePc);
if (it == edges.end()) {
return;
}
signal->connect(sigc::bind(sigc::mem_fun(*this, &EdgeDetector::onEdgeInternal), addend, &(*it).second));
}
void EdgeDetector::onEdgeInternal(S2EExecutionState *state, uint64_t sourcePc, uint64_t addend,
const EdgeCollection::EdgeTargets *_targets) {
// XXX: won't work if there is a call instruction in bb a (as in edge a => b)
const EdgeCollection::EdgeTargets &targets = *_targets;
uint64_t moduleDestPc = state->regs()->getPc() + addend;
foreach2 (it, targets.begin(), targets.end()) {
const EdgeCollection::EdgeTargetType &target = *it;
if (moduleDestPc == target.first) {
if (DebugEdgeDetector) {
getInfoStream(state) << "EdgeDetector: " << hexval(sourcePc) << " => " << hexval(state->regs()->getPc())
<< "\n";
}
onEdge.emit(state, sourcePc, target.second);
}
}
}
void EdgeDetector::onModuleTranslateBlockComplete(S2EExecutionState *state, const ModuleDescriptor &module,
TranslationBlock *tb, uint64_t endPc) {
m_ins_connection.disconnect();
m_mod_connection.disconnect();
}
} // namespace plugins
} // namespace s2e
| 40.63 | 120 | 0.643367 | sebastianpoeplau |
c92480fa8879802d00dcbe63a09107d642d6ef25 | 2,672 | hpp | C++ | inst/include/dust/gpu/cuda.hpp | mrc-ide/dust | 24f843d3af30ccd14c233c2db8bcd03bfc42369b | [
"MIT"
] | 14 | 2020-06-02T00:29:43.000Z | 2021-06-20T06:46:33.000Z | inst/include/dust/gpu/cuda.hpp | mrc-ide/dust | 24f843d3af30ccd14c233c2db8bcd03bfc42369b | [
"MIT"
] | 350 | 2020-06-01T18:05:42.000Z | 2022-03-24T17:06:21.000Z | inst/include/dust/gpu/cuda.hpp | mrc-ide/dust | 24f843d3af30ccd14c233c2db8bcd03bfc42369b | [
"MIT"
] | 1 | 2021-09-13T15:25:39.000Z | 2021-09-13T15:25:39.000Z | #ifndef DUST_GPU_CUDA_HPP
#define DUST_GPU_CUDA_HPP
// Important: some key defines occur in
// dust/random/cuda_compatibility.hpp rather than here; they need to
// be there so that the standalone random library will work.
#ifdef __NVCC__
#include <device_launch_parameters.h>
#include <cooperative_groups.h>
#include <cub/cub.cuh>
// CUDA 11 cooperative groups
#if __CUDACC_VER_MAJOR__ >= 11
#include <cooperative_groups/memcpy_async.h>
#endif
#endif
#include "dust/gpu/call.hpp"
#include "dust/random/cuda_compatibility.hpp"
// Prevent accidentally enabling profiling on non-nvcc platforms
#ifndef __NVCC__
#undef DUST_CUDA_ENABLE_PROFILER
#endif
namespace dust {
namespace gpu {
const int warp_size = 32;
#ifdef __NVCC__
template <typename T>
__device__
void shared_mem_cpy(cooperative_groups::thread_block& block, T* shared_ptr,
const T* global_ptr, size_t n_elem) {
#if __CUDACC_VER_MAJOR__ >= 11
cooperative_groups::memcpy_async(block,
shared_ptr,
global_ptr,
sizeof(T) * n_elem);
#else
if (threadIdx.x < warp_size) {
for (int lidx = threadIdx.x; lidx < n_elem; lidx += warp_size) {
shared_ptr[lidx] = global_ptr[lidx];
}
}
#endif
}
__device__ void shared_mem_wait(cooperative_groups::thread_block& block) {
#if __CUDACC_VER_MAJOR__ >= 11
cooperative_groups::wait(block);
#else
__syncthreads();
#endif
}
#endif
// Having more ifdefs here makes code elsewhere clearer, as this can be included
// as type in function arguments
class cuda_stream {
public:
cuda_stream() {
#ifdef __NVCC__
// Handle error manually, as this may be called when nvcc has been used
// to compile, but no device is present on the executing system
cudaError_t status = cudaStreamCreate(&stream_);
if (status == cudaErrorNoDevice) {
stream_ = nullptr;
} else if (status != cudaSuccess) {
dust::gpu::throw_cuda_error(__FILE__, __LINE__, status);
}
#endif
}
#ifdef __NVCC__
~cuda_stream() {
if (stream_ != nullptr) {
CUDA_CALL_NOTHROW(cudaStreamDestroy(stream_));
}
}
cudaStream_t stream() {
return stream_;
}
#endif
void sync() {
#ifdef __NVCC__
CUDA_CALL(cudaStreamSynchronize(stream_));
#endif
}
bool query() const {
bool ready = true;
#ifdef __NVCC__
if (cudaStreamQuery(stream_) != cudaSuccess) {
ready = false;
}
#endif
return ready;
}
private:
// Delete copy and move
cuda_stream ( const cuda_stream & ) = delete;
cuda_stream ( cuda_stream && ) = delete;
#ifdef __NVCC__
cudaStream_t stream_;
#endif
};
}
}
#endif
| 22.266667 | 80 | 0.685629 | mrc-ide |
c926667f12ee50afa92b001e20f68d2a8a57af74 | 5,457 | cpp | C++ | src/FSString.cpp | pperehozhih/transform-cxx | f630079779e9e3cf6d06dcfc04b3ad0bd99d7e48 | [
"BSD-3-Clause"
] | 4 | 2018-09-16T09:55:22.000Z | 2020-12-19T02:02:40.000Z | src/FSString.cpp | pperehozhih/transform-cxx | f630079779e9e3cf6d06dcfc04b3ad0bd99d7e48 | [
"BSD-3-Clause"
] | null | null | null | src/FSString.cpp | pperehozhih/transform-cxx | f630079779e9e3cf6d06dcfc04b3ad0bd99d7e48 | [
"BSD-3-Clause"
] | 2 | 2015-11-24T20:27:35.000Z | 2019-06-04T15:23:30.000Z | /*
* FSString.cpp
* Transform SWF
*
* Created by Stuart MacKay on Thu Feb 13 2003.
* Copyright (c) 2003 Flagstone Software Ltd. All rights reserved.
*
* This file contains Original Code and/or Modifications of Original Code as defined in
* and that are subject to the Flagstone Software Source License Version 1.0 (the
* 'License'). You may not use this file except in compliance with the License. Please
* obtain a copy of the License at http://www.flagstonesoftware.com/licenses/source.html
* and read it before using this file.
*
* The Original Code and all software distributed under the License are distributed on an
* 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, AND Flagstone
* HEREBY DISCLAIMS ALL SUCH WARRANTIES, INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT OF THIRD PARTY
* RIGHTS. Please see the License for the specific language governing rights and limitations
* under the License.
*/
#include "FSString.h"
#include <string.h>
#include "FSException.h"
#include "FSInputStream.h"
#include "FSOutputStream.h"
using namespace transform;
namespace transform
{
FSString::FSString(FSInputStream* aStream) : FSValue(FSValue::String), buffer(0), strLength(0), bufferLength(0)
{
strLength = 0;
bufferLength = strLength + 1;
buffer = new char[bufferLength];
if (bufferLength > 0 && buffer == 0)
throw FSAllocationException("Cannot allocate memory to copy an FSString.");
buffer[0] = '\0';
decodeFromStream(aStream);
}
FSString::FSString(const char* aValue) : FSValue(FSValue::String), buffer(0), strLength(0), bufferLength(0)
{
if (aValue == 0)
aValue = "";
strLength = (int)strlen(aValue);
bufferLength = strLength + 1;
buffer = new char[bufferLength];
if (bufferLength > 0 && buffer == 0)
throw FSAllocationException("Cannot allocate memory to copy an FSString.");
strcpy(buffer, aValue);
}
FSString::FSString(const FSString& rhs) : FSValue(rhs), buffer(0), strLength(0), bufferLength(0)
{
strLength = rhs.length();
bufferLength = strLength + 1;
buffer = new char[bufferLength];
if (bufferLength > 0 && buffer == 0)
throw FSAllocationException("Cannot allocate memory to copy an FSString.");
strcpy(buffer, rhs.buffer);
}
FSString::~FSString()
{
delete [] buffer;
buffer = 0;
}
const char* FSString::className() const
{
const static char _name[] = "FSString";
return _name;
}
const FSString& FSString::operator= (const FSString& rhs)
{
if (this != &rhs)
{
this->FSValue::operator=(rhs);
if (bufferLength < rhs.length() + 1)
{
delete [] buffer;
bufferLength = rhs.length() + 1;
buffer = new char[bufferLength];
if (bufferLength > 0 && buffer == 0)
throw FSAllocationException("Cannot allocate memory to copy an FSString.");
}
strLength = rhs.length();
strcpy(buffer, rhs.buffer);
}
return *this;
}
const FSString& FSString::operator+=(const FSString& rhs)
{
if (this == &rhs)
{
FSString copy(rhs);
return *this += copy;
}
int newLength = length() + rhs.length();
if (newLength >= bufferLength)
{
bufferLength = 2 * (newLength + 1);
char* oldBuffer = buffer;
buffer = new char[ bufferLength ];
if (bufferLength > 0 && buffer == 0)
throw FSAllocationException("Cannot allocate memory to copy an FSString.");
strcpy(buffer, oldBuffer );
delete [] oldBuffer;
}
strcpy(buffer+length(), rhs.buffer);
strLength = newLength;
return *this;
}
int FSString::lengthInStream(FSOutputStream* aStream)
{
int tagLength = FSValue::lengthInStream(aStream);
tagLength += strLength+1;
return tagLength;
}
void FSString::encodeToStream(FSOutputStream* aStream)
{
#ifdef _DEBUG
aStream->startEncoding(className());
#endif
FSValue::encodeToStream(aStream);
aStream->write((byte*)buffer, strLength+1);
#ifdef _DEBUG
aStream->endEncoding(className());
#endif
}
void FSString::decodeFromStream(FSInputStream* aStream)
{
#ifdef _DEBUG
aStream->startDecoding(className());
#endif
FSValue::decodeFromStream(aStream);
buffer = aStream->readString();
strLength = (int)strlen(buffer);
bufferLength = strLength+1;
#ifdef _DEBUG
aStream->endDecoding(className());
#endif
}
/*
* Overloaded operations that can be performed on strings
*/
FSString operator+(const FSString& lhs, const FSString& rhs)
{
FSString result = lhs;
result += rhs;
return result;
}
}
| 28.873016 | 117 | 0.575591 | pperehozhih |
c92766fe41b83766d8d2e2aefa3d6df894063e7e | 8,728 | hpp | C++ | matrix.hpp | ArvinSKushwaha/moldyn | cef3a3545c0975742c0786916b6d40a9f199b281 | [
"MIT"
] | null | null | null | matrix.hpp | ArvinSKushwaha/moldyn | cef3a3545c0975742c0786916b6d40a9f199b281 | [
"MIT"
] | null | null | null | matrix.hpp | ArvinSKushwaha/moldyn | cef3a3545c0975742c0786916b6d40a9f199b281 | [
"MIT"
] | null | null | null | #ifndef MOLDYN_MATRIX_HPP
#define MOLDYN_MATRIX_HPP
#include <algorithm>
#include <cmath>
#include <initializer_list>
#include <vector>
#include <iostream>
#include <functional>
#include <ostream>
#include <numeric>
#include <string>
#include <memory>
template <typename T, size_t M, size_t N>
class Matrix;
template <typename T, size_t N>
using CVec = Matrix<T, N, 1>;
template <typename T, size_t N>
using RVec = Matrix<T, 1, N>;
template <typename T, size_t M, size_t N>
class Matrix {
public:
std::shared_ptr<std::vector<T>> data = std::make_shared<std::vector<T>>(M * N);
size_t rows = M;
size_t cols = N;
size_t stride = 1;
size_t offset = 0;
Matrix() = default;
Matrix(T val) { std::fill(data->begin(), data->end(), val); }
Matrix(std::initializer_list<T> list) { std::copy(list.begin(), list.end(), data->begin()); }
Matrix(const Matrix<T, M, N>& mat) : data(mat.data) {}
template <typename V>
Matrix<V, M, N> map(std::function<V(T)> f) const {
Matrix<V, M, N> result;
for (size_t i = 0; i < M; i++) {
for (size_t j = 0; j < N; j++) {
std::cout << result(i, j) << " " << (*this)(i, j) << " " << f((*this)(i, j)) << " " << i << " " << j << " " << M << " " << N << std::endl;
result(i, j) = f((*this)(i, j));
}
}
return result;
}
template <typename U, typename V>
Matrix<V, M, N> map2(Matrix<U, M, N> m2, std::function<V(T, U)> f) const {
Matrix<V, M, N> result;
for (size_t i = 0; i < M; i++) {
for (size_t j = 0; j < N; j++) {
result(i, j) = f((*this)(i, j), m2(i, j));
}
}
return result;
}
template <typename V>
V accumulate(V init, std::function<V(V, T)> f) const {
for (size_t i = 0; i < M; i++) {
for (size_t j = 0; j < N; j++) {
init = f(init, (*this)(i, j));
}
}
return init;
}
T reduce(std::function<T(T, T)> f) const {
T result = this(0, 0);
for (size_t i = 1; i < M; i++) {
for (size_t j = 0; j < N; j++) {
if (i != 0 && j != 0) { result = f(result, (*this)(i, j)); }
}
}
return result;
}
Matrix<T, M, N> operator+(const Matrix<T, M, N>& mat) const {
return map2<T, T>(mat, std::plus<T>());
}
Matrix<T, M, N> operator-(const Matrix<T, M, N>& mat) const {
return map2<T, T>(mat, std::minus<T>());
}
Matrix<T, M, N> operator*(const Matrix<T, M, N>& mat) const {
return map2<T, T>(mat, std::multiplies<T>());
}
Matrix<T, M, N> operator/(const Matrix<T, M, N>& mat) const {
return map2<T, T>(mat, std::divides<T>());
}
Matrix<T, M, N> operator+(const T& val) const {
return map<T>(std::bind2nd(std::plus<T>(), val));
}
Matrix<T, M, N> operator-(const T& val) const {
return map<T>(std::bind2nd(std::minus<T>(), val));
}
Matrix<T, M, N> operator*(const T& val) const {
return map<T>(std::bind2nd(std::multiplies<T>(), val));
}
Matrix<T, M, N> operator/(const T& val) const {
return map<T>(std::bind2nd(std::divides<T>(), val));
}
Matrix<T, M, N> operator-() const {
return map<T>(std::negate<T>());
}
Matrix<T, M, N> &operator=(const Matrix<T, M, N>& mat) {
for (size_t i = 0; i < M; i++) {
for (size_t j = 0; j < N; j++) {
(*this)(i, j) = mat(i, j);
}
}
return *this;
}
Matrix<T, M, N> &operator+=(const Matrix<T, M, N>& mat) {
return *this = *this + mat;
}
Matrix<T, M, N> &operator-=(const Matrix<T, M, N>& mat) {
return *this = *this - mat;
}
Matrix<T, M, N> &operator*=(const Matrix<T, M, N>& mat) {
return *this = *this * mat;
}
Matrix<T, M, N> &operator/=(const Matrix<T, M, N>& mat) {
return *this = *this / mat;
}
Matrix<T, M, N> &operator+=(const T& val) {
return *this = *this + val;
}
Matrix<T, M, N> &operator-=(const T& val) {
return *this = *this - val;
}
Matrix<T, M, N> &operator*=(const T& val) const {
return *this = *this * val;
}
Matrix<T, M, N> &operator/=(const T& val) const {
return *this = *this / val;
}
template<size_t O>
Matrix<T, M, O> mm(const Matrix<T, N, O>& mat) const {
Matrix<T, M, O> result(0.);
for (int j = 0; j < N; ++j) {
for (int i = 0; i < M; ++i) {
for (int k = 0; k < O; ++k) {
result(i, k) += (*this)(i, j) * mat(j, k);
}
}
}
return result;
}
Matrix<T, N, M> transpose() const {
Matrix<T, N, M> result;
for (int i = 0; i < M; ++i) {
for (int j = 0; j < N; ++j) {
result(j, i) = (*this)(i, j);
}
}
return result;
}
Matrix<bool, M, N> operator==(const Matrix<T, M, N>& m2) const {
return map2(m2, [](T a, T b) { return a == b; });
}
Matrix<bool, M, N> operator!=(const Matrix<T, M, N>& m2) const {
return map2(m2, [](T a, T b) { return a != b; });
}
Matrix<bool, M, N> operator<(const Matrix<T, M, N>& m2) const {
return map2(m2, [](T a, T b) { return a < b; });
}
Matrix<bool, M, N> operator>(const Matrix<T, M, N>& m2) const {
return map2(m2, [](T a, T b) { return a > b; });
}
Matrix<bool, M, N> operator<=(const Matrix<T, M, N>& m2) const {
return map2(m2, [](T a, T b) { return a <= b; });
}
Matrix<bool, M, N> operator>=(const Matrix<T, M, N>& m2) const {
return map2(m2, [](T a, T b) { return a >= b; });
}
T& operator()(size_t i) {
return (*data)[i * stride + offset];
}
T& operator()(size_t i, size_t j) {
std::cout << "operator() " << i << " " << j << " " << stride << " " << offset << " " << (i * M + j) * stride + offset << " " << (*data)[(i * M + j) * stride + offset] << std::endl;
return (*data)[(i * M + j) * stride + offset];
}
const T& operator()(size_t i, size_t j) const {
return (*data)[(i * M + j) * stride + offset];
}
RVec<T, N> row(size_t i) const {
RVec<T, N> result;
result.data = data;
result.offset = i * M;
result.stride = 1;
return result;
}
CVec<T, M> col(size_t j) const {
CVec<T, M> result;
result.data = data;
result.offset = j;
result.stride = 1;
return result;
}
T sum() const {
return accumulate(0, std::plus<T>());
}
T prod() const {
return accumulate(1, std::multiplies<T>());
}
T min() const {
return reduce([](T a, T b) { return a < b ? a : b; });
}
T max() const {
return reduce([](T a, T b) { return a > b ? a : b; });
}
};
template <typename T, size_t M, size_t N>
Matrix<T, M, N> operator+(const T& val, const Matrix<T, M, N> mat) {
return mat + val;
}
template <typename T, size_t M, size_t N>
Matrix<T, M, N> operator-(const T& val, const Matrix<T, M, N> mat) {
return (-mat) + val;
}
template <typename T, size_t M, size_t N>
Matrix<T, M, N> operator*(const T& val, const Matrix<T, M, N> mat) {
return mat * val;
}
template <typename T, size_t M, size_t N>
Matrix<T, M, N> operator/(const T& val, const Matrix<T, M, N> mat) {
return mat.template map<T>(std::bind1st(std::divides<T>(), val));
}
template <typename T, size_t M, size_t N>
std::ostream &operator<<(std::ostream& os, const Matrix<T, M, N> mat) {
if (N == 0 || M == 0) { os << "[ ]"; return os; }
for (size_t i = 0; i < M - 1; ++i) {
os << "[ ";
for (size_t j = 0; j < N - 1; ++j) {
os << mat(i, j) << ", ";
}
os << mat(i, N - 1) << " ]\n";
}
os << "[ " << mat(M - 1, N - 1) << " ]";
return os;
}
#endif
| 35.052209 | 192 | 0.438932 | ArvinSKushwaha |
c928cb81ac5116527c878624f2755360f848dd59 | 4,075 | hpp | C++ | lib/rtos_data/include/rtos_file.hpp | kdeoliveira/coen320 | 4c788b3c2544e57e27bac8a59232f06c7a04d67a | [
"MIT"
] | null | null | null | lib/rtos_data/include/rtos_file.hpp | kdeoliveira/coen320 | 4c788b3c2544e57e27bac8a59232f06c7a04d67a | [
"MIT"
] | null | null | null | lib/rtos_data/include/rtos_file.hpp | kdeoliveira/coen320 | 4c788b3c2544e57e27bac8a59232f06c7a04d67a | [
"MIT"
] | null | null | null | #pragma once
#include <stdio.h>
#include <fstream>
#include <cstring>
#include <memory>
#include <utility>
#include <deque>
#include <sys/stat.h>
#include <rtos_common.hpp>
namespace rtos
{
/**
* @brief Input stream for files. Alternative C implementation of ifstream provided by the std library
* File buffering is set _IOLBF.
* On output, data is written when a newline character is inserted into the stream or when the buffer is full
*/
class InputFile
{
public:
InputFile() = default;
/**
* @brief Construct a new Input File object and creates a new file descriptor for that stream
*
* @param filename absolute path of file
*/
InputFile(const char *filename)
{
if (
( this->file_stream = fopen(filename, "rb+") ) == NULL
){
throw "Unable to open file";
}
this->_line_index = 0;
this->line_stream = new BYTE[BUFFER_SIZE];
this->position = 0L;
this->buffer_stream = new char[BUFFER_SIZE];
if(this->file_stream != NULL)
setvbuf(
this->file_stream, this->buffer_stream, _IOLBF, sizeof(char) * BUFFER_SIZE
);
this->fd = fileno(this->file_stream);
struct stat st;
fstat(this->fd, &st);
this->file_size = st.st_size;
}
InputFile(const InputFile&) = delete;
InputFile& operator=(const InputFile&) = delete;
/**
* @brief Opens file in read mode
*
* @param filename
*/
void open(const char* filename){
try{
this->file_stream = fopen(
filename, "rb+"
);
}catch(std::exception& e){
puts(e.what());
}
}
~InputFile()
{
fflush(this->file_stream);
if (this->file_stream != nullptr) {
fclose(this->file_stream);
}
delete[] this->buffer_stream;
delete[] this->line_stream;
}
/**
* @brief Reads file line by line and stores inside a temporary buffer
* Note that maximum size of read bytes is defined by BUFFER_SIZE
* @return BYTE* char* equivalent value of the buffer.
*/
BYTE* read_line()
{
if( fgets(this->line_stream, BUFFER_SIZE, this->file_stream) == nullptr ){
if(ferror(this->file_stream)) throw "Error reading the file";
return this->line_stream;
}
this->_line_index++;
position = ftell(this->file_stream);
return this->line_stream;
}
/**
* @brief Get current line number
*
* @return const int
*/
const int line_index() const{
return this->_line_index;
}
/**
* @brief Get the file size object
*
* @return const size_t
*/
const size_t get_file_size() const{
return this->file_size;
}
/**
* @brief Get the current position of the stream
*
* @return long int
*/
long int get_position(){
return this->position;
}
/**
* @brief Get a file descriptor for the input stream
*
* @return int
*/
int get_fd(){
return this->fd;
}
/**
* @brief Returns if stream has reached END OF FILE
*
* @return bool
*/
bool is_eof(){
return this->file_size <= this->position;
}
private:
BYTE* line_stream;
FILE* file_stream;
int _line_index;
char* buffer_stream;
long int position;
int fd;
size_t file_size;
};
} | 23.970588 | 113 | 0.488834 | kdeoliveira |
c92a8e7de43c3a0a61cb0a545237b0433e6152cc | 134 | cc | C++ | tests/CompileTests/ElsaTestCases/t0519.cc | maurizioabba/rose | 7597292cf14da292bdb9a4ef573001b6c5b9b6c0 | [
"BSD-3-Clause"
] | 488 | 2015-01-09T08:54:48.000Z | 2022-03-30T07:15:46.000Z | tests/CompileTests/ElsaTestCases/t0519.cc | sujankh/rose-matlab | 7435d4fa1941826c784ba97296c0ec55fa7d7c7e | [
"BSD-3-Clause"
] | 174 | 2015-01-28T18:41:32.000Z | 2022-03-31T16:51:05.000Z | tests/CompileTests/ElsaTestCases/t0519.cc | sujankh/rose-matlab | 7435d4fa1941826c784ba97296c0ec55fa7d7c7e | [
"BSD-3-Clause"
] | 146 | 2015-04-27T02:48:34.000Z | 2022-03-04T07:32:53.000Z | // t0519.cc
// raise xfailure, but a preceding error reduces severity
void foo()
{
x; // preceding error
__cause_xfailure();
}
| 14.888889 | 57 | 0.679104 | maurizioabba |
c92b3231c39474501554b944ab16de72607e034b | 18,453 | cpp | C++ | IGC/DebugInfo/VISAModule.cpp | intel/intelgraphicscompiler | f7a20c6e6bed56933cfbb910a01da77a1d6ae6e4 | [
"Intel",
"MIT"
] | 3 | 2017-09-29T20:02:18.000Z | 2017-11-01T17:33:57.000Z | IGC/DebugInfo/VISAModule.cpp | intel/intelgraphicscompiler | f7a20c6e6bed56933cfbb910a01da77a1d6ae6e4 | [
"Intel",
"MIT"
] | null | null | null | IGC/DebugInfo/VISAModule.cpp | intel/intelgraphicscompiler | f7a20c6e6bed56933cfbb910a01da77a1d6ae6e4 | [
"Intel",
"MIT"
] | null | null | null | /*========================== begin_copyright_notice ============================
Copyright (C) 2017-2021 Intel Corporation
SPDX-License-Identifier: MIT
============================= end_copyright_notice ===========================*/
/*========================== begin_copyright_notice ============================
This file is distributed under the University of Illinois Open Source License.
See LICENSE.TXT for details.
============================= end_copyright_notice ===========================*/
// clang-format off
#include "common/LLVMWarningsPush.hpp"
#include "llvm/ADT/StringExtras.h"
#include "llvm/IR/DebugInfo.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/Module.h"
#include "common/LLVMWarningsPop.hpp"
// clang-format on
#include "LexicalScopes.hpp"
#include "VISADebugInfo.hpp"
#include "VISAModule.hpp"
#include "Utils.hpp"
#include <algorithm>
#include <unordered_map>
#include <vector>
#include "Probe/Assertion.h"
using namespace llvm;
using namespace IGC;
void VISAVariableLocation::dump() const { print(llvm::dbgs()); }
void VISAVariableLocation::print(raw_ostream &OS) const {
OS << " - VarLoc = { ";
if (IsImmediate()) {
OS << "Imm: ";
m_pConstVal->print(OS, true);
} else if (HasSurface()) {
auto PrintExtraSurfaceType = [this](raw_ostream &OS) {
if (IsSLM())
OS << "SLM";
if (IsTexture())
OS << "Texture";
if (IsSampler())
OS << "Sampler";
if (!IsSLM() && !IsTexture() && !IsSampler())
OS << "Unknown";
};
if (!HasLocation()) {
// Simple surface entry
OS << "Type: SimpleSurface, "
<< "SurfaceReg: " << m_surfaceReg << ", Extra: ";
PrintExtraSurfaceType(OS);
} else {
// Surface entry + offset
OS << "Type: Surface, "
<< "SurfaceReg: " << m_surfaceReg;
// Simple surface entry
OS << "Type: SimpleSurface, "
<< "SurfaceReg: " << m_surfaceReg;
if (m_isRegister) {
OS << ", Offset: [VReg=" << m_locationReg << "]";
if (HasLocationSecondReg()) {
OS << ", [VReg2=" << m_locationSecondReg << "]";
}
} else {
OS << ", Offset: " << m_locationOffset;
}
OS << ", IsMem: " << m_isInMemory;
OS << ", Vectorized: ";
if (m_isVectorized)
OS << "v" << m_vectorNumElements;
else
OS << "false";
OS << ", Extra: ";
PrintExtraSurfaceType(OS);
}
} else if (HasLocation()) {
// Address/Register location
if (m_isInMemory) {
OS << "Type: InMem";
OS << ", Loc:";
if (m_isRegister)
OS << "[VReg=" << m_locationReg << "]";
else
OS << "[Offset=" << m_locationOffset << "]";
OS << ", GlobalASID: " << m_isGlobalAddrSpace;
} else {
OS << "Type: Value";
OS << ", VReg: " << m_locationReg;
}
OS << ", Vectorized: ";
if (m_isVectorized)
OS << "v" << m_vectorNumElements;
else
OS << "false";
} else {
std::array<std::pair<const char *, bool>, 7> Props = {
{{"IsImmediate:", IsImmediate()},
{"HasSurface:", HasSurface()},
{"HasLocation:", HasLocation()},
{"IsInMemory:", IsInMemory()},
{"IsRegister:", IsRegister()},
{"IsVectorized:", IsVectorized()},
{"IsInGlobalAddressSpace:", IsInGlobalAddrSpace()}}};
if (std::all_of(Props.begin(), Props.end(),
[](const auto &Item) { return Item.second == false; })) {
OS << "empty";
} else {
OS << "UNEXPECTED_FORMAT: true, ";
OS << "FORMAT: { ";
for (const auto &Prop : Props) {
OS << Prop.first << ": " << Prop.second << ", ";
}
OS << " }";
}
}
OS << " }\n";
}
void VISAModule::BeginInstruction(Instruction *pInst) {
IGC_ASSERT_MESSAGE(!m_instInfoMap.count(pInst), "Instruction emitted twice!");
// Assume VISA Id was updated by this point, validate that.
ValidateVisaId();
unsigned int nextVISAInstId = m_currentVisaId + 1;
m_instInfoMap[pInst] = InstructionInfo(INVALID_SIZE, nextVISAInstId);
m_instList.push_back(pInst);
if (IsCatchAllIntrinsic(pInst)) {
m_catchAllVisaId = nextVISAInstId;
}
}
void VISAModule::EndInstruction(Instruction *pInst) {
IGC_ASSERT_MESSAGE(
m_instList.size() > 0,
"Trying to end Instruction other than the last one called with begin!");
IGC_ASSERT_MESSAGE(
m_instList.back() == pInst,
"Trying to end Instruction other than the last one called with begin!");
IGC_ASSERT_MESSAGE(m_instInfoMap.count(pInst),
"Trying to end instruction more than once!");
IGC_ASSERT_MESSAGE(m_instInfoMap[pInst].m_size == INVALID_SIZE,
"Trying to end instruction more than once!");
// Assume VISA Id was updated by this point, validate that.
ValidateVisaId();
unsigned currInstOffset = m_instInfoMap[pInst].m_offset;
unsigned nextInstOffset = m_currentVisaId + 1;
m_instInfoMap[m_instList.back()].m_size = nextInstOffset - currInstOffset;
}
void VISAModule::BeginEncodingMark() { ValidateVisaId(); }
void VISAModule::EndEncodingMark() { UpdateVisaId(); }
unsigned int VISAModule::GetVisaOffset(const llvm::Instruction *pInst) const {
InstInfoMap::const_iterator itr = m_instInfoMap.find(pInst);
IGC_ASSERT_MESSAGE(itr != m_instInfoMap.end(), "Invalid Instruction");
return itr->second.m_offset;
}
unsigned int VISAModule::GetVisaSize(const llvm::Instruction *pInst) const {
InstInfoMap::const_iterator itr = m_instInfoMap.find(pInst);
IGC_ASSERT_MESSAGE(itr != m_instInfoMap.end(), "Invalid Instruction");
IGC_ASSERT_MESSAGE(itr->second.m_size != INVALID_SIZE, "Invalid Size");
return itr->second.m_size;
}
const Module *VISAModule::GetModule() const { return m_Func->getParent(); }
const Function *VISAModule::GetEntryFunction() const { return m_Func; }
const LLVMContext &VISAModule::GetContext() const {
return GetModule()->getContext();
}
const std::string VISAModule::GetDataLayout() const {
return GetModule()->getDataLayout().getStringRepresentation();
}
const std::string &VISAModule::GetTargetTriple() const { return m_triple; }
bool VISAModule::IsExecutableInst(const llvm::Instruction &inst) {
// Return false if inst is dbg info intrinsic or if it is
// catch all intrinsic. In both of these cases, we dont want
// to emit associated debug loc since there is no machine
// code generated for them.
if (IsCatchAllIntrinsic(&inst))
return false;
if (llvm::isa<DbgInfoIntrinsic>(inst))
return false;
return true;
}
void VISAModule::rebuildVISAIndexes() {
VisaIndexToInst.clear();
VisaIndexToVisaSizeIndex.clear();
for (VISAModule::const_iterator II = begin(), IE = end(); II != IE; ++II) {
const Instruction *pInst = *II;
// store VISA mapping only if pInst generates Gen code
if (!IsExecutableInst(*pInst))
continue;
InstInfoMap::const_iterator itr = m_instInfoMap.find(pInst);
if (itr == m_instInfoMap.end())
continue;
// No VISA instruction emitted corresponding to this llvm IR instruction.
// Typically happens with cast instructions.
if (itr->second.m_size == 0)
continue;
unsigned int currOffset = itr->second.m_offset;
VisaIndexToInst.insert(std::make_pair(currOffset, pInst));
unsigned int currSize = itr->second.m_size;
for (auto VI = currOffset, E = (currOffset + currSize); VI != E; ++VI)
VisaIndexToVisaSizeIndex[VI] = VisaSizeIndex{currOffset, currSize};
}
}
// This function returns a vector of tuples. Each tuple corresponds to a call
// site where physical register startRegNum is saved. Tuple format: <start IP,
// end IP, stack offset>
//
// startIP - %ip where startRegNum is available on BE stack,
// endIP - %ip where startRegNum is available in original location (GRF),
// stack offset - location on BE stack between [startIP - endIP)
//
// This function is called to compute caller save of 1 sub-interval genIsaRange.
// The sub-interval genIsaRange could pass over 0 or more stack call functions.
// A tuple is created for every stack call site that requires save/restore of
// startRegNum.
//
// It is assumed that if startRegNum is within caller save area then entire
// variable is in caller save area.
std::vector<std::tuple<uint64_t, uint64_t, unsigned int>>
VISAModule::getAllCallerSave(const VISAObjectDebugInfo &VDI,
uint64_t startRange, uint64_t endRange,
DbgDecoder::LiveIntervalsVISA &genIsaRange) const {
std::vector<std::tuple<uint64_t, uint64_t, unsigned int>> callerSaveIPs;
if (VDI.getCFI().callerSaveEntry.empty())
return std::move(callerSaveIPs);
if (!genIsaRange.isGRF())
return std::move(callerSaveIPs);
auto startRegNum = genIsaRange.getGRF().regNum;
// There are valid entries in caller save data structure
unsigned int prevSize = 0;
bool inCallerSaveSection = false;
std::vector<DbgDecoder::PhyRegSaveInfoPerIP> saves;
const auto &CFI = VDI.getCFI();
auto callerSaveStartIt = CFI.callerSaveEntry.end();
for (auto callerSaveIt = CFI.callerSaveEntry.begin();
callerSaveIt != CFI.callerSaveEntry.end(); ++callerSaveIt) {
auto &callerSave = (*callerSaveIt);
if (prevSize > 0 && prevSize > callerSave.numEntries &&
!inCallerSaveSection) {
// It means previous there was a call instruction
// between prev and current instruction.
callerSaveStartIt = callerSaveIt;
--callerSaveStartIt;
inCallerSaveSection = true;
}
if ((*callerSaveIt).numEntries == 0 && inCallerSaveSection) {
uint64_t callerSaveIp =
(*callerSaveStartIt).genIPOffset + VDI.getRelocOffset();
uint64_t callerRestoreIp =
(*callerSaveIt).genIPOffset + VDI.getRelocOffset();
// End of current caller save section
if (startRange < callerSaveIp) {
callerRestoreIp = std::min<uint64_t>(endRange, callerRestoreIp);
// Variable is live over stack call function.
for (auto callerSaveReg : (*callerSaveStartIt).data) {
// startRegNum is saved to caller save area around the stack call.
if ((callerSaveReg.srcRegOff / getGRFSizeInBytes()) == startRegNum) {
// Emit caller save/restore only if %ip is within range
callerSaveIPs.emplace_back(std::make_tuple(
callerSaveIp, callerRestoreIp,
(unsigned int)callerSaveReg.dst.m.memoryOffset));
inCallerSaveSection = false;
break;
}
}
}
}
prevSize = callerSave.numEntries;
}
return std::move(callerSaveIPs);
}
void VISAModule::coalesceRanges(
std::vector<std::pair<unsigned int, unsigned int>> &GenISARange) {
// Treat 2 sub-intervals as coalesceable as long %ip end of first interval
// and %ip start of second interval is within a threshold.
// 0x10 is equivalent to 1 asm instruction.
const unsigned int CoalescingThreshold = 0x10;
class Comp {
public:
bool operator()(const std::pair<unsigned int, unsigned int> &a,
const std::pair<unsigned int, unsigned int> &b) {
return a.first < b.first;
}
} Comp;
if (GenISARange.size() == 0)
return;
std::sort(GenISARange.begin(), GenISARange.end(), Comp);
for (unsigned int i = 0; i != GenISARange.size() - 1; i++) {
if (GenISARange[i].first == (unsigned int)-1 &&
GenISARange[i].second == (unsigned int)-1)
continue;
for (unsigned int j = i + 1; j != GenISARange.size(); j++) {
if (GenISARange[j].first == (unsigned int)-1 &&
GenISARange[j].second == (unsigned int)-1)
continue;
if (GenISARange[j].first >= GenISARange[i].second &&
GenISARange[j].first <=
(CoalescingThreshold + GenISARange[i].second)) {
GenISARange[i].second = GenISARange[j].second;
GenISARange[j].first = (unsigned int)-1;
GenISARange[j].second = (unsigned int)-1;
}
}
}
GenISARange.erase(std::remove_if(GenISARange.begin(), GenISARange.end(),
[](const auto &Range) {
return Range.first == -1 &&
Range.second == -1;
}),
GenISARange.end());
}
void VISAModule::print(raw_ostream &OS) const {
OS << "[DBG] VisaModule\n";
OS << " --- VisaIndexToInst Dump\n";
OrderedTraversal(
VisaIndexToInst, [&OS](const auto &VisaIdx, const auto &Inst) {
OS << " VI2Inst: " << VisaIdx << " -> inst: " << *Inst << "\n";
});
OS << " ___\n";
OS << " --- VISAIndexToSize Dump\n";
OrderedTraversal(VisaIndexToVisaSizeIndex,
[&OS](const auto &VisaIdx, const auto &VisaInterval) {
OS << " VI2Size: " << VisaIdx
<< " -> {offset: " << VisaInterval.VisaOffset
<< ", size: " << VisaInterval.VisaInstrNum << "}\n";
});
OS << " ___\n";
}
const llvm::Instruction *getNextInst(const llvm::Instruction *start) {
// Return consecutive instruction in llvm IR.
// Iterate to next BB if required.
if (start->getNextNode())
return start->getNextNode();
else if (start->getParent()->getNextNode())
return &(start->getParent()->getNextNode()->front());
return (const llvm::Instruction *)nullptr;
}
std::vector<std::pair<unsigned int, unsigned int>>
VISAModule::getGenISARange(const VISAObjectDebugInfo &VDI,
const InsnRange &Range) const {
// Given a range, return vector of start-end range for corresponding Gen ISA
// instructions
auto start = Range.first;
auto end = Range.second;
// Range consists of a sequence of LLVM IR instructions. This function needs
// to return a range of corresponding Gen ISA instructions. Instruction
// scheduling in Gen ISA means several independent sub-ranges will be present.
std::vector<std::pair<unsigned int, unsigned int>> GenISARange;
bool endNextInst = false;
const auto &VisaToGenMapping = VDI.getVisaToGenLUT();
const auto &GenToSizeInBytes = VDI.getGenToSizeInBytesLUT();
while (1) {
if (!start || !end || endNextInst)
break;
if (start == end)
endNextInst = true;
// Get VISA index/size for "start" LLVM IR inst
InstInfoMap::const_iterator itr = m_instInfoMap.find(start);
if (itr == m_instInfoMap.end()) {
start = getNextInst(start);
continue;
}
auto startVISAOffset = itr->second.m_offset;
// VISASize indicated # of VISA insts emitted for this
// LLVM IR inst
auto VISASize = GetVisaSize(start);
for (unsigned int i = 0; i != VISASize; i++) {
auto VISAIndex = startVISAOffset + i;
auto it = VisaToGenMapping.find(VISAIndex);
if (it == VisaToGenMapping.end())
continue;
int lastEnd = -1;
for (const auto &genInst : it->second) {
unsigned int sizeGenInst = GenToSizeInBytes.lookup(genInst);
if (GenISARange.size() > 0)
lastEnd = GenISARange.back().second;
if (lastEnd == genInst) {
GenISARange.back().second += sizeGenInst;
} else {
GenISARange.push_back(std::make_pair(genInst, genInst + sizeGenInst));
}
lastEnd = GenISARange.back().second;
}
}
start = getNextInst(start);
}
if (GenISARange.size() == 0)
return GenISARange;
llvm::DenseMap<unsigned, unsigned> unassignedGenOffset;
if (m_catchAllVisaId != 0) {
auto it = VisaToGenMapping.find(m_catchAllVisaId);
if (it != VisaToGenMapping.end()) {
for (const auto &genInst : it->second) {
unsigned int sizeGenInst = GenToSizeInBytes.lookup(genInst);
unassignedGenOffset[genInst] = sizeGenInst;
}
}
// Check whether holes can be filled up using catch all attributed Gen
// instructions
for (unsigned int i = 0; i != GenISARange.size(); i++) {
auto rangeEnd = GenISARange[i].second;
auto it = unassignedGenOffset.find(rangeEnd);
if (it != unassignedGenOffset.end()) {
GenISARange[i].second += (*it).second;
}
}
}
coalesceRanges(GenISARange);
return std::move(GenISARange);
}
const DbgDecoder::VarInfo *
VISAModule::getVarInfo(const VISAObjectDebugInfo &VDI,
unsigned int vreg) const {
auto &Cache = *VICache.get();
if (Cache.empty()) {
for (const auto &VarInfo : VDI.getVISAVariables()) {
StringRef Name = VarInfo.name;
// TODO: what to do with variables starting with "T"?
if (Name.startswith("V")) {
Name = Name.drop_front();
unsigned RegNum = 0;
if (!Name.getAsInteger(10, RegNum))
Cache.insert(std::make_pair(RegNum, &VarInfo));
}
}
}
auto FoundIt = Cache.find(vreg);
if (FoundIt == Cache.end())
return nullptr;
if (FoundIt->second->lrs.empty())
return nullptr;
return FoundIt->second;
}
bool VISAModule::hasOrIsStackCall(const VISAObjectDebugInfo &VDI) const {
const auto &CFI = VDI.getCFI();
if (CFI.befpValid || CFI.frameSize > 0 || CFI.retAddr.size() > 0)
return true;
return IsIntelSymbolTableVoidProgram();
}
const std::vector<DbgDecoder::SubroutineInfo> *
VISAModule::getSubroutines(const VISAObjectDebugInfo &VDI) const {
return &VDI.getSubroutines();
}
const VISAObjectDebugInfo &
VISAModule::getVisaObjectDI(const VISADebugInfo &VD) const {
return VD.getVisaObjectDI(*this);
}
bool VISAVariableLocation::IsSampler() const {
if (!HasSurface())
return false;
auto surface = GetSurface();
if (surface >= VISAModule::SAMPLER_REGISTER_BEGIN &&
surface <
VISAModule::SAMPLER_REGISTER_BEGIN + VISAModule::SAMPLER_REGISTER_NUM)
return true;
return false;
}
bool VISAVariableLocation::IsTexture() const {
if (!HasSurface())
return false;
auto surface = GetSurface();
if (surface >= VISAModule::TEXTURE_REGISTER_BEGIN &&
surface <
VISAModule::TEXTURE_REGISTER_BEGIN + VISAModule::TEXTURE_REGISTER_NUM)
return true;
return false;
}
bool VISAVariableLocation::IsSLM() const {
if (!HasSurface())
return false;
auto surface = GetSurface();
if (surface ==
VISAModule::LOCAL_SURFACE_BTI + VISAModule::TEXTURE_REGISTER_BEGIN)
return true;
return false;
}
| 33.069892 | 80 | 0.632363 | intel |
c92d479a517780a1c04d34b12e83a6d5821280d1 | 2,928 | hpp | C++ | Paper/Curve.hpp | mokafolio/Paper | d7e9c1450b29b1d3d8873de4f959bffa02232055 | [
"MIT"
] | 20 | 2016-12-13T22:34:35.000Z | 2021-09-20T12:44:56.000Z | Paper/Curve.hpp | mokafolio/Paper | d7e9c1450b29b1d3d8873de4f959bffa02232055 | [
"MIT"
] | null | null | null | Paper/Curve.hpp | mokafolio/Paper | d7e9c1450b29b1d3d8873de4f959bffa02232055 | [
"MIT"
] | null | null | null | #ifndef PAPER_CURVE_HPP
#define PAPER_CURVE_HPP
#include <Paper/Path.hpp>
namespace paper
{
class CurveLocation;
class Segment;
class STICK_API Curve
{
friend class Path;
friend class Segment;
public:
Curve();
Curve(const Path & _path, stick::Size _segmentA, stick::Size _segmentB);
Path path() const;
void setPositionOne(const Vec2f & _vec);
void setHandleOne(const Vec2f & _vec);
void setPositionTwo(const Vec2f & _vec);
void setHandleTwo(const Vec2f & _vec);
const Vec2f & positionOne() const;
const Vec2f & positionTwo() const;
const Vec2f & handleOne() const;
Vec2f handleOneAbsolute() const;
const Vec2f & handleTwo() const;
Vec2f handleTwoAbsolute() const;
Segment & segmentOne();
const Segment & segmentOne() const;
Segment & segmentTwo();
const Segment & segmentTwo() const;
Vec2f positionAt(Float _offset) const;
Vec2f normalAt(Float _offset) const;
Vec2f tangentAt(Float _offset) const;
Float curvatureAt(Float _offset) const;
Float angleAt(Float _offset) const;
stick::Maybe<Curve&> divideAt(Float _offset);
Vec2f positionAtParameter(Float _t) const;
Vec2f normalAtParameter(Float _t) const;
Vec2f tangentAtParameter(Float _t) const;
Float curvatureAtParameter(Float _t) const;
Float angleAtParameter(Float _t) const;
stick::Maybe<Curve&> divideAtParameter(Float _t);
Float parameterAtOffset(Float _offset) const;
Float closestParameter(const Vec2f & _point) const;
Float closestParameter(const Vec2f & _point, Float & _outDistance) const;
Float lengthBetween(Float _tStart, Float _tEnd) const;
Float pathOffset() const;
void peaks(stick::DynamicArray<Float> & _peaks) const;
void extrema(stick::DynamicArray<Float> & _extrema) const;
CurveLocation closestCurveLocation(const Vec2f & _point) const;
CurveLocation curveLocationAt(Float _offset) const;
CurveLocation curveLocationAtParameter(Float _t) const;
bool isLinear() const;
bool isStraight() const;
bool isArc() const;
bool isOrthogonal(const Curve & _other) const;
bool isCollinear(const Curve & _other) const;
Float length() const;
Float area() const;
const Rect & bounds() const;
Rect bounds(Float _padding) const;
const Bezier & bezier() const;
private:
void markDirty();
Path m_path;
stick::Size m_segmentA;
stick::Size m_segmentB;
Bezier m_curve;
mutable bool m_bLengthCached;
mutable bool m_bBoundsCached;
mutable Float m_length;
mutable Rect m_bounds;
};
}
#endif //PAPER_CURVE_HPP
| 21.372263 | 81 | 0.635929 | mokafolio |
c92e15e6011444b62e2084bf8b7b9f2ce6012528 | 3,642 | cpp | C++ | 3.三维空间刚体运动/useGeometry/eigenGeometry_test.cpp | HustRobot/VSLAM | e6759dc3769b3cca6ecf551a3bf120b0edeaeaa3 | [
"MIT"
] | 24 | 2019-03-14T06:00:15.000Z | 2022-03-04T06:35:49.000Z | 3.三维空间刚体运动/useGeometry/eigenGeometry_test.cpp | HustRobot/VSLAM | e6759dc3769b3cca6ecf551a3bf120b0edeaeaa3 | [
"MIT"
] | null | null | null | 3.三维空间刚体运动/useGeometry/eigenGeometry_test.cpp | HustRobot/VSLAM | e6759dc3769b3cca6ecf551a3bf120b0edeaeaa3 | [
"MIT"
] | 13 | 2018-09-17T15:56:51.000Z | 2022-03-03T07:27:34.000Z | /*=================================================================================
* Copyleft! 2018 William Yu
* Some rights reserved:CC(creativecommons.org)BY-NC-SA
* Copyleft! 2018 William Yu
* 版权部分所有,遵循CC(creativecommons.org)BY-NC-SA协议授权方式使用
*
* Filename :
* Description : 视觉SLAM十四讲/ch3/useGeometry/eigenGeometry.cpp 学习记录
矩阵库
* Reference :
* Programmer(s) : William Yu, windmillyucong@163.com
* Company : HUST, DMET国家重点实验室FOCUS团队
* Modification History : ver1.0, 2018.03.26, William Yu
=================================================================================*/
/// Include Files
#include <iostream>
#include <cmath>
#include <Eigen/Core>
// Eigen 几何模块
#include <Eigen/Geometry>
using namespace std;
/// Global Variables
/// Function Definitions
/**
* @function main
* @author William Yu
* @brief Eigen几何模块的使用方法
* @param None
* @retval None
*/
int main ( int argc, char** argv )
{
//---------------------------------------------------------------------------
// 旋转平移表示
//----------------------------------------------------------------
// Eigen/Geometry 几何模块提供了各种旋转和平移的表示
// 3D 旋转矩阵直接使用 Matrix3d 或 Matrix3f
Eigen::Matrix3d rotation_matrix = Eigen::Matrix3d::Identity();
// 旋转向量使用 AngleAxis, 它底层不直接是Matrix,但运算可以当作矩阵(因为重载了运算符)
Eigen::AngleAxisd rotation_vector ( M_PI/4, Eigen::Vector3d ( 0,0,1 ) ); //沿 Z 轴旋转 45 度
cout .precision(3);
cout<<"rotation matrix =\n"<<rotation_vector.matrix() <<endl; //用matrix()转换成矩阵
// 也可以直接赋值
rotation_matrix = rotation_vector.toRotationMatrix();
// 用 AngleAxis 可以进行坐标变换
Eigen::Vector3d v ( 1,0,0 );
Eigen::Vector3d v_rotated = rotation_vector * v;
cout<<"(1,0,0) after rotation = "<<v_rotated.transpose()<<endl;
// 或者用旋转矩阵
v_rotated = rotation_matrix * v;
cout<<"(1,0,0) after rotation = "<<v_rotated.transpose()<<endl;
//---------------------------------------------------------------------------
// 欧拉角
//----------------------------------------------------------------
//-- 可以将旋转矩阵直接转换成欧拉角
Eigen::Vector3d euler_angles = rotation_matrix.eulerAngles ( 2,1,0 ); // ZYX顺序,即roll pitch yaw顺序
cout<<"yaw pitch roll = "<<euler_angles.transpose()<<endl;
// 欧氏变换矩阵使用 Eigen::Isometry
Eigen::Isometry3d T=Eigen::Isometry3d::Identity(); // 虽然称为3d,实质上是4*4的矩阵
T.rotate ( rotation_vector ); // 按照rotation_vector进行旋转
T.pretranslate ( Eigen::Vector3d ( 1,3,4 ) ); // 把平移向量设成(1,3,4)
cout << "Transform matrix = \n" << T.matrix() <<endl;
// 用变换矩阵进行坐标变换
Eigen::Vector3d v_transformed = T*v; // 相当于R*v+t
cout<<"v tranformed = "<<v_transformed.transpose()<<endl;
// 对于仿射和射影变换,使用 Eigen::Affine3d 和 Eigen::Projective3d 即可,略
//---------------------------------------------------------------------------
// 四元数
//----------------------------------------------------------------
// 可以直接把AngleAxis赋值给四元数,反之亦然
Eigen::Quaterniond q = Eigen::Quaterniond ( rotation_vector );
cout<<"quaternion = \n"<<q.coeffs() <<endl; // 请注意coeffs的顺序是(x,y,z,w),w为实部,前三者为虚部
// 也可以把旋转矩阵赋给它
q = Eigen::Quaterniond ( rotation_matrix );
cout<<"quaternion = \n"<<q.coeffs() <<endl;
// 使用四元数旋转一个向量,使用重载的乘法即可
v_rotated = q*v; // 注意数学上是qvq^{-1}
cout<<"(1,0,0) after rotation = "<<v_rotated.transpose()<<endl;
return 0;
}
| 36.787879 | 100 | 0.494509 | HustRobot |
c9315d56f9441080a8b66650198537cc54ca3647 | 758 | cpp | C++ | code/select.cpp | ldionne/cppnow-2016-metaprogramming-for-the-brave | 580f900d778553b8a7affc1dd02bbc597f992df6 | [
"MIT"
] | 6 | 2016-05-25T08:10:50.000Z | 2017-09-14T14:36:48.000Z | code/select.cpp | ldionne/cppnow-2016-metaprogramming-for-the-brave | 580f900d778553b8a7affc1dd02bbc597f992df6 | [
"MIT"
] | null | null | null | code/select.cpp | ldionne/cppnow-2016-metaprogramming-for-the-brave | 580f900d778553b8a7affc1dd02bbc597f992df6 | [
"MIT"
] | null | null | null | // Copyright Louis Dionne 2016
// Distributed under the Boost Software License, Version 1.0.
#include <cassert>
#include <cstddef>
#include <tuple>
#include <utility>
// sample(main)
template <typename Tuple, std::size_t ...i>
auto select(Tuple&& tuple, std::index_sequence<i...> const&) {
using Result = std::tuple<
std::tuple_element_t<i, std::remove_reference_t<Tuple>>...
>;
return Result{std::get<i>(static_cast<Tuple&&>(tuple))...};
}
// end-sample
int main() {
long four = 4;
std::tuple<int, char, float, long&> ts{1, '2', 3.3f, four};
auto slice = select(ts, std::index_sequence<0, 2, 3>{});
assert(std::get<0>(slice) == 1);
assert(std::get<1>(slice) == 3.3f);
assert(&std::get<2>(slice) == &four);
}
| 26.137931 | 66 | 0.624011 | ldionne |
c934276b0a48baf1042071193079a10853d017ed | 3,507 | cpp | C++ | src/realm/sync/object_id.cpp | aleyooop/realm-core | 9874d5164927ea39273b241a5af14b596a3233e9 | [
"Apache-2.0"
] | 977 | 2016-09-27T12:54:24.000Z | 2022-03-29T08:08:47.000Z | src/realm/sync/object_id.cpp | aleyooop/realm-core | 9874d5164927ea39273b241a5af14b596a3233e9 | [
"Apache-2.0"
] | 2,265 | 2016-09-27T13:01:26.000Z | 2022-03-31T17:55:37.000Z | src/realm/sync/object_id.cpp | aleyooop/realm-core | 9874d5164927ea39273b241a5af14b596a3233e9 | [
"Apache-2.0"
] | 154 | 2016-09-27T14:02:56.000Z | 2022-03-27T14:51:00.000Z | #include <realm/sync/object_id.hpp>
#include <realm/util/backtrace.hpp>
#include <realm/util/overload.hpp>
#include <sstream>
#include <iomanip>
#include <ostream>
#include <cctype> // std::isxdigit
#include <stdlib.h> // strtoull
using namespace realm;
using namespace realm::sync;
std::ostream& realm::sync::operator<<(std::ostream& os, format_pk fmt)
{
const auto& key = fmt.pk;
auto formatter = util::overload{
[&](mpark::monostate) {
os << "NULL";
},
[&](int64_t x) {
os << "Int(" << x << ")";
},
[&](StringData x) {
os << "\"" << x << "\"";
},
[&](GlobalKey x) {
os << "GlobalKey{" << x << "}";
},
[&](ObjectId x) {
os << "ObjectId{" << x << "}";
},
[&](UUID x) {
os << "UUID{" << x << "}";
},
};
mpark::visit(formatter, key);
return os;
}
void ObjectIDSet::insert(StringData table, const PrimaryKey& object_id)
{
m_objects[table].insert(object_id);
}
void ObjectIDSet::erase(StringData table, const PrimaryKey& object_id)
{
auto search = m_objects.find(table);
if (search != m_objects.end()) {
auto& single_table_ids = search->second;
single_table_ids.erase(object_id);
if (single_table_ids.empty())
m_objects.erase(table);
}
}
bool ObjectIDSet::contains(StringData table, const PrimaryKey& object_id) const noexcept
{
auto search = m_objects.find(table);
if (search != m_objects.end()) {
const auto& single_table_ids = search->second;
return single_table_ids.find(object_id) != single_table_ids.end();
}
return false;
}
void FieldSet::insert(StringData table, StringData column, const PrimaryKey& object_id)
{
m_fields[table][column].insert(object_id);
}
void FieldSet::erase(StringData table, StringData column, const PrimaryKey& object_id)
{
auto search_1 = m_fields.find(table);
if (search_1 != m_fields.end()) {
auto& single_table_fields = search_1->second;
auto search_2 = single_table_fields.find(column);
if (search_2 != single_table_fields.end()) {
auto& single_field_ids = search_2->second;
single_field_ids.erase(object_id);
if (single_field_ids.empty()) {
single_table_fields.erase(column);
if (single_table_fields.empty()) {
m_fields.erase(table);
}
}
}
}
}
bool FieldSet::contains(StringData table, const PrimaryKey& object_id) const noexcept
{
auto search_1 = m_fields.find(table);
if (search_1 == m_fields.end())
return false;
const auto& single_table_fields = search_1->second;
for (const auto& kv : single_table_fields) {
const auto& single_field_ids = kv.second;
if (single_field_ids.find(object_id) != single_field_ids.end())
return true;
}
return false;
}
bool FieldSet::contains(StringData table, StringData column, const PrimaryKey& object_id) const noexcept
{
auto search_1 = m_fields.find(table);
if (search_1 == m_fields.end())
return false;
const auto& single_table_fields = search_1->second;
auto search_2 = single_table_fields.find(column);
if (search_2 == single_table_fields.end())
return false;
const auto& single_field_ids = search_2->second;
return single_field_ids.find(object_id) != single_field_ids.end();
}
| 29.225 | 104 | 0.611064 | aleyooop |
c935e0e85242912c0782350958aa0f76a4104813 | 1,163 | cpp | C++ | online_judges/cf/4/d/d.cpp | miaortizma/competitive-programming | ea5adfc07e49935acfc0697eeb0a12c7dc6cd8cc | [
"MIT"
] | 2 | 2018-02-20T14:44:57.000Z | 2018-02-20T14:45:03.000Z | online_judges/cf/4/d/d.cpp | miaortizma/competitive-programming | ea5adfc07e49935acfc0697eeb0a12c7dc6cd8cc | [
"MIT"
] | null | null | null | online_judges/cf/4/d/d.cpp | miaortizma/competitive-programming | ea5adfc07e49935acfc0697eeb0a12c7dc6cd8cc | [
"MIT"
] | null | null | null | #include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
const int N = 5 * 1e3 + 100;
struct dta {
int w, h, i;
dta() : w(0), h(0), i(0) {}
dta(int w, int h, int i) : w(w), h(h), i(i) {}
};
dta arr[N];
bool cmp(dta lh, dta rh) {
if (lh.w == rh.w)
return lh.h < rh.h;
return lh.w < rh.w;
}
int dp[N], par[N];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(NULL);
int n, w, h;
cin >> n >> w >> h;
for (int i = 0; i < n; ++i) {
int a, b;
cin >> a >> b;
arr[i] = {a, b, i + 1};
}
memset(par, -1, sizeof par);
sort(arr, arr + n, cmp);
int ans = 0, b = -1;
for (int i = n - 1; i >= 0; --i) {
for (int j = i + 1; j < n; ++j) {
if (arr[j].w > arr[i].w && arr[j].h > arr[i].h) {
if (dp[j] + 1 > dp[i]) {
par[arr[i].i] = arr[j].i;
dp[i] = dp[j] + 1;
}
}
}
if (arr[i].w > w && arr[i].h > h) {
if (dp[i] + 1 > ans) {
ans = dp[i] + 1;
b = arr[i].i;
}
}
}
if (b == -1) {
cout << 0;
} else {
cout << ans << "\n";
while (b != -1) {
cout << b << " ";
b = par[b];
}
}
return 0;
}
| 18.460317 | 55 | 0.395529 | miaortizma |
c93666f2e7be1e981a70a41062f5d15214e678d2 | 15,842 | cpp | C++ | trunk/win/Source/BT_MouseEventManager.cpp | dyzmapl/BumpTop | 1329ea41411c7368516b942d19add694af3d602f | [
"Apache-2.0"
] | 460 | 2016-01-13T12:49:34.000Z | 2022-02-20T04:10:40.000Z | trunk/win/Source/BT_MouseEventManager.cpp | dyzmapl/BumpTop | 1329ea41411c7368516b942d19add694af3d602f | [
"Apache-2.0"
] | 24 | 2016-11-07T04:59:49.000Z | 2022-03-14T06:34:12.000Z | trunk/win/Source/BT_MouseEventManager.cpp | dyzmapl/BumpTop | 1329ea41411c7368516b942d19add694af3d602f | [
"Apache-2.0"
] | 148 | 2016-01-17T03:16:43.000Z | 2022-03-17T12:20:36.000Z | // Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "BT_Common.h"
#include "BT_Camera.h"
#include "BT_LassoMenu.h"
#include "BT_Macros.h"
#include "BT_MouseEventHandler.h"
#include "BT_MouseEventManager.h"
#include "BT_OverlayComponent.h"
#include "BT_Pile.h"
#include "BT_RaycastReports.h"
#include "BT_SceneManager.h"
#include "BT_Selection.h"
#include "BT_Util.h"
#include "BT_WebActor.h"
#include "BT_WindowsOS.h"
#include "Bumptop.h"
// -----------------------------------------------------------------------------
MouseEventManager::MouseEventManager()
{
mouseButtons = 0;
lastMouseButtons = 0;
primaryTouch = NULL;
primaryTouchX = 0;
primaryTouchY = 0;
_prevMouseDown = NULL;
}
MouseEventManager::~MouseEventManager()
{
}
void MouseEventManager::onMouseEvent(UINT message, int x, int y, short mouseWheelDelta, MousePointer* pointer)
{
assert(pointer != NULL);
// in case we didn't get the mouse up event
if (primaryTouch != NULL &&
!primaryTouch->isMouseLeftDown() &&
!primaryTouch->isMouseMiddleDown() &&
!primaryTouch->isMouseRightDown())
primaryTouch = NULL;
// if we don't have a primary pointer, and if this pointer isn't already down in
// "additional touch" mode, use the normal BumpTop mouse handlers
if ((primaryTouch == NULL || primaryTouch == pointer) &&
additionalTouches.find(pointer) == additionalTouches.end())
{
primaryTouch = pointer;
primaryTouchX = x;
primaryTouchY = y;
switch(message)
{
case WM_LBUTTONUP:
GLOBAL(mouseUpTriggered) = true;
if (mouseButtons & MouseButtonLeft) mouseButtons &= ~MouseButtonLeft;
onPrimaryMouseUp(Vec2(float(x), float(y), 0.0f), MouseButtonLeft);
break;
case WM_RBUTTONUP:
// Right Mouse Up
if (mouseButtons & MouseButtonRight) mouseButtons &= ~MouseButtonRight;
onPrimaryMouseUp(Vec2(float(x), float(y), 0.0f), MouseButtonRight);
break;
case WM_MBUTTONUP:
// Middle Mouse Up
if (mouseButtons & MouseButtonMiddle) mouseButtons &= ~MouseButtonMiddle;
onPrimaryMouseUp(Vec2(float(x), float(y), 0.0f), MouseButtonMiddle);
break;
case WM_LBUTTONDOWN:
// Left Mouse Down
mouseButtons |= MouseButtonLeft;
onPrimaryMouseDown(Vec2(float(x), float(y), 0.0f), MouseButtonLeft);
break;
case WM_RBUTTONDOWN:
// Right Mouse Down
mouseButtons |= MouseButtonRight;
onPrimaryMouseDown(Vec2(float(x), float(y), 0.0f), MouseButtonRight);
break;
case WM_MBUTTONDOWN:
// Middle Mouse Down
mouseButtons |= MouseButtonMiddle;
onPrimaryMouseDown(Vec2(float(x), float(y), 0.0f), MouseButtonMiddle);
break;
case WM_MOUSEWHEEL:
// Process mouse wheel movement
if (mouseWheelDelta > 0)
{
// Remove the scroll event because it does not have a mouse Up event [mvj ??]
//button |= MouseButtonScrollUp;
onPrimaryMouseUp(Vec2(float(x), float(y), mouseWheelDelta), MouseButtonScrollUp);
}else{
// Remove the scroll event because it does not have a mouse Up event [mvj ??]
//button |= MouseButtonScrollDn;
onPrimaryMouseUp(Vec2(float(x), float(y), mouseWheelDelta), MouseButtonScrollDn);
}
break;
case WM_MOUSEMOVE:
onPrimaryMouseMove(Vec2(float(x), float(y), 0.0f));
break;
default:
MessageBox(NULL, L"unknown message", L"err", MB_OK | MB_ICONERROR);
break;
}
if (pointer->isMouseLeftDown() || pointer->isMouseMiddleDown() || pointer->isMouseRightDown())
{
primaryTouch = pointer;
}
else
{
primaryTouch = NULL;
}
// Remove the scroll event because it does not have a mouse Up event
if (mouseButtons & MouseButtonScrollUp)
{
mouseButtons &= ~MouseButtonScrollUp;
}else if (mouseButtons & MouseButtonScrollDn)
{
mouseButtons &= ~MouseButtonScrollDn;
}
}
else // if there is already a touch, we use the handlers for additional touches
{
switch(message)
{
case WM_LBUTTONUP:
onAdditionalMouseUp(Vec2(float(x), float(y), 0.0f), MouseButtonLeft, pointer);
break;
case WM_RBUTTONUP:
onAdditionalMouseUp(Vec2(float(x), float(y), 0.0f), MouseButtonRight, pointer);
break;
case WM_MBUTTONUP:
onAdditionalMouseUp(Vec2(float(x), float(y), 0.0f), MouseButtonMiddle, pointer);
break;
case WM_LBUTTONDOWN:
onAdditionalMouseDown(Vec2(float(x), float(y), 0.0f), MouseButtonLeft, pointer);
break;
case WM_RBUTTONDOWN:
onAdditionalMouseDown(Vec2(float(x), float(y), 0.0f), MouseButtonRight, pointer);
break;
case WM_MBUTTONDOWN:
onAdditionalMouseDown(Vec2(float(x), float(y), 0.0f), MouseButtonMiddle, pointer);
break;
case WM_MOUSEWHEEL:
// we don't do anything here now
break;
}
}
}
void MouseEventManager::onPrimaryMouseDown(Vec2 &pt, MouseButtons button)
{
// don't handle MouseDown events if the camera is moving or a WebActor is zoomed in
if (cam->isAnimating())
return;
else if (WebActor::hasFocusedWebActor())
{
WebActor::zoomOutFocusedWebActor();
return;
}
#ifdef ENABLE_WEBKIT
vector<BumpObject *> objs = scnManager->getBumpObjects(ObjectType(BumpActor, Webpage));
for (int i = 0; i < objs.size(); ++i)
{
WebActor * actor = (WebActor *) objs[i];
if (!actor->isFocused() && sel->getPickedActor() && (actor != sel->getPickedActor()))
continue;
Qt::KeyboardModifiers modifiers = 0;
if (winOS->IsKeyDown(KeyControl))
modifiers |= Qt::ControlModifier;
if (winOS->IsKeyDown(KeyShift))
modifiers |= Qt::ShiftModifier;
if (winOS->IsKeyDown(KeyAlt))
modifiers |= Qt::AltModifier;
Qt::MouseButton b = Qt::NoButton;
if (button == MouseButtonLeft)
b = Qt::LeftButton;
if (button == MouseButtonRight)
b = Qt::RightButton;
if (button == MouseButtonMiddle)
b = Qt::MidButton;
// we defer the mouse event to mouse up since we don't want to pass in mouse events when the
// object is dragged in non-focused mode
QMouseEvent * evt = new QMouseEvent(QEvent::MouseButtonPress, QPoint(pt.x, pt.y), b, _buttons, modifiers);
if (actor->isFocused())
{
if (actor->onMouseEvent(evt))
{
_buttons |= b;
return;
}
}
else
{
_buttons |= b;
SAFE_DELETE(_prevMouseDown);
_prevMouseDown = evt;
}
}
#endif
// For funsies :)
#ifndef _DEBUG
if (GLOBAL(settings).enableDebugKeys)
#endif
{
if (winOS->IsKeyDown(KeyAlt) && winOS->IsKeyDown(KeyControl) && winOS->IsKeyDown(KeyLeftShift))
{
ForcePush(pt);
return;
}
}
// get focus (Windows does this automatically for you normally, but we are running
// into cases where BumpTop, on startup, will not get keyboard focus even if you
// click on it)
winOS->SetFocusOnWindow();
// pass the event onto the handlers
for (uint i = 0; i < handlerList.size(); i++)
{
// NOTE: special case, leave the lasso menu handler till after the overlays
if (handlerList[i] != lassoMenu)
{
if (handlerList[i]->onMouseDown(pt, button))
return;
}
}
// let the overlays intercept the event
vector<OverlayLayout *> overlays = scnManager->getOverlays();
for (int i = 0; i < overlays.size(); ++i)
{
Vec3 dims = overlays[i]->getSize();
Vec3 point(pt.x, dims.y - pt.y, 0.0f);
if (overlays[i]->onMouseDown(MouseOverlayEvent(overlays[i], point, point, button)))
return;
}
// don't lasso or handle mouse events (right-click menu) while viewing photo frames
if (cam->inSlideshow())
{
// only skip non-leftmouse buttons, since we want the user to still
// be able to swipe to move to the next image
if (button & ~MouseButtonLeft)
return;
}
// NOTE: see above, we leave the lasso menu handling for mouse down until after the
// overlays
lassoMenu->onMouseDown(pt, button);
// REFACTOR: get rid of this
MouseCallback(button, GLUT_DOWN, int(pt.x), int(pt.y));
}
void MouseEventManager::onPrimaryMouseUp(Vec2 &pt, MouseButtons button)
{
// don't handle MouseUp events if the camera is moving or a WebActor is zoomed in
if (cam->isAnimating())
return;
else if (WebActor::hasFocusedWebActor())
{
WebActor::zoomOutFocusedWebActor();
return;
}
#ifdef ENABLE_WEBKIT
vector<BumpObject *> objs = scnManager->getBumpObjects(ObjectType(BumpActor, Webpage));
for (int i = 0; i < objs.size(); ++i)
{
WebActor * actor = (WebActor *) objs[i];
if (!actor->isFocused() && !sel->isInSelection(actor))
continue;
if (actor->isParentType(BumpPile) && ((Pile *) actor->getParent())->getActiveLeafItem() == actor)
continue;
if (button == MouseButtonScrollDn ||
button == MouseButtonScrollUp)
{
if (actor->isFocused() || sel->getSize() == 1)
{
bool vertical = true;
QPoint pos(pt.x, pt.y);
Qt::KeyboardModifiers modifiers = 0;
if (winOS->IsKeyDown(KeyControl))
modifiers |= Qt::ControlModifier;
if (winOS->IsKeyDown(KeyShift))
{
modifiers |= Qt::ShiftModifier;
vertical = false;
}
if (winOS->IsKeyDown(KeyAlt))
modifiers |= Qt::AltModifier;
QWheelEvent * evt = new QWheelEvent(pos, pos, pt.z, _buttons, modifiers, (vertical ? Qt::Vertical : Qt::Horizontal));
actor->onWheelEvent(evt);
return;
}
}
else if ((int)_buttons)
{
Qt::KeyboardModifiers modifiers = 0;
if (winOS->IsKeyDown(KeyControl))
modifiers |= Qt::ControlModifier;
if (winOS->IsKeyDown(KeyShift))
modifiers |= Qt::ShiftModifier;
if (winOS->IsKeyDown(KeyAlt))
modifiers |= Qt::AltModifier;
Qt::MouseButton b = Qt::NoButton;
if (button == MouseButtonLeft)
b = Qt::LeftButton;
if (button == MouseButtonRight)
b = Qt::RightButton;
if (button == MouseButtonMiddle)
b = Qt::MidButton;
QMouseEvent * evt = new QMouseEvent(QEvent::MouseButtonRelease, QPoint(pt.x, pt.y), b, _buttons, modifiers);
if (_prevMouseDown)
{
// send the saved mouse down event first if necessary
actor->onMouseEvent(_prevMouseDown);
_prevMouseDown = NULL;
}
actor->onMouseEvent(evt);
_buttons &= ~b;
if (actor->isFocused())
return;
}
}
#endif
// let the overlays intercept the event
vector<OverlayLayout *> overlays = scnManager->getOverlays();
for (int i = 0; i < overlays.size(); ++i)
{
Vec3 dims = overlays[i]->getSize();
Vec3 point(pt.x, dims.y - pt.y, 0.0f);
if (overlays[i]->onMouseUp(MouseOverlayEvent(overlays[i], point, point, button)))
return;
}
// REFACTOR: get rid of this
MouseCallback(button, GLUT_UP, int(pt.x), int(pt.y));
for (uint i = 0; i < handlerList.size(); i++)
{
// Send all handlers a mouse up
handlerList[i]->onMouseUp(pt, button);
}
}
void MouseEventManager::onPrimaryMouseMove(Vec2 &pt)
{
#ifdef ENABLE_WEBKIT
vector<BumpObject *> objs = scnManager->getBumpObjects(ObjectType(BumpActor, Webpage));
for (int i = 0; i < objs.size(); ++i)
{
// disable clicking on the widget
WebActor * actor = (WebActor *) objs[i];
Qt::KeyboardModifiers modifiers = 0;
if (winOS->IsKeyDown(KeyControl))
modifiers |= Qt::ControlModifier;
if (winOS->IsKeyDown(KeyShift))
modifiers |= Qt::ShiftModifier;
if (winOS->IsKeyDown(KeyAlt))
modifiers |= Qt::AltModifier;
if (actor->isFocused())
{
bool handled = false;
QMouseEvent * evt = new QMouseEvent(QEvent::MouseMove, QPoint(pt.x, pt.y), Qt::NoButton, _buttons, modifiers);
if (actor->onMouseEvent(evt))
handled = true;
// ensure that the buttons are actually down still
if (_buttons.testFlag(Qt::LeftButton) && !winOS->IsButtonDown(MouseButtonLeft))
{
onPrimaryMouseUp(pt, MouseButtonLeft);
handled = true;
}
if (_buttons.testFlag(Qt::MidButton) && !winOS->IsButtonDown(MouseButtonMiddle))
{
onPrimaryMouseUp(pt, MouseButtonMiddle);
handled = true;
}
if (_buttons.testFlag(Qt::RightButton) && !winOS->IsButtonDown(MouseButtonRight))
{
onPrimaryMouseUp(pt, MouseButtonRight);
handled = true;
}
if (handled)
return;
}
else
{
SAFE_DELETE(_prevMouseDown);
_buttons = 0;
}
}
#endif
// let the overlays intercept the event
vector<OverlayLayout *> overlays = scnManager->getOverlays();
for (int i = 0; i < overlays.size(); ++i)
{
Vec3 dims = overlays[i]->getSize();
Vec3 point(pt.x, dims.y - pt.y, 0.0f);
if (overlays[i]->onMouseMove(MouseOverlayEvent(overlays[i], point, point, 0)))
return;
}
for (uint i = 0; i < handlerList.size(); i++)
{
// Send all handlers a mouse Down
handlerList[i]->onMouseMove(pt);
}
// REFACTOR: get rid of this
MotionCallback(int(pt.x), int(pt.y));
}
bool MouseEventManager::addHandler(MouseEventHandler *eventHandler)
{
// Add this handler to the list
handlerList.push_back(eventHandler);
return true;
}
bool MouseEventManager::removeHandler(MouseEventHandler *eventHandler)
{
// Search through all the items and remove the requested handler
for (uint i = 0; i < handlerList.size(); i++)
{
if (handlerList[i] == eventHandler)
{
// Remove form the handler list
handlerList.erase(handlerList.begin() + i);
return true;
}
}
// Event Handler not found!
return false;
}
void MouseEventManager::onAdditionalMouseDown(Vec2 &pt, MouseButtons button, MousePointer* pointer)
{
tuple<NxActorWrapper*, BumpObject*, Vec3> t = pick(int(pt.x), int(pt.y));
BumpObject *pickedObject = t.get<1>();
Vec3 stabPointActorSpace = t.get<2>();
if (pickedObject != NULL && (pickedObject->isBumpObjectType(BumpActor) || pickedObject->isBumpObjectType(BumpPile)))
{
Selection *selection = new Selection();
selection->add(pickedObject);
selection->setPickedActor(pickedObject);
selection->setStabPointActorSpace(stabPointActorSpace);
pickedObject->onDragBegin();
if (pickedObject->isBumpObjectType(BumpActor)) ((Actor*)pickedObject)->onTouchDown(pt, pointer);
additionalTouches[pointer] = selection;
}
}
void MouseEventManager::onAdditionalMouseUp(Vec2 &pt, MouseButtons button, MousePointer* pointer)
{
if (additionalTouches.find(pointer) != additionalTouches.end())
{
Selection *selection = additionalTouches[pointer];
selection->getPickedActor()->onDragEnd();
if (selection->getPickedActor()->isBumpObjectType(BumpActor)) ((Actor*)selection->getPickedActor())->onTouchUp(pt, pointer);
additionalTouches.erase(pointer);
delete selection;
}
}
void MouseEventManager::onAdditionalMouseMove(Vec2 &pt, MousePointer* pointer)
{
if (additionalTouches.find(pointer) != additionalTouches.end())
{
Selection *selection = additionalTouches[pointer];
selection->update();
}
}
void MouseEventManager::update()
{
for (hash_map<MousePointer*,Selection*>::iterator it = mouseManager->additionalTouches.begin();
it != mouseManager->additionalTouches.end();
it++)
{
MousePointer *mp = it->first;
Selection * selection = it->second;
POINT p;
p.x = int(mp->getX());
p.y = int(mp->getY());
ScreenToClient(winOS->GetWindowsHandle(), &p);
selection->update();
}
}
MousePointer* MouseEventManager::getPrimaryTouch()
{
return primaryTouch;
} | 29.391466 | 127 | 0.666646 | dyzmapl |
c938029b54fb586fd362b694813273e28d0a692d | 336 | hpp | C++ | test/qsbr_test_utils.hpp | laurynas-biveinis/unodb | 4865a2c5ca97a93e8d4e3e7c990ebb7be12371b9 | [
"Apache-2.0"
] | 24 | 2019-11-26T09:31:31.000Z | 2022-03-27T16:31:45.000Z | test/qsbr_test_utils.hpp | laurynas-biveinis/unodb | 4865a2c5ca97a93e8d4e3e7c990ebb7be12371b9 | [
"Apache-2.0"
] | 222 | 2019-10-26T12:50:54.000Z | 2022-03-31T10:29:50.000Z | test/qsbr_test_utils.hpp | laurynas-biveinis/unodb | 4865a2c5ca97a93e8d4e3e7c990ebb7be12371b9 | [
"Apache-2.0"
] | 1 | 2021-03-10T14:55:48.000Z | 2021-03-10T14:55:48.000Z | // Copyright 2021 Laurynas Biveinis
#ifndef UNODB_DETAIL_QSBR_TEST_UTILS_HPP
#define UNODB_DETAIL_QSBR_TEST_UTILS_HPP
#include "global.hpp" // IWYU pragma: keep
#include <gtest/gtest.h> // IWYU pragma: keep
namespace unodb::test {
void expect_idle_qsbr();
} // namespace unodb::test
#endif // UNODB_DETAIL_QSBR_TEST_UTILS_HPP
| 21 | 46 | 0.77381 | laurynas-biveinis |
c9388c8f6896d675fca4a4d0aab9748d13d5832c | 5,184 | cpp | C++ | kratos/tests/cpp_tests/processes/test_structured_mesh_generator_process.cpp | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | 2 | 2020-04-30T19:13:08.000Z | 2021-04-14T19:40:47.000Z | kratos/tests/cpp_tests/processes/test_structured_mesh_generator_process.cpp | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | 13 | 2019-10-07T12:06:51.000Z | 2020-02-18T08:48:33.000Z | kratos/tests/cpp_tests/processes/test_structured_mesh_generator_process.cpp | lcirrott/Kratos | 8406e73e0ad214c4f89df4e75e9b29d0eb4a47ea | [
"BSD-4-Clause"
] | 1 | 2020-06-12T08:51:24.000Z | 2020-06-12T08:51:24.000Z | // | / |
// ' / __| _` | __| _ \ __|
// . \ | ( | | ( |\__ `
// _|\_\_| \__,_|\__|\___/ ____/
// Multi-Physics
//
// License: BSD License
// Kratos default license: kratos/license.txt
//
// Main authors: Pooyan Dadvand
//
//
// System includes
// External includes
// Project includes
#include "testing/testing.h"
#include "containers/model.h"
#include "includes/kernel.h"
#include "processes/structured_mesh_generator_process.h"
#include "geometries/quadrilateral_2d_4.h"
#include "geometries/hexahedra_3d_8.h"
namespace Kratos {
namespace Testing {
KRATOS_TEST_CASE_IN_SUITE(StructuredMeshGeneratorProcessHexahedra, KratosCoreFastSuite)
{
Kernel kernel;
Model current_model;
Node<3>::Pointer p_point1(new Node<3>(1, 0.00, 0.00, 0.00));
Node<3>::Pointer p_point2(new Node<3>(2, 10.00, 0.00, 0.00));
Node<3>::Pointer p_point3(new Node<3>(3, 10.00, 10.00, 0.00));
Node<3>::Pointer p_point4(new Node<3>(4, 0.00, 10.00, 0.00));
Node<3>::Pointer p_point5(new Node<3>(5, 0.00, 0.00, 10.00));
Node<3>::Pointer p_point6(new Node<3>(6, 10.00, 0.00, 10.00));
Node<3>::Pointer p_point7(new Node<3>(7, 10.00, 10.00, 10.00));
Node<3>::Pointer p_point8(new Node<3>(8, 0.00, 10.00, 10.00));
Hexahedra3D8<Node<3> > geometry(p_point1, p_point2, p_point3, p_point4, p_point5, p_point6, p_point7, p_point8);
ModelPart& model_part = current_model.CreateModelPart("Generated");
Parameters mesher_parameters(R"(
{
"number_of_divisions":10,
"element_name": "Element3D4N"
} )");
std::size_t number_of_divisions = mesher_parameters["number_of_divisions"].GetInt();
StructuredMeshGeneratorProcess(geometry, model_part, mesher_parameters).Execute();
std::size_t number_of_nodes = (number_of_divisions + 1) * (number_of_divisions + 1) * (number_of_divisions + 1);
std::size_t number_of_elements = number_of_divisions * number_of_divisions * number_of_divisions * 6;
KRATOS_CHECK_EQUAL(model_part.NumberOfNodes(), number_of_nodes);
KRATOS_CHECK_EQUAL(model_part.NumberOfElements(), number_of_elements) << " Number of elements = " << model_part.NumberOfElements() ;
double total_volume = 0.00;
for (auto i_element = model_part.ElementsBegin(); i_element != model_part.ElementsEnd(); i_element++) {
double element_volume = i_element->GetGeometry().Volume();
KRATOS_CHECK_GREATER(element_volume, 0.00) << " for element #" << i_element->Id() << " with nodes ["
<< i_element->GetGeometry()[0].Id()
<< "," << i_element->GetGeometry()[1].Id()
<< "," << i_element->GetGeometry()[2].Id()
<< "," << i_element->GetGeometry()[3].Id() << "] with volume : " << element_volume << std::endl << *i_element;
total_volume += element_volume;
}
KRATOS_CHECK_NEAR(total_volume, 1000., 1.E-6) << "with total_volume = " << total_volume;
KRATOS_CHECK(model_part.HasSubModelPart("Skin"));
KRATOS_CHECK_EQUAL(model_part.GetSubModelPart("Skin").NumberOfNodes(), 602);
KRATOS_CHECK_EQUAL(model_part.GetSubModelPart("Skin").NumberOfElements(), 0);
}
KRATOS_TEST_CASE_IN_SUITE(StructuredMeshGeneratorProcessQuadrilateral, KratosCoreFastSuite)
{
Kernel kernel;
Model current_model;
Node<3>::Pointer p_point1(new Node<3>(1, 0.00, 0.00, 0.00));
Node<3>::Pointer p_point2(new Node<3>(2, 0.00, 10.00, 0.00));
Node<3>::Pointer p_point3(new Node<3>(3, 10.00, 10.00, 0.00));
Node<3>::Pointer p_point4(new Node<3>(4, 10.00, 0.00, 0.00));
Quadrilateral2D4<Node<3> > geometry(p_point1, p_point2, p_point3, p_point4);
ModelPart& model_part = current_model.CreateModelPart("Generated");
Parameters mesher_parameters(R"(
{
"number_of_divisions":10,
"element_name": "Element2D3N",
"create_skin_sub_model_part": false
} )");
std::size_t number_of_divisions = mesher_parameters["number_of_divisions"].GetInt();
StructuredMeshGeneratorProcess(geometry, model_part, mesher_parameters).Execute();
std::size_t number_of_nodes = (number_of_divisions + 1) * (number_of_divisions + 1);
KRATOS_CHECK_EQUAL(model_part.NumberOfNodes(), number_of_nodes);
KRATOS_CHECK_EQUAL(model_part.NumberOfElements(), number_of_divisions * number_of_divisions * 2);
double total_area = 0.00;
for (auto i_element = model_part.ElementsBegin(); i_element != model_part.ElementsEnd(); i_element++) {
double element_area = i_element->GetGeometry().Area();
KRATOS_CHECK_GREATER(element_area, 0.00) << " for element #" << i_element->Id() << " with nodes ["
<< i_element->GetGeometry()[0].Id()
<< "," << i_element->GetGeometry()[1].Id()
<< "," << i_element->GetGeometry()[2].Id() << "] with area : " << element_area << std::endl << *i_element;
total_area += element_area;
}
KRATOS_CHECK_NEAR(total_area, 100., 1.E-6) << "with total_area = " << total_area;
KRATOS_CHECK_IS_FALSE(model_part.HasSubModelPart("Skin"));
}
}
} // namespace Kratos.
| 40.186047 | 135 | 0.652971 | lcirrott |
c9459f2c2d895101891d127fb9a4f3022d8dcb6b | 8,309 | hpp | C++ | include/HMUI/HierarchyManager.hpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | include/HMUI/HierarchyManager.hpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | include/HMUI/HierarchyManager.hpp | RedBrumbler/BeatSaber-Quest-Codegen | 73dda50b5a3e51f10d86b766dcaa24b0c6226e25 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "beatsaber-hook/shared/utils/typedefs.h"
#include "beatsaber-hook/shared/utils/byref.hpp"
// Including type: UnityEngine.MonoBehaviour
#include "UnityEngine/MonoBehaviour.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: HMUI
namespace HMUI {
// Forward declaring type: ScreenSystem
class ScreenSystem;
// Forward declaring type: FlowCoordinator
class FlowCoordinator;
}
// Forward declaring namespace: GlobalNamespace
namespace GlobalNamespace {
// Forward declaring type: GameScenesManager
class GameScenesManager;
// Forward declaring type: ScenesTransitionSetupDataSO
class ScenesTransitionSetupDataSO;
}
// Forward declaring namespace: Zenject
namespace Zenject {
// Forward declaring type: DiContainer
class DiContainer;
}
// Completed forward declares
// Type namespace: HMUI
namespace HMUI {
// Forward declaring type: HierarchyManager
class HierarchyManager;
}
#include "beatsaber-hook/shared/utils/il2cpp-type-check.hpp"
NEED_NO_BOX(::HMUI::HierarchyManager);
DEFINE_IL2CPP_ARG_TYPE(::HMUI::HierarchyManager*, "HMUI", "HierarchyManager");
// Type namespace: HMUI
namespace HMUI {
// Size: 0x30
#pragma pack(push, 1)
// Autogenerated type: HMUI.HierarchyManager
// [TokenAttribute] Offset: FFFFFFFF
class HierarchyManager : public ::UnityEngine::MonoBehaviour {
public:
#ifdef USE_CODEGEN_FIELDS
public:
#else
#ifdef CODEGEN_FIELD_ACCESSIBILITY
CODEGEN_FIELD_ACCESSIBILITY:
#else
protected:
#endif
#endif
// private HMUI.ScreenSystem _screenSystem
// Size: 0x8
// Offset: 0x18
::HMUI::ScreenSystem* screenSystem;
// Field size check
static_assert(sizeof(::HMUI::ScreenSystem*) == 0x8);
// [InjectAttribute] Offset: 0x123B234
// private GameScenesManager _gameScenesManager
// Size: 0x8
// Offset: 0x20
::GlobalNamespace::GameScenesManager* gameScenesManager;
// Field size check
static_assert(sizeof(::GlobalNamespace::GameScenesManager*) == 0x8);
// private HMUI.FlowCoordinator _rootFlowCoordinator
// Size: 0x8
// Offset: 0x28
::HMUI::FlowCoordinator* rootFlowCoordinator;
// Field size check
static_assert(sizeof(::HMUI::FlowCoordinator*) == 0x8);
public:
// Deleting conversion operator: operator ::System::IntPtr
constexpr operator ::System::IntPtr() const noexcept = delete;
// Get instance field reference: private HMUI.ScreenSystem _screenSystem
::HMUI::ScreenSystem*& dyn__screenSystem();
// Get instance field reference: private GameScenesManager _gameScenesManager
::GlobalNamespace::GameScenesManager*& dyn__gameScenesManager();
// Get instance field reference: private HMUI.FlowCoordinator _rootFlowCoordinator
::HMUI::FlowCoordinator*& dyn__rootFlowCoordinator();
// protected System.Void Start()
// Offset: 0x16EBAD4
void Start();
// protected System.Void OnDestroy()
// Offset: 0x16EBC90
void OnDestroy();
// private System.Void HandleSceneTransitionDidFinish(ScenesTransitionSetupDataSO scenesTransitionSetupData, Zenject.DiContainer container)
// Offset: 0x16EBBD4
void HandleSceneTransitionDidFinish(::GlobalNamespace::ScenesTransitionSetupDataSO* scenesTransitionSetupData, ::Zenject::DiContainer* container);
// private System.Void HandleBeforeDismissingScenes()
// Offset: 0x16EBD68
void HandleBeforeDismissingScenes();
// public System.Void StartWithFlowCoordinator(HMUI.FlowCoordinator flowCoordinator)
// Offset: 0x16EBE24
void StartWithFlowCoordinator(::HMUI::FlowCoordinator* flowCoordinator);
// public System.Void .ctor()
// Offset: 0x16EBE48
// Implemented from: UnityEngine.MonoBehaviour
// Base method: System.Void MonoBehaviour::.ctor()
// Base method: System.Void Behaviour::.ctor()
// Base method: System.Void Component::.ctor()
// Base method: System.Void Object::.ctor()
// Base method: System.Void Object::.ctor()
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static HierarchyManager* New_ctor() {
static auto ___internal__logger = ::Logger::get().WithContext("::HMUI::HierarchyManager::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<HierarchyManager*, creationType>()));
}
}; // HMUI.HierarchyManager
#pragma pack(pop)
static check_size<sizeof(HierarchyManager), 40 + sizeof(::HMUI::FlowCoordinator*)> __HMUI_HierarchyManagerSizeCheck;
static_assert(sizeof(HierarchyManager) == 0x30);
}
#include "beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
// Writing MetadataGetter for method: HMUI::HierarchyManager::Start
// Il2CppName: Start
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (HMUI::HierarchyManager::*)()>(&HMUI::HierarchyManager::Start)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(HMUI::HierarchyManager*), "Start", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: HMUI::HierarchyManager::OnDestroy
// Il2CppName: OnDestroy
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (HMUI::HierarchyManager::*)()>(&HMUI::HierarchyManager::OnDestroy)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(HMUI::HierarchyManager*), "OnDestroy", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: HMUI::HierarchyManager::HandleSceneTransitionDidFinish
// Il2CppName: HandleSceneTransitionDidFinish
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (HMUI::HierarchyManager::*)(::GlobalNamespace::ScenesTransitionSetupDataSO*, ::Zenject::DiContainer*)>(&HMUI::HierarchyManager::HandleSceneTransitionDidFinish)> {
static const MethodInfo* get() {
static auto* scenesTransitionSetupData = &::il2cpp_utils::GetClassFromName("", "ScenesTransitionSetupDataSO")->byval_arg;
static auto* container = &::il2cpp_utils::GetClassFromName("Zenject", "DiContainer")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(HMUI::HierarchyManager*), "HandleSceneTransitionDidFinish", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{scenesTransitionSetupData, container});
}
};
// Writing MetadataGetter for method: HMUI::HierarchyManager::HandleBeforeDismissingScenes
// Il2CppName: HandleBeforeDismissingScenes
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (HMUI::HierarchyManager::*)()>(&HMUI::HierarchyManager::HandleBeforeDismissingScenes)> {
static const MethodInfo* get() {
return ::il2cpp_utils::FindMethod(classof(HMUI::HierarchyManager*), "HandleBeforeDismissingScenes", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{});
}
};
// Writing MetadataGetter for method: HMUI::HierarchyManager::StartWithFlowCoordinator
// Il2CppName: StartWithFlowCoordinator
template<>
struct ::il2cpp_utils::il2cpp_type_check::MetadataGetter<static_cast<void (HMUI::HierarchyManager::*)(::HMUI::FlowCoordinator*)>(&HMUI::HierarchyManager::StartWithFlowCoordinator)> {
static const MethodInfo* get() {
static auto* flowCoordinator = &::il2cpp_utils::GetClassFromName("HMUI", "FlowCoordinator")->byval_arg;
return ::il2cpp_utils::FindMethod(classof(HMUI::HierarchyManager*), "StartWithFlowCoordinator", std::vector<Il2CppClass*>(), ::std::vector<const Il2CppType*>{flowCoordinator});
}
};
// Writing MetadataGetter for method: HMUI::HierarchyManager::New_ctor
// Il2CppName: .ctor
// Cannot get method pointer of value based method overload from template for constructor!
// Try using FindMethod instead!
| 48.876471 | 237 | 0.73282 | RedBrumbler |
c94c406b00cf49bf343116eabc871095a1580203 | 2,425 | cpp | C++ | SkyBox.cpp | soleilgames/Zinc | af34cd2698a8d392d266802a67b4607df6a79033 | [
"MIT"
] | null | null | null | SkyBox.cpp | soleilgames/Zinc | af34cd2698a8d392d266802a67b4607df6a79033 | [
"MIT"
] | null | null | null | SkyBox.cpp | soleilgames/Zinc | af34cd2698a8d392d266802a67b4607df6a79033 | [
"MIT"
] | null | null | null | /*
* Copyright (C) 2017 Florian GOLESTIN
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#include <osg/Depth>
#include <osgUtil/CullVisitor>
#include "SkyBox.h"
SkyBox::SkyBox() {
setReferenceFrame(osg::Transform::ABSOLUTE_RF);
setCullingActive(false);
osg::StateSet *ss = getOrCreateStateSet();
ss->setAttributeAndModes(new osg::Depth(osg::Depth::LEQUAL, 1.0f, 1.0f));
ss->setMode(GL_LIGHTING, osg::StateAttribute::OFF);
ss->setMode(GL_CULL_FACE, osg::StateAttribute::OFF);
ss->setRenderBinDetails(5, "RenderBin");
}
bool SkyBox::computeLocalToWorldMatrix(osg::Matrix &matrix,
osg::NodeVisitor *nv) const {
if (nv && nv->getVisitorType() == osg::NodeVisitor::CULL_VISITOR) {
osgUtil::CullVisitor *cv = static_cast<osgUtil::CullVisitor *>(nv);
matrix.preMult(osg::Matrix::translate(cv->getEyeLocal()));
return true;
} else
return osg::Transform::computeLocalToWorldMatrix(matrix, nv);
}
bool SkyBox::computeWorldToLocalMatrix(osg::Matrix &matrix,
osg::NodeVisitor *nv) const {
if (nv && nv->getVisitorType() == osg::NodeVisitor::CULL_VISITOR) {
osgUtil::CullVisitor *cv = static_cast<osgUtil::CullVisitor *>(nv);
matrix.postMult(osg::Matrix::translate(-cv->getEyeLocal()));
return true;
} else
return osg::Transform::computeWorldToLocalMatrix(matrix, nv);
}
| 43.303571 | 80 | 0.715052 | soleilgames |
c9559c08c8c8f002b7c3cf0e5c6d0a0ff30d6d02 | 703 | hpp | C++ | include/htool/types/virtual_generator.hpp | htool-ddm/htool | e4dbec7c08c5008e62344fd0d5ebfdf95ef8863f | [
"MIT"
] | 15 | 2020-05-06T15:20:42.000Z | 2022-03-15T10:27:56.000Z | include/htool/types/virtual_generator.hpp | htool-ddm/htool | e4dbec7c08c5008e62344fd0d5ebfdf95ef8863f | [
"MIT"
] | 14 | 2020-05-25T13:59:11.000Z | 2022-03-02T16:40:45.000Z | include/htool/types/virtual_generator.hpp | PierreMarchand20/htool | b6e91690f8d7c20d67dfb3b8db2e7ea674405a37 | [
"MIT"
] | 2 | 2018-04-25T07:44:35.000Z | 2019-11-05T16:57:00.000Z | #ifndef HTOOL_GENERATOR_HPP
#define HTOOL_GENERATOR_HPP
#include "vector.hpp"
#include <cassert>
#include <iterator>
namespace htool {
template <typename T>
class VirtualGenerator {
protected:
// Data members
int nr;
int nc;
int dimension;
public:
VirtualGenerator(int nr0, int nc0, int dimension0 = 1) : nr(nr0), nc(nc0), dimension(dimension0) {}
// C style
virtual void copy_submatrix(int M, int N, const int *const rows, const int *const cols, T *ptr) const = 0;
int nb_rows() const { return nr; }
int nb_cols() const { return nc; }
int get_dimension() const { return dimension; }
virtual ~VirtualGenerator(){};
};
} // namespace htool
#endif
| 20.676471 | 110 | 0.672831 | htool-ddm |
c958cb28035ae321dea1795ba9e70317e2d1b435 | 4,797 | cpp | C++ | src/Walker.cpp | SrinidhiSreenath/turtlebot-roomba | ec8d80c70ce077a8d2891557fbe9fa65f4f58bcc | [
"BSD-3-Clause"
] | null | null | null | src/Walker.cpp | SrinidhiSreenath/turtlebot-roomba | ec8d80c70ce077a8d2891557fbe9fa65f4f58bcc | [
"BSD-3-Clause"
] | null | null | null | src/Walker.cpp | SrinidhiSreenath/turtlebot-roomba | ec8d80c70ce077a8d2891557fbe9fa65f4f58bcc | [
"BSD-3-Clause"
] | null | null | null | /************************************************************************************
* BSD 3-Clause License
* Copyright (c) 2018, Srinidhi Sreenath
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
************************************************************************************/
/**
* @file Walker.cpp
* @author Srinidhi Sreenath (SrinidhiSreenath)
* @date 11/18/2018
* @version 1.0
*
* @brief Walker class definition.
*
* @section DESCRIPTION
*
* Source file for class Walker. The class implements a simple walker algorithm
* to emulate roombs robot's behavior. The class commands the turtlebot to
* navigate and subscribes to laser scan data to check for potential
* collisions. If a possible collision is expected, the turtlebot is asked to
* navigate in a different direction to avoid collision.
*
*/
// Walker class header
#include "turtlebot_roomba/Walker.hpp"
// CPP Headers
#include <cmath>
#include <limits>
#include <vector>
Walker::Walker(ros::NodeHandle &n) : n_(n) {
ROS_INFO_STREAM("Walker Node Initialized!");
// Setup the velocity publisher topic with master
velocityPub_ =
n_.advertise<geometry_msgs::Twist>("/mobile_base/commands/velocity", 100);
// subscribe to the laserscan topic
laserSub_ = n_.subscribe("scan", 50, &Walker::processLaserScan, this);
}
Walker::~Walker() {}
void Walker::processLaserScan(const sensor_msgs::LaserScan::ConstPtr &scan) {
// Get min and max range values
auto minRange = scan->range_min;
auto maxRange = scan->range_max;
// Get angle resolution
auto angleRes = scan->angle_increment;
// Extract scan range values
std::vector<float> rangeValues = scan->ranges;
size_t size = rangeValues.size();
auto mid = size / 2;
// Check for obstacle within a range of 20 degrees from center i.e 10 degrees
// on left and 10 degrees on the right of center
float checkRange = 10 * M_PI / 180;
size_t checkRangeIncrement = checkRange / angleRes;
// Get minimum range value in that region of interest
float minDist = std::numeric_limits<float>::max();
for (size_t it = mid - checkRangeIncrement; it < mid + checkRangeIncrement;
it++) {
if (rangeValues[it] < minDist) {
minDist = rangeValues[it];
}
}
// ROS_DEBUG_STREAM("Minimum distance: " << minDist);
// If the scan value is invalid, then there is no change in turtlebot's
// behavior i.e keep going straight.
if (std::isnan(minDist) || minDist > maxRange || minDist < minRange) {
changeCourse_ = false;
navigate(changeCourse_);
return;
}
// If minimum distance is close i.e 1 meter, command the turtlebot to rotate
// else there is no change in course
if (minDist < 1.0) {
ROS_WARN_STREAM("Obstacle detected ahead! Changing course");
changeCourse_ = true;
} else {
changeCourse_ = false;
}
// Publish navigation command to turtlebot
navigate(changeCourse_);
}
void Walker::navigate(bool changeCourse) {
// the default behavior is to keep going straight. If change in course is
// requested, the turtlebot is commanded to rotate
if (changeCourse) {
msg.linear.x = 0.0;
msg.angular.z = -0.5;
} else {
msg.linear.x = 0.1;
msg.angular.z = 0.0;
}
// Publish the desired velocity commands
velocityPub_.publish(msg);
}
| 36.618321 | 86 | 0.693767 | SrinidhiSreenath |
c95c16202557ff8003219858c01790821bc06a4f | 348,708 | cc | C++ | iWorkFileInspector/iWorkFileInspector/Messages/TSKArchives.pb.cc | obriensp/iWorkFileFormat | 8575e441beaaaa56f480fdd91721f5bb06d07d43 | [
"MIT"
] | 151 | 2015-01-07T01:39:17.000Z | 2022-01-05T22:46:02.000Z | iWorkFileInspector/iWorkFileInspector/Messages/TSKArchives.pb.cc | Zearin/iWorkFileFormat | 8575e441beaaaa56f480fdd91721f5bb06d07d43 | [
"MIT"
] | 5 | 2015-06-29T14:34:38.000Z | 2022-03-25T20:55:38.000Z | iWorkFileInspector/iWorkFileInspector/Messages/TSKArchives.pb.cc | Zearin/iWorkFileFormat | 8575e441beaaaa56f480fdd91721f5bb06d07d43 | [
"MIT"
] | 28 | 2015-01-09T01:45:20.000Z | 2022-03-23T13:33:19.000Z | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: TSKArchives.proto
#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION
#include "TSKArchives.pb.h"
#include <algorithm>
#include <google/protobuf/stubs/common.h>
#include <google/protobuf/stubs/once.h>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/wire_format_lite_inl.h>
#include <google/protobuf/descriptor.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/reflection_ops.h>
#include <google/protobuf/wire_format.h>
// @@protoc_insertion_point(includes)
namespace TSK {
namespace {
const ::google::protobuf::Descriptor* TreeNode_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
TreeNode_reflection_ = NULL;
const ::google::protobuf::Descriptor* CommandHistory_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CommandHistory_reflection_ = NULL;
const ::google::protobuf::Descriptor* DocumentArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
DocumentArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* DocumentSupportArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
DocumentSupportArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* ViewStateArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ViewStateArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* CommandArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CommandArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* CommandGroupArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CommandGroupArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* CommandContainerArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CommandContainerArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* ReplaceAllChildCommandArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ReplaceAllChildCommandArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* ReplaceAllCommandArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ReplaceAllCommandArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* ShuffleMappingArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ShuffleMappingArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* ShuffleMappingArchive_Entry_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ShuffleMappingArchive_Entry_reflection_ = NULL;
const ::google::protobuf::Descriptor* ProgressiveCommandGroupArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
ProgressiveCommandGroupArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* CommandSelectionBehaviorHistoryArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CommandSelectionBehaviorHistoryArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* CommandSelectionBehaviorHistoryArchive_Entry_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CommandSelectionBehaviorHistoryArchive_Entry_reflection_ = NULL;
const ::google::protobuf::Descriptor* UndoRedoStateCommandSelectionBehaviorArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
UndoRedoStateCommandSelectionBehaviorArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* FormatStructArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
FormatStructArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* CustomFormatArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CustomFormatArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* CustomFormatArchive_Condition_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
CustomFormatArchive_Condition_reflection_ = NULL;
const ::google::protobuf::Descriptor* AnnotationAuthorArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AnnotationAuthorArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* DeprecatedChangeAuthorArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
DeprecatedChangeAuthorArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* AnnotationAuthorStorageArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AnnotationAuthorStorageArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* AddAnnotationAuthorCommandArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
AddAnnotationAuthorCommandArchive_reflection_ = NULL;
const ::google::protobuf::Descriptor* SetAnnotationAuthorColorCommandArchive_descriptor_ = NULL;
const ::google::protobuf::internal::GeneratedMessageReflection*
SetAnnotationAuthorColorCommandArchive_reflection_ = NULL;
} // namespace
void protobuf_AssignDesc_TSKArchives_2eproto() {
protobuf_AddDesc_TSKArchives_2eproto();
const ::google::protobuf::FileDescriptor* file =
::google::protobuf::DescriptorPool::generated_pool()->FindFileByName(
"TSKArchives.proto");
GOOGLE_CHECK(file != NULL);
TreeNode_descriptor_ = file->message_type(0);
static const int TreeNode_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TreeNode, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TreeNode, children_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TreeNode, object_),
};
TreeNode_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
TreeNode_descriptor_,
TreeNode::default_instance_,
TreeNode_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TreeNode, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(TreeNode, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(TreeNode));
CommandHistory_descriptor_ = file->message_type(1);
static const int CommandHistory_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandHistory, undo_count_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandHistory, commands_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandHistory, marked_redo_commands_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandHistory, pending_preflight_command_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandHistory, fixed_radar_13365177_),
};
CommandHistory_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CommandHistory_descriptor_,
CommandHistory::default_instance_,
CommandHistory_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandHistory, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandHistory, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CommandHistory));
DocumentArchive_descriptor_ = file->message_type(2);
static const int DocumentArchive_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentArchive, locale_identifier_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentArchive, annotation_author_storage_),
};
DocumentArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
DocumentArchive_descriptor_,
DocumentArchive::default_instance_,
DocumentArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(DocumentArchive));
DocumentSupportArchive_descriptor_ = file->message_type(3);
static const int DocumentSupportArchive_offsets_[7] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, command_history_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, command_selection_behavior_history_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, undo_count_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, redo_count_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, undo_action_string_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, redo_action_string_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, web_state_),
};
DocumentSupportArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
DocumentSupportArchive_descriptor_,
DocumentSupportArchive::default_instance_,
DocumentSupportArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DocumentSupportArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(DocumentSupportArchive));
ViewStateArchive_descriptor_ = file->message_type(4);
static const int ViewStateArchive_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ViewStateArchive, view_state_root_),
};
ViewStateArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ViewStateArchive_descriptor_,
ViewStateArchive::default_instance_,
ViewStateArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ViewStateArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ViewStateArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ViewStateArchive));
CommandArchive_descriptor_ = file->message_type(5);
static const int CommandArchive_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandArchive, undoredostate_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandArchive, undocollection_),
};
CommandArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CommandArchive_descriptor_,
CommandArchive::default_instance_,
CommandArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CommandArchive));
CommandGroupArchive_descriptor_ = file->message_type(6);
static const int CommandGroupArchive_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandGroupArchive, super_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandGroupArchive, commands_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandGroupArchive, process_results_),
};
CommandGroupArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CommandGroupArchive_descriptor_,
CommandGroupArchive::default_instance_,
CommandGroupArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandGroupArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandGroupArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CommandGroupArchive));
CommandContainerArchive_descriptor_ = file->message_type(7);
static const int CommandContainerArchive_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandContainerArchive, commands_),
};
CommandContainerArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CommandContainerArchive_descriptor_,
CommandContainerArchive::default_instance_,
CommandContainerArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandContainerArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandContainerArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CommandContainerArchive));
ReplaceAllChildCommandArchive_descriptor_ = file->message_type(8);
static const int ReplaceAllChildCommandArchive_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllChildCommandArchive, super_),
};
ReplaceAllChildCommandArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ReplaceAllChildCommandArchive_descriptor_,
ReplaceAllChildCommandArchive::default_instance_,
ReplaceAllChildCommandArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllChildCommandArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllChildCommandArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ReplaceAllChildCommandArchive));
ReplaceAllCommandArchive_descriptor_ = file->message_type(9);
static const int ReplaceAllCommandArchive_offsets_[5] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllCommandArchive, super_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllCommandArchive, commands_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllCommandArchive, find_string_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllCommandArchive, replace_string_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllCommandArchive, options_),
};
ReplaceAllCommandArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ReplaceAllCommandArchive_descriptor_,
ReplaceAllCommandArchive::default_instance_,
ReplaceAllCommandArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllCommandArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ReplaceAllCommandArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ReplaceAllCommandArchive));
ShuffleMappingArchive_descriptor_ = file->message_type(10);
static const int ShuffleMappingArchive_offsets_[8] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, start_index_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, end_index_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, entries_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, is_vertical_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, is_move_operation_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, first_moved_index_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, destination_index_for_move_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, number_of_indices_moved_),
};
ShuffleMappingArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ShuffleMappingArchive_descriptor_,
ShuffleMappingArchive::default_instance_,
ShuffleMappingArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ShuffleMappingArchive));
ShuffleMappingArchive_Entry_descriptor_ = ShuffleMappingArchive_descriptor_->nested_type(0);
static const int ShuffleMappingArchive_Entry_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive_Entry, from_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive_Entry, to_),
};
ShuffleMappingArchive_Entry_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ShuffleMappingArchive_Entry_descriptor_,
ShuffleMappingArchive_Entry::default_instance_,
ShuffleMappingArchive_Entry_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive_Entry, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ShuffleMappingArchive_Entry, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ShuffleMappingArchive_Entry));
ProgressiveCommandGroupArchive_descriptor_ = file->message_type(11);
static const int ProgressiveCommandGroupArchive_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ProgressiveCommandGroupArchive, super_),
};
ProgressiveCommandGroupArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
ProgressiveCommandGroupArchive_descriptor_,
ProgressiveCommandGroupArchive::default_instance_,
ProgressiveCommandGroupArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ProgressiveCommandGroupArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(ProgressiveCommandGroupArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(ProgressiveCommandGroupArchive));
CommandSelectionBehaviorHistoryArchive_descriptor_ = file->message_type(12);
static const int CommandSelectionBehaviorHistoryArchive_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandSelectionBehaviorHistoryArchive, entries_),
};
CommandSelectionBehaviorHistoryArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CommandSelectionBehaviorHistoryArchive_descriptor_,
CommandSelectionBehaviorHistoryArchive::default_instance_,
CommandSelectionBehaviorHistoryArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandSelectionBehaviorHistoryArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandSelectionBehaviorHistoryArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CommandSelectionBehaviorHistoryArchive));
CommandSelectionBehaviorHistoryArchive_Entry_descriptor_ = CommandSelectionBehaviorHistoryArchive_descriptor_->nested_type(0);
static const int CommandSelectionBehaviorHistoryArchive_Entry_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandSelectionBehaviorHistoryArchive_Entry, command_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandSelectionBehaviorHistoryArchive_Entry, command_selection_behavior_),
};
CommandSelectionBehaviorHistoryArchive_Entry_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CommandSelectionBehaviorHistoryArchive_Entry_descriptor_,
CommandSelectionBehaviorHistoryArchive_Entry::default_instance_,
CommandSelectionBehaviorHistoryArchive_Entry_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandSelectionBehaviorHistoryArchive_Entry, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CommandSelectionBehaviorHistoryArchive_Entry, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CommandSelectionBehaviorHistoryArchive_Entry));
UndoRedoStateCommandSelectionBehaviorArchive_descriptor_ = file->message_type(13);
static const int UndoRedoStateCommandSelectionBehaviorArchive_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UndoRedoStateCommandSelectionBehaviorArchive, undo_redo_state_),
};
UndoRedoStateCommandSelectionBehaviorArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
UndoRedoStateCommandSelectionBehaviorArchive_descriptor_,
UndoRedoStateCommandSelectionBehaviorArchive::default_instance_,
UndoRedoStateCommandSelectionBehaviorArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UndoRedoStateCommandSelectionBehaviorArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(UndoRedoStateCommandSelectionBehaviorArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(UndoRedoStateCommandSelectionBehaviorArchive));
FormatStructArchive_descriptor_ = file->message_type(14);
static const int FormatStructArchive_offsets_[40] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, format_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, decimal_places_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, currency_code_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, negative_style_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, show_thousands_separator_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, use_accounting_style_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, duration_style_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, base_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, base_places_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, base_use_minus_sign_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, fraction_accuracy_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, suppress_date_format_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, suppress_time_format_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, date_time_format_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, duration_unit_largest_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, duration_unit_smallest_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, custom_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, custom_format_string_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, scale_factor_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, requires_fraction_replacement_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, control_minimum_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, control_maximum_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, control_increment_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, control_format_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, slider_orientation_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, slider_position_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, decimal_width_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, min_integer_width_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, num_nonspace_integer_digits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, num_nonspace_decimal_digits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, index_from_right_last_integer_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, interstitial_strings_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, inters_str_insertion_indexes_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, num_hash_decimal_digits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, total_num_decimal_digits_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, is_complex_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, contains_integer_token_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, multiple_choice_list_initial_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, multiple_choice_list_id_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, use_automatic_duration_units_),
};
FormatStructArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
FormatStructArchive_descriptor_,
FormatStructArchive::default_instance_,
FormatStructArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, _unknown_fields_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(FormatStructArchive, _extensions_),
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(FormatStructArchive));
CustomFormatArchive_descriptor_ = file->message_type(15);
static const int CustomFormatArchive_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive, format_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive, default_format_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive, conditions_),
};
CustomFormatArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CustomFormatArchive_descriptor_,
CustomFormatArchive::default_instance_,
CustomFormatArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CustomFormatArchive));
CustomFormatArchive_Condition_descriptor_ = CustomFormatArchive_descriptor_->nested_type(0);
static const int CustomFormatArchive_Condition_offsets_[4] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive_Condition, condition_type_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive_Condition, condition_value_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive_Condition, condition_format_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive_Condition, condition_value_dbl_),
};
CustomFormatArchive_Condition_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
CustomFormatArchive_Condition_descriptor_,
CustomFormatArchive_Condition::default_instance_,
CustomFormatArchive_Condition_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive_Condition, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(CustomFormatArchive_Condition, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(CustomFormatArchive_Condition));
AnnotationAuthorArchive_descriptor_ = file->message_type(16);
static const int AnnotationAuthorArchive_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AnnotationAuthorArchive, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AnnotationAuthorArchive, color_),
};
AnnotationAuthorArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
AnnotationAuthorArchive_descriptor_,
AnnotationAuthorArchive::default_instance_,
AnnotationAuthorArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AnnotationAuthorArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AnnotationAuthorArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(AnnotationAuthorArchive));
DeprecatedChangeAuthorArchive_descriptor_ = file->message_type(17);
static const int DeprecatedChangeAuthorArchive_offsets_[2] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeprecatedChangeAuthorArchive, name_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeprecatedChangeAuthorArchive, change_color_),
};
DeprecatedChangeAuthorArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
DeprecatedChangeAuthorArchive_descriptor_,
DeprecatedChangeAuthorArchive::default_instance_,
DeprecatedChangeAuthorArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeprecatedChangeAuthorArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(DeprecatedChangeAuthorArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(DeprecatedChangeAuthorArchive));
AnnotationAuthorStorageArchive_descriptor_ = file->message_type(18);
static const int AnnotationAuthorStorageArchive_offsets_[1] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AnnotationAuthorStorageArchive, annotation_author_),
};
AnnotationAuthorStorageArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
AnnotationAuthorStorageArchive_descriptor_,
AnnotationAuthorStorageArchive::default_instance_,
AnnotationAuthorStorageArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AnnotationAuthorStorageArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AnnotationAuthorStorageArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(AnnotationAuthorStorageArchive));
AddAnnotationAuthorCommandArchive_descriptor_ = file->message_type(19);
static const int AddAnnotationAuthorCommandArchive_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AddAnnotationAuthorCommandArchive, super_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AddAnnotationAuthorCommandArchive, document_root_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AddAnnotationAuthorCommandArchive, annotation_author_),
};
AddAnnotationAuthorCommandArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
AddAnnotationAuthorCommandArchive_descriptor_,
AddAnnotationAuthorCommandArchive::default_instance_,
AddAnnotationAuthorCommandArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AddAnnotationAuthorCommandArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(AddAnnotationAuthorCommandArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(AddAnnotationAuthorCommandArchive));
SetAnnotationAuthorColorCommandArchive_descriptor_ = file->message_type(20);
static const int SetAnnotationAuthorColorCommandArchive_offsets_[3] = {
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SetAnnotationAuthorColorCommandArchive, super_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SetAnnotationAuthorColorCommandArchive, annotation_author_),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SetAnnotationAuthorColorCommandArchive, color_),
};
SetAnnotationAuthorColorCommandArchive_reflection_ =
new ::google::protobuf::internal::GeneratedMessageReflection(
SetAnnotationAuthorColorCommandArchive_descriptor_,
SetAnnotationAuthorColorCommandArchive::default_instance_,
SetAnnotationAuthorColorCommandArchive_offsets_,
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SetAnnotationAuthorColorCommandArchive, _has_bits_[0]),
GOOGLE_PROTOBUF_GENERATED_MESSAGE_FIELD_OFFSET(SetAnnotationAuthorColorCommandArchive, _unknown_fields_),
-1,
::google::protobuf::DescriptorPool::generated_pool(),
::google::protobuf::MessageFactory::generated_factory(),
sizeof(SetAnnotationAuthorColorCommandArchive));
}
namespace {
GOOGLE_PROTOBUF_DECLARE_ONCE(protobuf_AssignDescriptors_once_);
inline void protobuf_AssignDescriptorsOnce() {
::google::protobuf::GoogleOnceInit(&protobuf_AssignDescriptors_once_,
&protobuf_AssignDesc_TSKArchives_2eproto);
}
void protobuf_RegisterTypes(const ::std::string&) {
protobuf_AssignDescriptorsOnce();
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
TreeNode_descriptor_, &TreeNode::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CommandHistory_descriptor_, &CommandHistory::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
DocumentArchive_descriptor_, &DocumentArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
DocumentSupportArchive_descriptor_, &DocumentSupportArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ViewStateArchive_descriptor_, &ViewStateArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CommandArchive_descriptor_, &CommandArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CommandGroupArchive_descriptor_, &CommandGroupArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CommandContainerArchive_descriptor_, &CommandContainerArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ReplaceAllChildCommandArchive_descriptor_, &ReplaceAllChildCommandArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ReplaceAllCommandArchive_descriptor_, &ReplaceAllCommandArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ShuffleMappingArchive_descriptor_, &ShuffleMappingArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ShuffleMappingArchive_Entry_descriptor_, &ShuffleMappingArchive_Entry::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
ProgressiveCommandGroupArchive_descriptor_, &ProgressiveCommandGroupArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CommandSelectionBehaviorHistoryArchive_descriptor_, &CommandSelectionBehaviorHistoryArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CommandSelectionBehaviorHistoryArchive_Entry_descriptor_, &CommandSelectionBehaviorHistoryArchive_Entry::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
UndoRedoStateCommandSelectionBehaviorArchive_descriptor_, &UndoRedoStateCommandSelectionBehaviorArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
FormatStructArchive_descriptor_, &FormatStructArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CustomFormatArchive_descriptor_, &CustomFormatArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
CustomFormatArchive_Condition_descriptor_, &CustomFormatArchive_Condition::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AnnotationAuthorArchive_descriptor_, &AnnotationAuthorArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
DeprecatedChangeAuthorArchive_descriptor_, &DeprecatedChangeAuthorArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AnnotationAuthorStorageArchive_descriptor_, &AnnotationAuthorStorageArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
AddAnnotationAuthorCommandArchive_descriptor_, &AddAnnotationAuthorCommandArchive::default_instance());
::google::protobuf::MessageFactory::InternalRegisterGeneratedMessage(
SetAnnotationAuthorColorCommandArchive_descriptor_, &SetAnnotationAuthorColorCommandArchive::default_instance());
}
} // namespace
void protobuf_ShutdownFile_TSKArchives_2eproto() {
delete TreeNode::default_instance_;
delete TreeNode_reflection_;
delete CommandHistory::default_instance_;
delete CommandHistory_reflection_;
delete DocumentArchive::default_instance_;
delete DocumentArchive_reflection_;
delete DocumentSupportArchive::default_instance_;
delete DocumentSupportArchive_reflection_;
delete ViewStateArchive::default_instance_;
delete ViewStateArchive_reflection_;
delete CommandArchive::default_instance_;
delete CommandArchive_reflection_;
delete CommandGroupArchive::default_instance_;
delete CommandGroupArchive_reflection_;
delete CommandContainerArchive::default_instance_;
delete CommandContainerArchive_reflection_;
delete ReplaceAllChildCommandArchive::default_instance_;
delete ReplaceAllChildCommandArchive_reflection_;
delete ReplaceAllCommandArchive::default_instance_;
delete ReplaceAllCommandArchive_reflection_;
delete ShuffleMappingArchive::default_instance_;
delete ShuffleMappingArchive_reflection_;
delete ShuffleMappingArchive_Entry::default_instance_;
delete ShuffleMappingArchive_Entry_reflection_;
delete ProgressiveCommandGroupArchive::default_instance_;
delete ProgressiveCommandGroupArchive_reflection_;
delete CommandSelectionBehaviorHistoryArchive::default_instance_;
delete CommandSelectionBehaviorHistoryArchive_reflection_;
delete CommandSelectionBehaviorHistoryArchive_Entry::default_instance_;
delete CommandSelectionBehaviorHistoryArchive_Entry_reflection_;
delete UndoRedoStateCommandSelectionBehaviorArchive::default_instance_;
delete UndoRedoStateCommandSelectionBehaviorArchive_reflection_;
delete FormatStructArchive::default_instance_;
delete FormatStructArchive_reflection_;
delete CustomFormatArchive::default_instance_;
delete CustomFormatArchive_reflection_;
delete CustomFormatArchive_Condition::default_instance_;
delete CustomFormatArchive_Condition_reflection_;
delete AnnotationAuthorArchive::default_instance_;
delete AnnotationAuthorArchive_reflection_;
delete DeprecatedChangeAuthorArchive::default_instance_;
delete DeprecatedChangeAuthorArchive_reflection_;
delete AnnotationAuthorStorageArchive::default_instance_;
delete AnnotationAuthorStorageArchive_reflection_;
delete AddAnnotationAuthorCommandArchive::default_instance_;
delete AddAnnotationAuthorCommandArchive_reflection_;
delete SetAnnotationAuthorColorCommandArchive::default_instance_;
delete SetAnnotationAuthorColorCommandArchive_reflection_;
}
void protobuf_AddDesc_TSKArchives_2eproto() {
static bool already_here = false;
if (already_here) return;
already_here = true;
GOOGLE_PROTOBUF_VERIFY_VERSION;
::TSP::protobuf_AddDesc_TSPMessages_2eproto();
::google::protobuf::DescriptorPool::InternalAddGeneratedFile(
"\n\021TSKArchives.proto\022\003TSK\032\021TSPMessages.pr"
"oto\"Z\n\010TreeNode\022\014\n\004name\030\001 \001(\t\022 \n\010childre"
"n\030\002 \003(\0132\016.TSP.Reference\022\036\n\006object\030\003 \001(\0132"
"\016.TSP.Reference\"\305\001\n\016CommandHistory\022\022\n\nun"
"do_count\030\001 \002(\r\022 \n\010commands\030\002 \003(\0132\016.TSP.R"
"eference\022,\n\024marked_redo_commands\030\003 \003(\0132\016"
".TSP.Reference\0221\n\031pending_preflight_comm"
"and\030\004 \001(\0132\016.TSP.Reference\022\034\n\024fixed_radar"
"_13365177\030\n \001(\010\"_\n\017DocumentArchive\022\031\n\021lo"
"cale_identifier\030\004 \001(\t\0221\n\031annotation_auth"
"or_storage\030\007 \001(\0132\016.TSP.Reference\"\200\002\n\026Doc"
"umentSupportArchive\022\'\n\017command_history\030\001"
" \001(\0132\016.TSP.Reference\022:\n\"command_selectio"
"n_behavior_history\030\002 \001(\0132\016.TSP.Reference"
"\022\022\n\nundo_count\030\004 \001(\r\022\022\n\nredo_count\030\005 \001(\r"
"\022\032\n\022undo_action_string\030\006 \001(\t\022\032\n\022redo_act"
"ion_string\030\007 \001(\t\022!\n\tweb_state\030\010 \001(\0132\016.TS"
"P.Reference\";\n\020ViewStateArchive\022\'\n\017view_"
"state_root\030\001 \002(\0132\016.TSP.Reference\"_\n\016Comm"
"andArchive\022%\n\rundoRedoState\030\001 \001(\0132\016.TSP."
"Reference\022&\n\016undoCollection\030\002 \001(\0132\016.TSP."
"Reference\"\203\001\n\023CommandGroupArchive\022\"\n\005sup"
"er\030\001 \002(\0132\023.TSK.CommandArchive\022 \n\010command"
"s\030\002 \003(\0132\016.TSP.Reference\022&\n\017process_resul"
"ts\030\003 \001(\0132\r.TSP.IndexSet\";\n\027CommandContai"
"nerArchive\022 \n\010commands\030\001 \003(\0132\016.TSP.Refer"
"ence\"C\n\035ReplaceAllChildCommandArchive\022\"\n"
"\005super\030\001 \002(\0132\023.TSK.CommandArchive\"\236\001\n\030Re"
"placeAllCommandArchive\022\"\n\005super\030\001 \002(\0132\023."
"TSK.CommandArchive\022 \n\010commands\030\002 \003(\0132\016.T"
"SP.Reference\022\023\n\013find_string\030\003 \002(\t\022\026\n\016rep"
"lace_string\030\004 \002(\t\022\017\n\007options\030\005 \002(\r\"\273\002\n\025S"
"huffleMappingArchive\022\023\n\013start_index\030\001 \002("
"\r\022\021\n\tend_index\030\002 \002(\r\0221\n\007entries\030\003 \003(\0132 ."
"TSK.ShuffleMappingArchive.Entry\022\031\n\013is_ve"
"rtical\030\004 \001(\010:\004true\022 \n\021is_move_operation\030"
"\005 \001(\010:\005false\022\034\n\021first_moved_index\030\006 \001(\r:"
"\0010\022%\n\032destination_index_for_move\030\007 \001(\r:\001"
"0\022\"\n\027number_of_indices_moved\030\010 \001(\r:\0010\032!\n"
"\005Entry\022\014\n\004from\030\001 \002(\r\022\n\n\002to\030\002 \002(\r\"I\n\036Prog"
"ressiveCommandGroupArchive\022\'\n\005super\030\001 \002("
"\0132\030.TSK.CommandGroupArchive\"\312\001\n&CommandS"
"electionBehaviorHistoryArchive\022B\n\007entrie"
"s\030\001 \003(\01321.TSK.CommandSelectionBehaviorHi"
"storyArchive.Entry\032\\\n\005Entry\022\037\n\007command\030\001"
" \002(\0132\016.TSP.Reference\0222\n\032command_selectio"
"n_behavior\030\002 \002(\0132\016.TSP.Reference\"W\n,Undo"
"RedoStateCommandSelectionBehaviorArchive"
"\022\'\n\017undo_redo_state\030\002 \001(\0132\016.TSP.Referenc"
"e\"\257\t\n\023FormatStructArchive\022\023\n\013format_type"
"\030\001 \002(\r\022\026\n\016decimal_places\030\002 \001(\r\022\025\n\rcurren"
"cy_code\030\003 \001(\t\022\026\n\016negative_style\030\004 \001(\r\022 \n"
"\030show_thousands_separator\030\005 \001(\010\022\034\n\024use_a"
"ccounting_style\030\006 \001(\010\022\026\n\016duration_style\030"
"\007 \001(\r\022\014\n\004base\030\010 \001(\r\022\023\n\013base_places\030\t \001(\r"
"\022\033\n\023base_use_minus_sign\030\n \001(\010\022\031\n\021fractio"
"n_accuracy\030\013 \001(\r\022\034\n\024suppress_date_format"
"\030\014 \001(\010\022\034\n\024suppress_time_format\030\r \001(\010\022\030\n\020"
"date_time_format\030\016 \001(\t\022\035\n\025duration_unit_"
"largest\030\017 \001(\r\022\036\n\026duration_unit_smallest\030"
"\020 \001(\r\022\021\n\tcustom_id\030\021 \001(\r\022\034\n\024custom_forma"
"t_string\030\022 \001(\t\022\024\n\014scale_factor\030\023 \001(\001\022%\n\035"
"requires_fraction_replacement\030\024 \001(\010\022\027\n\017c"
"ontrol_minimum\030\025 \001(\001\022\027\n\017control_maximum\030"
"\026 \001(\001\022\031\n\021control_increment\030\027 \001(\001\022\033\n\023cont"
"rol_format_type\030\030 \001(\r\022\032\n\022slider_orientat"
"ion\030\031 \001(\r\022\027\n\017slider_position\030\032 \001(\r\022\025\n\rde"
"cimal_width\030\033 \001(\r\022\031\n\021min_integer_width\030\034"
" \001(\r\022#\n\033num_nonspace_integer_digits\030\035 \001("
"\r\022#\n\033num_nonspace_decimal_digits\030\036 \001(\r\022%"
"\n\035index_from_right_last_integer\030\037 \001(\r\022\034\n"
"\024interstitial_strings\030 \003(\t\0223\n\034inters_st"
"r_insertion_indexes\030! \001(\0132\r.TSP.IndexSet"
"\022\037\n\027num_hash_decimal_digits\030\" \001(\r\022 \n\030tot"
"al_num_decimal_digits\030# \001(\r\022\022\n\nis_comple"
"x\030$ \001(\010\022\036\n\026contains_integer_token\030% \001(\010\022"
"*\n\"multiple_choice_list_initial_value\030& "
"\001(\r\022\037\n\027multiple_choice_list_id\030\' \001(\r\022$\n\034"
"use_automatic_duration_units\030( \001(\010*\007\010\220N\020"
"\240\234\001\"\262\002\n\023CustomFormatArchive\022\014\n\004name\030\001 \002("
"\t\022\023\n\013format_type\030\002 \002(\r\0220\n\016default_format"
"\030\003 \002(\0132\030.TSK.FormatStructArchive\0226\n\ncond"
"itions\030\004 \003(\0132\".TSK.CustomFormatArchive.C"
"ondition\032\215\001\n\tCondition\022\026\n\016condition_type"
"\030\001 \002(\r\022\027\n\017condition_value\030\002 \001(\002\0222\n\020condi"
"tion_format\030\003 \002(\0132\030.TSK.FormatStructArch"
"ive\022\033\n\023condition_value_dbl\030\004 \001(\001\"B\n\027Anno"
"tationAuthorArchive\022\014\n\004name\030\001 \001(\t\022\031\n\005col"
"or\030\002 \001(\0132\n.TSP.Color\"O\n\035DeprecatedChange"
"AuthorArchive\022\014\n\004name\030\001 \001(\t\022 \n\014change_co"
"lor\030\002 \001(\0132\n.TSP.Color\"K\n\036AnnotationAutho"
"rStorageArchive\022)\n\021annotation_author\030\001 \003"
"(\0132\016.TSP.Reference\"\231\001\n!AddAnnotationAuth"
"orCommandArchive\022\"\n\005super\030\001 \002(\0132\023.TSK.Co"
"mmandArchive\022%\n\rdocument_root\030\002 \001(\0132\016.TS"
"P.Reference\022)\n\021annotation_author\030\003 \001(\0132\016"
".TSP.Reference\"\222\001\n&SetAnnotationAuthorCo"
"lorCommandArchive\022\"\n\005super\030\001 \002(\0132\023.TSK.C"
"ommandArchive\022)\n\021annotation_author\030\002 \001(\013"
"2\016.TSP.Reference\022\031\n\005color\030\003 \001(\0132\n.TSP.Co"
"lor", 4003);
::google::protobuf::MessageFactory::InternalRegisterGeneratedFile(
"TSKArchives.proto", &protobuf_RegisterTypes);
TreeNode::default_instance_ = new TreeNode();
CommandHistory::default_instance_ = new CommandHistory();
DocumentArchive::default_instance_ = new DocumentArchive();
DocumentSupportArchive::default_instance_ = new DocumentSupportArchive();
ViewStateArchive::default_instance_ = new ViewStateArchive();
CommandArchive::default_instance_ = new CommandArchive();
CommandGroupArchive::default_instance_ = new CommandGroupArchive();
CommandContainerArchive::default_instance_ = new CommandContainerArchive();
ReplaceAllChildCommandArchive::default_instance_ = new ReplaceAllChildCommandArchive();
ReplaceAllCommandArchive::default_instance_ = new ReplaceAllCommandArchive();
ShuffleMappingArchive::default_instance_ = new ShuffleMappingArchive();
ShuffleMappingArchive_Entry::default_instance_ = new ShuffleMappingArchive_Entry();
ProgressiveCommandGroupArchive::default_instance_ = new ProgressiveCommandGroupArchive();
CommandSelectionBehaviorHistoryArchive::default_instance_ = new CommandSelectionBehaviorHistoryArchive();
CommandSelectionBehaviorHistoryArchive_Entry::default_instance_ = new CommandSelectionBehaviorHistoryArchive_Entry();
UndoRedoStateCommandSelectionBehaviorArchive::default_instance_ = new UndoRedoStateCommandSelectionBehaviorArchive();
FormatStructArchive::default_instance_ = new FormatStructArchive();
CustomFormatArchive::default_instance_ = new CustomFormatArchive();
CustomFormatArchive_Condition::default_instance_ = new CustomFormatArchive_Condition();
AnnotationAuthorArchive::default_instance_ = new AnnotationAuthorArchive();
DeprecatedChangeAuthorArchive::default_instance_ = new DeprecatedChangeAuthorArchive();
AnnotationAuthorStorageArchive::default_instance_ = new AnnotationAuthorStorageArchive();
AddAnnotationAuthorCommandArchive::default_instance_ = new AddAnnotationAuthorCommandArchive();
SetAnnotationAuthorColorCommandArchive::default_instance_ = new SetAnnotationAuthorColorCommandArchive();
TreeNode::default_instance_->InitAsDefaultInstance();
CommandHistory::default_instance_->InitAsDefaultInstance();
DocumentArchive::default_instance_->InitAsDefaultInstance();
DocumentSupportArchive::default_instance_->InitAsDefaultInstance();
ViewStateArchive::default_instance_->InitAsDefaultInstance();
CommandArchive::default_instance_->InitAsDefaultInstance();
CommandGroupArchive::default_instance_->InitAsDefaultInstance();
CommandContainerArchive::default_instance_->InitAsDefaultInstance();
ReplaceAllChildCommandArchive::default_instance_->InitAsDefaultInstance();
ReplaceAllCommandArchive::default_instance_->InitAsDefaultInstance();
ShuffleMappingArchive::default_instance_->InitAsDefaultInstance();
ShuffleMappingArchive_Entry::default_instance_->InitAsDefaultInstance();
ProgressiveCommandGroupArchive::default_instance_->InitAsDefaultInstance();
CommandSelectionBehaviorHistoryArchive::default_instance_->InitAsDefaultInstance();
CommandSelectionBehaviorHistoryArchive_Entry::default_instance_->InitAsDefaultInstance();
UndoRedoStateCommandSelectionBehaviorArchive::default_instance_->InitAsDefaultInstance();
FormatStructArchive::default_instance_->InitAsDefaultInstance();
CustomFormatArchive::default_instance_->InitAsDefaultInstance();
CustomFormatArchive_Condition::default_instance_->InitAsDefaultInstance();
AnnotationAuthorArchive::default_instance_->InitAsDefaultInstance();
DeprecatedChangeAuthorArchive::default_instance_->InitAsDefaultInstance();
AnnotationAuthorStorageArchive::default_instance_->InitAsDefaultInstance();
AddAnnotationAuthorCommandArchive::default_instance_->InitAsDefaultInstance();
SetAnnotationAuthorColorCommandArchive::default_instance_->InitAsDefaultInstance();
::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_TSKArchives_2eproto);
}
// Force AddDescriptors() to be called at static initialization time.
struct StaticDescriptorInitializer_TSKArchives_2eproto {
StaticDescriptorInitializer_TSKArchives_2eproto() {
protobuf_AddDesc_TSKArchives_2eproto();
}
} static_descriptor_initializer_TSKArchives_2eproto_;
// ===================================================================
#ifndef _MSC_VER
const int TreeNode::kNameFieldNumber;
const int TreeNode::kChildrenFieldNumber;
const int TreeNode::kObjectFieldNumber;
#endif // !_MSC_VER
TreeNode::TreeNode()
: ::google::protobuf::Message() {
SharedCtor();
}
void TreeNode::InitAsDefaultInstance() {
object_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
TreeNode::TreeNode(const TreeNode& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void TreeNode::SharedCtor() {
_cached_size_ = 0;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
object_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
TreeNode::~TreeNode() {
SharedDtor();
}
void TreeNode::SharedDtor() {
if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
if (this != default_instance_) {
delete object_;
}
}
void TreeNode::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* TreeNode::descriptor() {
protobuf_AssignDescriptorsOnce();
return TreeNode_descriptor_;
}
const TreeNode& TreeNode::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
TreeNode* TreeNode::default_instance_ = NULL;
TreeNode* TreeNode::New() const {
return new TreeNode;
}
void TreeNode::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_name()) {
if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
}
if (has_object()) {
if (object_ != NULL) object_->::TSP::Reference::Clear();
}
}
children_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool TreeNode::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_children;
break;
}
// repeated .TSP.Reference children = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_children:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_children()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_children;
if (input->ExpectTag(26)) goto parse_object;
break;
}
// optional .TSP.Reference object = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_object:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_object()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void TreeNode::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// optional string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
1, this->name(), output);
}
// repeated .TSP.Reference children = 2;
for (int i = 0; i < this->children_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->children(i), output);
}
// optional .TSP.Reference object = 3;
if (has_object()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->object(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* TreeNode::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// optional string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// repeated .TSP.Reference children = 2;
for (int i = 0; i < this->children_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->children(i), target);
}
// optional .TSP.Reference object = 3;
if (has_object()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->object(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int TreeNode::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .TSP.Reference object = 3;
if (has_object()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->object());
}
}
// repeated .TSP.Reference children = 2;
total_size += 1 * this->children_size();
for (int i = 0; i < this->children_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->children(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void TreeNode::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const TreeNode* source =
::google::protobuf::internal::dynamic_cast_if_available<const TreeNode*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void TreeNode::MergeFrom(const TreeNode& from) {
GOOGLE_CHECK_NE(&from, this);
children_.MergeFrom(from.children_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_name()) {
set_name(from.name());
}
if (from.has_object()) {
mutable_object()->::TSP::Reference::MergeFrom(from.object());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void TreeNode::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void TreeNode::CopyFrom(const TreeNode& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool TreeNode::IsInitialized() const {
for (int i = 0; i < children_size(); i++) {
if (!this->children(i).IsInitialized()) return false;
}
if (has_object()) {
if (!this->object().IsInitialized()) return false;
}
return true;
}
void TreeNode::Swap(TreeNode* other) {
if (other != this) {
std::swap(name_, other->name_);
children_.Swap(&other->children_);
std::swap(object_, other->object_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata TreeNode::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = TreeNode_descriptor_;
metadata.reflection = TreeNode_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CommandHistory::kUndoCountFieldNumber;
const int CommandHistory::kCommandsFieldNumber;
const int CommandHistory::kMarkedRedoCommandsFieldNumber;
const int CommandHistory::kPendingPreflightCommandFieldNumber;
const int CommandHistory::kFixedRadar13365177FieldNumber;
#endif // !_MSC_VER
CommandHistory::CommandHistory()
: ::google::protobuf::Message() {
SharedCtor();
}
void CommandHistory::InitAsDefaultInstance() {
pending_preflight_command_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
CommandHistory::CommandHistory(const CommandHistory& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void CommandHistory::SharedCtor() {
_cached_size_ = 0;
undo_count_ = 0u;
pending_preflight_command_ = NULL;
fixed_radar_13365177_ = false;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CommandHistory::~CommandHistory() {
SharedDtor();
}
void CommandHistory::SharedDtor() {
if (this != default_instance_) {
delete pending_preflight_command_;
}
}
void CommandHistory::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CommandHistory::descriptor() {
protobuf_AssignDescriptorsOnce();
return CommandHistory_descriptor_;
}
const CommandHistory& CommandHistory::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
CommandHistory* CommandHistory::default_instance_ = NULL;
CommandHistory* CommandHistory::New() const {
return new CommandHistory;
}
void CommandHistory::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
undo_count_ = 0u;
if (has_pending_preflight_command()) {
if (pending_preflight_command_ != NULL) pending_preflight_command_->::TSP::Reference::Clear();
}
fixed_radar_13365177_ = false;
}
commands_.Clear();
marked_redo_commands_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CommandHistory::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required uint32 undo_count = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &undo_count_)));
set_has_undo_count();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_commands;
break;
}
// repeated .TSP.Reference commands = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_commands:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_commands()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_commands;
if (input->ExpectTag(26)) goto parse_marked_redo_commands;
break;
}
// repeated .TSP.Reference marked_redo_commands = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_marked_redo_commands:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_marked_redo_commands()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_marked_redo_commands;
if (input->ExpectTag(34)) goto parse_pending_preflight_command;
break;
}
// optional .TSP.Reference pending_preflight_command = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_pending_preflight_command:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_pending_preflight_command()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(80)) goto parse_fixed_radar_13365177;
break;
}
// optional bool fixed_radar_13365177 = 10;
case 10: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_fixed_radar_13365177:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &fixed_radar_13365177_)));
set_has_fixed_radar_13365177();
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void CommandHistory::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required uint32 undo_count = 1;
if (has_undo_count()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->undo_count(), output);
}
// repeated .TSP.Reference commands = 2;
for (int i = 0; i < this->commands_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->commands(i), output);
}
// repeated .TSP.Reference marked_redo_commands = 3;
for (int i = 0; i < this->marked_redo_commands_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->marked_redo_commands(i), output);
}
// optional .TSP.Reference pending_preflight_command = 4;
if (has_pending_preflight_command()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->pending_preflight_command(), output);
}
// optional bool fixed_radar_13365177 = 10;
if (has_fixed_radar_13365177()) {
::google::protobuf::internal::WireFormatLite::WriteBool(10, this->fixed_radar_13365177(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* CommandHistory::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required uint32 undo_count = 1;
if (has_undo_count()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->undo_count(), target);
}
// repeated .TSP.Reference commands = 2;
for (int i = 0; i < this->commands_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->commands(i), target);
}
// repeated .TSP.Reference marked_redo_commands = 3;
for (int i = 0; i < this->marked_redo_commands_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->marked_redo_commands(i), target);
}
// optional .TSP.Reference pending_preflight_command = 4;
if (has_pending_preflight_command()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->pending_preflight_command(), target);
}
// optional bool fixed_radar_13365177 = 10;
if (has_fixed_radar_13365177()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->fixed_radar_13365177(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int CommandHistory::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required uint32 undo_count = 1;
if (has_undo_count()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->undo_count());
}
// optional .TSP.Reference pending_preflight_command = 4;
if (has_pending_preflight_command()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->pending_preflight_command());
}
// optional bool fixed_radar_13365177 = 10;
if (has_fixed_radar_13365177()) {
total_size += 1 + 1;
}
}
// repeated .TSP.Reference commands = 2;
total_size += 1 * this->commands_size();
for (int i = 0; i < this->commands_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->commands(i));
}
// repeated .TSP.Reference marked_redo_commands = 3;
total_size += 1 * this->marked_redo_commands_size();
for (int i = 0; i < this->marked_redo_commands_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->marked_redo_commands(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CommandHistory::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CommandHistory* source =
::google::protobuf::internal::dynamic_cast_if_available<const CommandHistory*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CommandHistory::MergeFrom(const CommandHistory& from) {
GOOGLE_CHECK_NE(&from, this);
commands_.MergeFrom(from.commands_);
marked_redo_commands_.MergeFrom(from.marked_redo_commands_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_undo_count()) {
set_undo_count(from.undo_count());
}
if (from.has_pending_preflight_command()) {
mutable_pending_preflight_command()->::TSP::Reference::MergeFrom(from.pending_preflight_command());
}
if (from.has_fixed_radar_13365177()) {
set_fixed_radar_13365177(from.fixed_radar_13365177());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CommandHistory::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CommandHistory::CopyFrom(const CommandHistory& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CommandHistory::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
for (int i = 0; i < commands_size(); i++) {
if (!this->commands(i).IsInitialized()) return false;
}
for (int i = 0; i < marked_redo_commands_size(); i++) {
if (!this->marked_redo_commands(i).IsInitialized()) return false;
}
if (has_pending_preflight_command()) {
if (!this->pending_preflight_command().IsInitialized()) return false;
}
return true;
}
void CommandHistory::Swap(CommandHistory* other) {
if (other != this) {
std::swap(undo_count_, other->undo_count_);
commands_.Swap(&other->commands_);
marked_redo_commands_.Swap(&other->marked_redo_commands_);
std::swap(pending_preflight_command_, other->pending_preflight_command_);
std::swap(fixed_radar_13365177_, other->fixed_radar_13365177_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CommandHistory::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CommandHistory_descriptor_;
metadata.reflection = CommandHistory_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int DocumentArchive::kLocaleIdentifierFieldNumber;
const int DocumentArchive::kAnnotationAuthorStorageFieldNumber;
#endif // !_MSC_VER
DocumentArchive::DocumentArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void DocumentArchive::InitAsDefaultInstance() {
annotation_author_storage_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
DocumentArchive::DocumentArchive(const DocumentArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void DocumentArchive::SharedCtor() {
_cached_size_ = 0;
locale_identifier_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
annotation_author_storage_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
DocumentArchive::~DocumentArchive() {
SharedDtor();
}
void DocumentArchive::SharedDtor() {
if (locale_identifier_ != &::google::protobuf::internal::kEmptyString) {
delete locale_identifier_;
}
if (this != default_instance_) {
delete annotation_author_storage_;
}
}
void DocumentArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DocumentArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return DocumentArchive_descriptor_;
}
const DocumentArchive& DocumentArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
DocumentArchive* DocumentArchive::default_instance_ = NULL;
DocumentArchive* DocumentArchive::New() const {
return new DocumentArchive;
}
void DocumentArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_locale_identifier()) {
if (locale_identifier_ != &::google::protobuf::internal::kEmptyString) {
locale_identifier_->clear();
}
}
if (has_annotation_author_storage()) {
if (annotation_author_storage_ != NULL) annotation_author_storage_->::TSP::Reference::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool DocumentArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string locale_identifier = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_locale_identifier()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->locale_identifier().data(), this->locale_identifier().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(58)) goto parse_annotation_author_storage;
break;
}
// optional .TSP.Reference annotation_author_storage = 7;
case 7: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_annotation_author_storage:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_annotation_author_storage()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void DocumentArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// optional string locale_identifier = 4;
if (has_locale_identifier()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->locale_identifier().data(), this->locale_identifier().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
4, this->locale_identifier(), output);
}
// optional .TSP.Reference annotation_author_storage = 7;
if (has_annotation_author_storage()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
7, this->annotation_author_storage(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* DocumentArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// optional string locale_identifier = 4;
if (has_locale_identifier()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->locale_identifier().data(), this->locale_identifier().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
4, this->locale_identifier(), target);
}
// optional .TSP.Reference annotation_author_storage = 7;
if (has_annotation_author_storage()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
7, this->annotation_author_storage(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int DocumentArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string locale_identifier = 4;
if (has_locale_identifier()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->locale_identifier());
}
// optional .TSP.Reference annotation_author_storage = 7;
if (has_annotation_author_storage()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->annotation_author_storage());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void DocumentArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const DocumentArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const DocumentArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void DocumentArchive::MergeFrom(const DocumentArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_locale_identifier()) {
set_locale_identifier(from.locale_identifier());
}
if (from.has_annotation_author_storage()) {
mutable_annotation_author_storage()->::TSP::Reference::MergeFrom(from.annotation_author_storage());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void DocumentArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DocumentArchive::CopyFrom(const DocumentArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DocumentArchive::IsInitialized() const {
if (has_annotation_author_storage()) {
if (!this->annotation_author_storage().IsInitialized()) return false;
}
return true;
}
void DocumentArchive::Swap(DocumentArchive* other) {
if (other != this) {
std::swap(locale_identifier_, other->locale_identifier_);
std::swap(annotation_author_storage_, other->annotation_author_storage_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata DocumentArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = DocumentArchive_descriptor_;
metadata.reflection = DocumentArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int DocumentSupportArchive::kCommandHistoryFieldNumber;
const int DocumentSupportArchive::kCommandSelectionBehaviorHistoryFieldNumber;
const int DocumentSupportArchive::kUndoCountFieldNumber;
const int DocumentSupportArchive::kRedoCountFieldNumber;
const int DocumentSupportArchive::kUndoActionStringFieldNumber;
const int DocumentSupportArchive::kRedoActionStringFieldNumber;
const int DocumentSupportArchive::kWebStateFieldNumber;
#endif // !_MSC_VER
DocumentSupportArchive::DocumentSupportArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void DocumentSupportArchive::InitAsDefaultInstance() {
command_history_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
command_selection_behavior_history_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
web_state_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
DocumentSupportArchive::DocumentSupportArchive(const DocumentSupportArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void DocumentSupportArchive::SharedCtor() {
_cached_size_ = 0;
command_history_ = NULL;
command_selection_behavior_history_ = NULL;
undo_count_ = 0u;
redo_count_ = 0u;
undo_action_string_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
redo_action_string_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
web_state_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
DocumentSupportArchive::~DocumentSupportArchive() {
SharedDtor();
}
void DocumentSupportArchive::SharedDtor() {
if (undo_action_string_ != &::google::protobuf::internal::kEmptyString) {
delete undo_action_string_;
}
if (redo_action_string_ != &::google::protobuf::internal::kEmptyString) {
delete redo_action_string_;
}
if (this != default_instance_) {
delete command_history_;
delete command_selection_behavior_history_;
delete web_state_;
}
}
void DocumentSupportArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DocumentSupportArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return DocumentSupportArchive_descriptor_;
}
const DocumentSupportArchive& DocumentSupportArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
DocumentSupportArchive* DocumentSupportArchive::default_instance_ = NULL;
DocumentSupportArchive* DocumentSupportArchive::New() const {
return new DocumentSupportArchive;
}
void DocumentSupportArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_command_history()) {
if (command_history_ != NULL) command_history_->::TSP::Reference::Clear();
}
if (has_command_selection_behavior_history()) {
if (command_selection_behavior_history_ != NULL) command_selection_behavior_history_->::TSP::Reference::Clear();
}
undo_count_ = 0u;
redo_count_ = 0u;
if (has_undo_action_string()) {
if (undo_action_string_ != &::google::protobuf::internal::kEmptyString) {
undo_action_string_->clear();
}
}
if (has_redo_action_string()) {
if (redo_action_string_ != &::google::protobuf::internal::kEmptyString) {
redo_action_string_->clear();
}
}
if (has_web_state()) {
if (web_state_ != NULL) web_state_->::TSP::Reference::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool DocumentSupportArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .TSP.Reference command_history = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_command_history()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_command_selection_behavior_history;
break;
}
// optional .TSP.Reference command_selection_behavior_history = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_command_selection_behavior_history:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_command_selection_behavior_history()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(32)) goto parse_undo_count;
break;
}
// optional uint32 undo_count = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_undo_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &undo_count_)));
set_has_undo_count();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(40)) goto parse_redo_count;
break;
}
// optional uint32 redo_count = 5;
case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_redo_count:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &redo_count_)));
set_has_redo_count();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(50)) goto parse_undo_action_string;
break;
}
// optional string undo_action_string = 6;
case 6: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_undo_action_string:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_undo_action_string()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->undo_action_string().data(), this->undo_action_string().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(58)) goto parse_redo_action_string;
break;
}
// optional string redo_action_string = 7;
case 7: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_redo_action_string:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_redo_action_string()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->redo_action_string().data(), this->redo_action_string().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(66)) goto parse_web_state;
break;
}
// optional .TSP.Reference web_state = 8;
case 8: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_web_state:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_web_state()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void DocumentSupportArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// optional .TSP.Reference command_history = 1;
if (has_command_history()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->command_history(), output);
}
// optional .TSP.Reference command_selection_behavior_history = 2;
if (has_command_selection_behavior_history()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->command_selection_behavior_history(), output);
}
// optional uint32 undo_count = 4;
if (has_undo_count()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->undo_count(), output);
}
// optional uint32 redo_count = 5;
if (has_redo_count()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->redo_count(), output);
}
// optional string undo_action_string = 6;
if (has_undo_action_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->undo_action_string().data(), this->undo_action_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
6, this->undo_action_string(), output);
}
// optional string redo_action_string = 7;
if (has_redo_action_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->redo_action_string().data(), this->redo_action_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
7, this->redo_action_string(), output);
}
// optional .TSP.Reference web_state = 8;
if (has_web_state()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
8, this->web_state(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* DocumentSupportArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// optional .TSP.Reference command_history = 1;
if (has_command_history()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->command_history(), target);
}
// optional .TSP.Reference command_selection_behavior_history = 2;
if (has_command_selection_behavior_history()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->command_selection_behavior_history(), target);
}
// optional uint32 undo_count = 4;
if (has_undo_count()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->undo_count(), target);
}
// optional uint32 redo_count = 5;
if (has_redo_count()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->redo_count(), target);
}
// optional string undo_action_string = 6;
if (has_undo_action_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->undo_action_string().data(), this->undo_action_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
6, this->undo_action_string(), target);
}
// optional string redo_action_string = 7;
if (has_redo_action_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->redo_action_string().data(), this->redo_action_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
7, this->redo_action_string(), target);
}
// optional .TSP.Reference web_state = 8;
if (has_web_state()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
8, this->web_state(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int DocumentSupportArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional .TSP.Reference command_history = 1;
if (has_command_history()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->command_history());
}
// optional .TSP.Reference command_selection_behavior_history = 2;
if (has_command_selection_behavior_history()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->command_selection_behavior_history());
}
// optional uint32 undo_count = 4;
if (has_undo_count()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->undo_count());
}
// optional uint32 redo_count = 5;
if (has_redo_count()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->redo_count());
}
// optional string undo_action_string = 6;
if (has_undo_action_string()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->undo_action_string());
}
// optional string redo_action_string = 7;
if (has_redo_action_string()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->redo_action_string());
}
// optional .TSP.Reference web_state = 8;
if (has_web_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->web_state());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void DocumentSupportArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const DocumentSupportArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const DocumentSupportArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void DocumentSupportArchive::MergeFrom(const DocumentSupportArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_command_history()) {
mutable_command_history()->::TSP::Reference::MergeFrom(from.command_history());
}
if (from.has_command_selection_behavior_history()) {
mutable_command_selection_behavior_history()->::TSP::Reference::MergeFrom(from.command_selection_behavior_history());
}
if (from.has_undo_count()) {
set_undo_count(from.undo_count());
}
if (from.has_redo_count()) {
set_redo_count(from.redo_count());
}
if (from.has_undo_action_string()) {
set_undo_action_string(from.undo_action_string());
}
if (from.has_redo_action_string()) {
set_redo_action_string(from.redo_action_string());
}
if (from.has_web_state()) {
mutable_web_state()->::TSP::Reference::MergeFrom(from.web_state());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void DocumentSupportArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DocumentSupportArchive::CopyFrom(const DocumentSupportArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DocumentSupportArchive::IsInitialized() const {
if (has_command_history()) {
if (!this->command_history().IsInitialized()) return false;
}
if (has_command_selection_behavior_history()) {
if (!this->command_selection_behavior_history().IsInitialized()) return false;
}
if (has_web_state()) {
if (!this->web_state().IsInitialized()) return false;
}
return true;
}
void DocumentSupportArchive::Swap(DocumentSupportArchive* other) {
if (other != this) {
std::swap(command_history_, other->command_history_);
std::swap(command_selection_behavior_history_, other->command_selection_behavior_history_);
std::swap(undo_count_, other->undo_count_);
std::swap(redo_count_, other->redo_count_);
std::swap(undo_action_string_, other->undo_action_string_);
std::swap(redo_action_string_, other->redo_action_string_);
std::swap(web_state_, other->web_state_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata DocumentSupportArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = DocumentSupportArchive_descriptor_;
metadata.reflection = DocumentSupportArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ViewStateArchive::kViewStateRootFieldNumber;
#endif // !_MSC_VER
ViewStateArchive::ViewStateArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void ViewStateArchive::InitAsDefaultInstance() {
view_state_root_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
ViewStateArchive::ViewStateArchive(const ViewStateArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void ViewStateArchive::SharedCtor() {
_cached_size_ = 0;
view_state_root_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ViewStateArchive::~ViewStateArchive() {
SharedDtor();
}
void ViewStateArchive::SharedDtor() {
if (this != default_instance_) {
delete view_state_root_;
}
}
void ViewStateArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ViewStateArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return ViewStateArchive_descriptor_;
}
const ViewStateArchive& ViewStateArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
ViewStateArchive* ViewStateArchive::default_instance_ = NULL;
ViewStateArchive* ViewStateArchive::New() const {
return new ViewStateArchive;
}
void ViewStateArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_view_state_root()) {
if (view_state_root_ != NULL) view_state_root_->::TSP::Reference::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ViewStateArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .TSP.Reference view_state_root = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_view_state_root()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void ViewStateArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .TSP.Reference view_state_root = 1;
if (has_view_state_root()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->view_state_root(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* ViewStateArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .TSP.Reference view_state_root = 1;
if (has_view_state_root()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->view_state_root(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int ViewStateArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .TSP.Reference view_state_root = 1;
if (has_view_state_root()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->view_state_root());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ViewStateArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ViewStateArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const ViewStateArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ViewStateArchive::MergeFrom(const ViewStateArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_view_state_root()) {
mutable_view_state_root()->::TSP::Reference::MergeFrom(from.view_state_root());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ViewStateArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ViewStateArchive::CopyFrom(const ViewStateArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ViewStateArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_view_state_root()) {
if (!this->view_state_root().IsInitialized()) return false;
}
return true;
}
void ViewStateArchive::Swap(ViewStateArchive* other) {
if (other != this) {
std::swap(view_state_root_, other->view_state_root_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ViewStateArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ViewStateArchive_descriptor_;
metadata.reflection = ViewStateArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CommandArchive::kUndoRedoStateFieldNumber;
const int CommandArchive::kUndoCollectionFieldNumber;
#endif // !_MSC_VER
CommandArchive::CommandArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void CommandArchive::InitAsDefaultInstance() {
undoredostate_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
undocollection_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
CommandArchive::CommandArchive(const CommandArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void CommandArchive::SharedCtor() {
_cached_size_ = 0;
undoredostate_ = NULL;
undocollection_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CommandArchive::~CommandArchive() {
SharedDtor();
}
void CommandArchive::SharedDtor() {
if (this != default_instance_) {
delete undoredostate_;
delete undocollection_;
}
}
void CommandArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CommandArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return CommandArchive_descriptor_;
}
const CommandArchive& CommandArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
CommandArchive* CommandArchive::default_instance_ = NULL;
CommandArchive* CommandArchive::New() const {
return new CommandArchive;
}
void CommandArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_undoredostate()) {
if (undoredostate_ != NULL) undoredostate_->::TSP::Reference::Clear();
}
if (has_undocollection()) {
if (undocollection_ != NULL) undocollection_->::TSP::Reference::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CommandArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .TSP.Reference undoRedoState = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_undoredostate()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_undoCollection;
break;
}
// optional .TSP.Reference undoCollection = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_undoCollection:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_undocollection()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void CommandArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// optional .TSP.Reference undoRedoState = 1;
if (has_undoredostate()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->undoredostate(), output);
}
// optional .TSP.Reference undoCollection = 2;
if (has_undocollection()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->undocollection(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* CommandArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// optional .TSP.Reference undoRedoState = 1;
if (has_undoredostate()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->undoredostate(), target);
}
// optional .TSP.Reference undoCollection = 2;
if (has_undocollection()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->undocollection(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int CommandArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional .TSP.Reference undoRedoState = 1;
if (has_undoredostate()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->undoredostate());
}
// optional .TSP.Reference undoCollection = 2;
if (has_undocollection()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->undocollection());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CommandArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CommandArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const CommandArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CommandArchive::MergeFrom(const CommandArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_undoredostate()) {
mutable_undoredostate()->::TSP::Reference::MergeFrom(from.undoredostate());
}
if (from.has_undocollection()) {
mutable_undocollection()->::TSP::Reference::MergeFrom(from.undocollection());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CommandArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CommandArchive::CopyFrom(const CommandArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CommandArchive::IsInitialized() const {
if (has_undoredostate()) {
if (!this->undoredostate().IsInitialized()) return false;
}
if (has_undocollection()) {
if (!this->undocollection().IsInitialized()) return false;
}
return true;
}
void CommandArchive::Swap(CommandArchive* other) {
if (other != this) {
std::swap(undoredostate_, other->undoredostate_);
std::swap(undocollection_, other->undocollection_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CommandArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CommandArchive_descriptor_;
metadata.reflection = CommandArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CommandGroupArchive::kSuperFieldNumber;
const int CommandGroupArchive::kCommandsFieldNumber;
const int CommandGroupArchive::kProcessResultsFieldNumber;
#endif // !_MSC_VER
CommandGroupArchive::CommandGroupArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void CommandGroupArchive::InitAsDefaultInstance() {
super_ = const_cast< ::TSK::CommandArchive*>(&::TSK::CommandArchive::default_instance());
process_results_ = const_cast< ::TSP::IndexSet*>(&::TSP::IndexSet::default_instance());
}
CommandGroupArchive::CommandGroupArchive(const CommandGroupArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void CommandGroupArchive::SharedCtor() {
_cached_size_ = 0;
super_ = NULL;
process_results_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CommandGroupArchive::~CommandGroupArchive() {
SharedDtor();
}
void CommandGroupArchive::SharedDtor() {
if (this != default_instance_) {
delete super_;
delete process_results_;
}
}
void CommandGroupArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CommandGroupArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return CommandGroupArchive_descriptor_;
}
const CommandGroupArchive& CommandGroupArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
CommandGroupArchive* CommandGroupArchive::default_instance_ = NULL;
CommandGroupArchive* CommandGroupArchive::New() const {
return new CommandGroupArchive;
}
void CommandGroupArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_super()) {
if (super_ != NULL) super_->::TSK::CommandArchive::Clear();
}
if (has_process_results()) {
if (process_results_ != NULL) process_results_->::TSP::IndexSet::Clear();
}
}
commands_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CommandGroupArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .TSK.CommandArchive super = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_super()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_commands;
break;
}
// repeated .TSP.Reference commands = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_commands:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_commands()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_commands;
if (input->ExpectTag(26)) goto parse_process_results;
break;
}
// optional .TSP.IndexSet process_results = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_process_results:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_process_results()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void CommandGroupArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->super(), output);
}
// repeated .TSP.Reference commands = 2;
for (int i = 0; i < this->commands_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->commands(i), output);
}
// optional .TSP.IndexSet process_results = 3;
if (has_process_results()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->process_results(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* CommandGroupArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->super(), target);
}
// repeated .TSP.Reference commands = 2;
for (int i = 0; i < this->commands_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->commands(i), target);
}
// optional .TSP.IndexSet process_results = 3;
if (has_process_results()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->process_results(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int CommandGroupArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->super());
}
// optional .TSP.IndexSet process_results = 3;
if (has_process_results()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->process_results());
}
}
// repeated .TSP.Reference commands = 2;
total_size += 1 * this->commands_size();
for (int i = 0; i < this->commands_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->commands(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CommandGroupArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CommandGroupArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const CommandGroupArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CommandGroupArchive::MergeFrom(const CommandGroupArchive& from) {
GOOGLE_CHECK_NE(&from, this);
commands_.MergeFrom(from.commands_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_super()) {
mutable_super()->::TSK::CommandArchive::MergeFrom(from.super());
}
if (from.has_process_results()) {
mutable_process_results()->::TSP::IndexSet::MergeFrom(from.process_results());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CommandGroupArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CommandGroupArchive::CopyFrom(const CommandGroupArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CommandGroupArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_super()) {
if (!this->super().IsInitialized()) return false;
}
for (int i = 0; i < commands_size(); i++) {
if (!this->commands(i).IsInitialized()) return false;
}
if (has_process_results()) {
if (!this->process_results().IsInitialized()) return false;
}
return true;
}
void CommandGroupArchive::Swap(CommandGroupArchive* other) {
if (other != this) {
std::swap(super_, other->super_);
commands_.Swap(&other->commands_);
std::swap(process_results_, other->process_results_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CommandGroupArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CommandGroupArchive_descriptor_;
metadata.reflection = CommandGroupArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CommandContainerArchive::kCommandsFieldNumber;
#endif // !_MSC_VER
CommandContainerArchive::CommandContainerArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void CommandContainerArchive::InitAsDefaultInstance() {
}
CommandContainerArchive::CommandContainerArchive(const CommandContainerArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void CommandContainerArchive::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CommandContainerArchive::~CommandContainerArchive() {
SharedDtor();
}
void CommandContainerArchive::SharedDtor() {
if (this != default_instance_) {
}
}
void CommandContainerArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CommandContainerArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return CommandContainerArchive_descriptor_;
}
const CommandContainerArchive& CommandContainerArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
CommandContainerArchive* CommandContainerArchive::default_instance_ = NULL;
CommandContainerArchive* CommandContainerArchive::New() const {
return new CommandContainerArchive;
}
void CommandContainerArchive::Clear() {
commands_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CommandContainerArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .TSP.Reference commands = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_commands:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_commands()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(10)) goto parse_commands;
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void CommandContainerArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// repeated .TSP.Reference commands = 1;
for (int i = 0; i < this->commands_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->commands(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* CommandContainerArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// repeated .TSP.Reference commands = 1;
for (int i = 0; i < this->commands_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->commands(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int CommandContainerArchive::ByteSize() const {
int total_size = 0;
// repeated .TSP.Reference commands = 1;
total_size += 1 * this->commands_size();
for (int i = 0; i < this->commands_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->commands(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CommandContainerArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CommandContainerArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const CommandContainerArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CommandContainerArchive::MergeFrom(const CommandContainerArchive& from) {
GOOGLE_CHECK_NE(&from, this);
commands_.MergeFrom(from.commands_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CommandContainerArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CommandContainerArchive::CopyFrom(const CommandContainerArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CommandContainerArchive::IsInitialized() const {
for (int i = 0; i < commands_size(); i++) {
if (!this->commands(i).IsInitialized()) return false;
}
return true;
}
void CommandContainerArchive::Swap(CommandContainerArchive* other) {
if (other != this) {
commands_.Swap(&other->commands_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CommandContainerArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CommandContainerArchive_descriptor_;
metadata.reflection = CommandContainerArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ReplaceAllChildCommandArchive::kSuperFieldNumber;
#endif // !_MSC_VER
ReplaceAllChildCommandArchive::ReplaceAllChildCommandArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void ReplaceAllChildCommandArchive::InitAsDefaultInstance() {
super_ = const_cast< ::TSK::CommandArchive*>(&::TSK::CommandArchive::default_instance());
}
ReplaceAllChildCommandArchive::ReplaceAllChildCommandArchive(const ReplaceAllChildCommandArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void ReplaceAllChildCommandArchive::SharedCtor() {
_cached_size_ = 0;
super_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ReplaceAllChildCommandArchive::~ReplaceAllChildCommandArchive() {
SharedDtor();
}
void ReplaceAllChildCommandArchive::SharedDtor() {
if (this != default_instance_) {
delete super_;
}
}
void ReplaceAllChildCommandArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ReplaceAllChildCommandArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return ReplaceAllChildCommandArchive_descriptor_;
}
const ReplaceAllChildCommandArchive& ReplaceAllChildCommandArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
ReplaceAllChildCommandArchive* ReplaceAllChildCommandArchive::default_instance_ = NULL;
ReplaceAllChildCommandArchive* ReplaceAllChildCommandArchive::New() const {
return new ReplaceAllChildCommandArchive;
}
void ReplaceAllChildCommandArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_super()) {
if (super_ != NULL) super_->::TSK::CommandArchive::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ReplaceAllChildCommandArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .TSK.CommandArchive super = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_super()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void ReplaceAllChildCommandArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->super(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* ReplaceAllChildCommandArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->super(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int ReplaceAllChildCommandArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->super());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ReplaceAllChildCommandArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ReplaceAllChildCommandArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const ReplaceAllChildCommandArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ReplaceAllChildCommandArchive::MergeFrom(const ReplaceAllChildCommandArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_super()) {
mutable_super()->::TSK::CommandArchive::MergeFrom(from.super());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ReplaceAllChildCommandArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReplaceAllChildCommandArchive::CopyFrom(const ReplaceAllChildCommandArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ReplaceAllChildCommandArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_super()) {
if (!this->super().IsInitialized()) return false;
}
return true;
}
void ReplaceAllChildCommandArchive::Swap(ReplaceAllChildCommandArchive* other) {
if (other != this) {
std::swap(super_, other->super_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ReplaceAllChildCommandArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ReplaceAllChildCommandArchive_descriptor_;
metadata.reflection = ReplaceAllChildCommandArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ReplaceAllCommandArchive::kSuperFieldNumber;
const int ReplaceAllCommandArchive::kCommandsFieldNumber;
const int ReplaceAllCommandArchive::kFindStringFieldNumber;
const int ReplaceAllCommandArchive::kReplaceStringFieldNumber;
const int ReplaceAllCommandArchive::kOptionsFieldNumber;
#endif // !_MSC_VER
ReplaceAllCommandArchive::ReplaceAllCommandArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void ReplaceAllCommandArchive::InitAsDefaultInstance() {
super_ = const_cast< ::TSK::CommandArchive*>(&::TSK::CommandArchive::default_instance());
}
ReplaceAllCommandArchive::ReplaceAllCommandArchive(const ReplaceAllCommandArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void ReplaceAllCommandArchive::SharedCtor() {
_cached_size_ = 0;
super_ = NULL;
find_string_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
replace_string_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
options_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ReplaceAllCommandArchive::~ReplaceAllCommandArchive() {
SharedDtor();
}
void ReplaceAllCommandArchive::SharedDtor() {
if (find_string_ != &::google::protobuf::internal::kEmptyString) {
delete find_string_;
}
if (replace_string_ != &::google::protobuf::internal::kEmptyString) {
delete replace_string_;
}
if (this != default_instance_) {
delete super_;
}
}
void ReplaceAllCommandArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ReplaceAllCommandArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return ReplaceAllCommandArchive_descriptor_;
}
const ReplaceAllCommandArchive& ReplaceAllCommandArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
ReplaceAllCommandArchive* ReplaceAllCommandArchive::default_instance_ = NULL;
ReplaceAllCommandArchive* ReplaceAllCommandArchive::New() const {
return new ReplaceAllCommandArchive;
}
void ReplaceAllCommandArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_super()) {
if (super_ != NULL) super_->::TSK::CommandArchive::Clear();
}
if (has_find_string()) {
if (find_string_ != &::google::protobuf::internal::kEmptyString) {
find_string_->clear();
}
}
if (has_replace_string()) {
if (replace_string_ != &::google::protobuf::internal::kEmptyString) {
replace_string_->clear();
}
}
options_ = 0u;
}
commands_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ReplaceAllCommandArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .TSK.CommandArchive super = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_super()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_commands;
break;
}
// repeated .TSP.Reference commands = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_commands:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_commands()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_commands;
if (input->ExpectTag(26)) goto parse_find_string;
break;
}
// required string find_string = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_find_string:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_find_string()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->find_string().data(), this->find_string().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(34)) goto parse_replace_string;
break;
}
// required string replace_string = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_replace_string:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_replace_string()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->replace_string().data(), this->replace_string().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(40)) goto parse_options;
break;
}
// required uint32 options = 5;
case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_options:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &options_)));
set_has_options();
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void ReplaceAllCommandArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->super(), output);
}
// repeated .TSP.Reference commands = 2;
for (int i = 0; i < this->commands_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->commands(i), output);
}
// required string find_string = 3;
if (has_find_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->find_string().data(), this->find_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
3, this->find_string(), output);
}
// required string replace_string = 4;
if (has_replace_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->replace_string().data(), this->replace_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
4, this->replace_string(), output);
}
// required uint32 options = 5;
if (has_options()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(5, this->options(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* ReplaceAllCommandArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->super(), target);
}
// repeated .TSP.Reference commands = 2;
for (int i = 0; i < this->commands_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->commands(i), target);
}
// required string find_string = 3;
if (has_find_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->find_string().data(), this->find_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->find_string(), target);
}
// required string replace_string = 4;
if (has_replace_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->replace_string().data(), this->replace_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
4, this->replace_string(), target);
}
// required uint32 options = 5;
if (has_options()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(5, this->options(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int ReplaceAllCommandArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->super());
}
// required string find_string = 3;
if (has_find_string()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->find_string());
}
// required string replace_string = 4;
if (has_replace_string()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->replace_string());
}
// required uint32 options = 5;
if (has_options()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->options());
}
}
// repeated .TSP.Reference commands = 2;
total_size += 1 * this->commands_size();
for (int i = 0; i < this->commands_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->commands(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ReplaceAllCommandArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ReplaceAllCommandArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const ReplaceAllCommandArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ReplaceAllCommandArchive::MergeFrom(const ReplaceAllCommandArchive& from) {
GOOGLE_CHECK_NE(&from, this);
commands_.MergeFrom(from.commands_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_super()) {
mutable_super()->::TSK::CommandArchive::MergeFrom(from.super());
}
if (from.has_find_string()) {
set_find_string(from.find_string());
}
if (from.has_replace_string()) {
set_replace_string(from.replace_string());
}
if (from.has_options()) {
set_options(from.options());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ReplaceAllCommandArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ReplaceAllCommandArchive::CopyFrom(const ReplaceAllCommandArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ReplaceAllCommandArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x0000001d) != 0x0000001d) return false;
if (has_super()) {
if (!this->super().IsInitialized()) return false;
}
for (int i = 0; i < commands_size(); i++) {
if (!this->commands(i).IsInitialized()) return false;
}
return true;
}
void ReplaceAllCommandArchive::Swap(ReplaceAllCommandArchive* other) {
if (other != this) {
std::swap(super_, other->super_);
commands_.Swap(&other->commands_);
std::swap(find_string_, other->find_string_);
std::swap(replace_string_, other->replace_string_);
std::swap(options_, other->options_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ReplaceAllCommandArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ReplaceAllCommandArchive_descriptor_;
metadata.reflection = ReplaceAllCommandArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ShuffleMappingArchive_Entry::kFromFieldNumber;
const int ShuffleMappingArchive_Entry::kToFieldNumber;
#endif // !_MSC_VER
ShuffleMappingArchive_Entry::ShuffleMappingArchive_Entry()
: ::google::protobuf::Message() {
SharedCtor();
}
void ShuffleMappingArchive_Entry::InitAsDefaultInstance() {
}
ShuffleMappingArchive_Entry::ShuffleMappingArchive_Entry(const ShuffleMappingArchive_Entry& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void ShuffleMappingArchive_Entry::SharedCtor() {
_cached_size_ = 0;
from_ = 0u;
to_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ShuffleMappingArchive_Entry::~ShuffleMappingArchive_Entry() {
SharedDtor();
}
void ShuffleMappingArchive_Entry::SharedDtor() {
if (this != default_instance_) {
}
}
void ShuffleMappingArchive_Entry::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ShuffleMappingArchive_Entry::descriptor() {
protobuf_AssignDescriptorsOnce();
return ShuffleMappingArchive_Entry_descriptor_;
}
const ShuffleMappingArchive_Entry& ShuffleMappingArchive_Entry::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
ShuffleMappingArchive_Entry* ShuffleMappingArchive_Entry::default_instance_ = NULL;
ShuffleMappingArchive_Entry* ShuffleMappingArchive_Entry::New() const {
return new ShuffleMappingArchive_Entry;
}
void ShuffleMappingArchive_Entry::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
from_ = 0u;
to_ = 0u;
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ShuffleMappingArchive_Entry::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required uint32 from = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &from_)));
set_has_from();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(16)) goto parse_to;
break;
}
// required uint32 to = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_to:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &to_)));
set_has_to();
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void ShuffleMappingArchive_Entry::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required uint32 from = 1;
if (has_from()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->from(), output);
}
// required uint32 to = 2;
if (has_to()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->to(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* ShuffleMappingArchive_Entry::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required uint32 from = 1;
if (has_from()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->from(), target);
}
// required uint32 to = 2;
if (has_to()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->to(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int ShuffleMappingArchive_Entry::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required uint32 from = 1;
if (has_from()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->from());
}
// required uint32 to = 2;
if (has_to()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->to());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ShuffleMappingArchive_Entry::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ShuffleMappingArchive_Entry* source =
::google::protobuf::internal::dynamic_cast_if_available<const ShuffleMappingArchive_Entry*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ShuffleMappingArchive_Entry::MergeFrom(const ShuffleMappingArchive_Entry& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_from()) {
set_from(from.from());
}
if (from.has_to()) {
set_to(from.to());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ShuffleMappingArchive_Entry::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ShuffleMappingArchive_Entry::CopyFrom(const ShuffleMappingArchive_Entry& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ShuffleMappingArchive_Entry::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
return true;
}
void ShuffleMappingArchive_Entry::Swap(ShuffleMappingArchive_Entry* other) {
if (other != this) {
std::swap(from_, other->from_);
std::swap(to_, other->to_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ShuffleMappingArchive_Entry::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ShuffleMappingArchive_Entry_descriptor_;
metadata.reflection = ShuffleMappingArchive_Entry_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int ShuffleMappingArchive::kStartIndexFieldNumber;
const int ShuffleMappingArchive::kEndIndexFieldNumber;
const int ShuffleMappingArchive::kEntriesFieldNumber;
const int ShuffleMappingArchive::kIsVerticalFieldNumber;
const int ShuffleMappingArchive::kIsMoveOperationFieldNumber;
const int ShuffleMappingArchive::kFirstMovedIndexFieldNumber;
const int ShuffleMappingArchive::kDestinationIndexForMoveFieldNumber;
const int ShuffleMappingArchive::kNumberOfIndicesMovedFieldNumber;
#endif // !_MSC_VER
ShuffleMappingArchive::ShuffleMappingArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void ShuffleMappingArchive::InitAsDefaultInstance() {
}
ShuffleMappingArchive::ShuffleMappingArchive(const ShuffleMappingArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void ShuffleMappingArchive::SharedCtor() {
_cached_size_ = 0;
start_index_ = 0u;
end_index_ = 0u;
is_vertical_ = true;
is_move_operation_ = false;
first_moved_index_ = 0u;
destination_index_for_move_ = 0u;
number_of_indices_moved_ = 0u;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ShuffleMappingArchive::~ShuffleMappingArchive() {
SharedDtor();
}
void ShuffleMappingArchive::SharedDtor() {
if (this != default_instance_) {
}
}
void ShuffleMappingArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ShuffleMappingArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return ShuffleMappingArchive_descriptor_;
}
const ShuffleMappingArchive& ShuffleMappingArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
ShuffleMappingArchive* ShuffleMappingArchive::default_instance_ = NULL;
ShuffleMappingArchive* ShuffleMappingArchive::New() const {
return new ShuffleMappingArchive;
}
void ShuffleMappingArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
start_index_ = 0u;
end_index_ = 0u;
is_vertical_ = true;
is_move_operation_ = false;
first_moved_index_ = 0u;
destination_index_for_move_ = 0u;
number_of_indices_moved_ = 0u;
}
entries_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ShuffleMappingArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required uint32 start_index = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &start_index_)));
set_has_start_index();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(16)) goto parse_end_index;
break;
}
// required uint32 end_index = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_end_index:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &end_index_)));
set_has_end_index();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_entries;
break;
}
// repeated .TSK.ShuffleMappingArchive.Entry entries = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_entries:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_entries()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_entries;
if (input->ExpectTag(32)) goto parse_is_vertical;
break;
}
// optional bool is_vertical = 4 [default = true];
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_is_vertical:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &is_vertical_)));
set_has_is_vertical();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(40)) goto parse_is_move_operation;
break;
}
// optional bool is_move_operation = 5 [default = false];
case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_is_move_operation:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &is_move_operation_)));
set_has_is_move_operation();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(48)) goto parse_first_moved_index;
break;
}
// optional uint32 first_moved_index = 6 [default = 0];
case 6: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_first_moved_index:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &first_moved_index_)));
set_has_first_moved_index();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(56)) goto parse_destination_index_for_move;
break;
}
// optional uint32 destination_index_for_move = 7 [default = 0];
case 7: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_destination_index_for_move:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &destination_index_for_move_)));
set_has_destination_index_for_move();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(64)) goto parse_number_of_indices_moved;
break;
}
// optional uint32 number_of_indices_moved = 8 [default = 0];
case 8: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_number_of_indices_moved:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &number_of_indices_moved_)));
set_has_number_of_indices_moved();
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void ShuffleMappingArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required uint32 start_index = 1;
if (has_start_index()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->start_index(), output);
}
// required uint32 end_index = 2;
if (has_end_index()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->end_index(), output);
}
// repeated .TSK.ShuffleMappingArchive.Entry entries = 3;
for (int i = 0; i < this->entries_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->entries(i), output);
}
// optional bool is_vertical = 4 [default = true];
if (has_is_vertical()) {
::google::protobuf::internal::WireFormatLite::WriteBool(4, this->is_vertical(), output);
}
// optional bool is_move_operation = 5 [default = false];
if (has_is_move_operation()) {
::google::protobuf::internal::WireFormatLite::WriteBool(5, this->is_move_operation(), output);
}
// optional uint32 first_moved_index = 6 [default = 0];
if (has_first_moved_index()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(6, this->first_moved_index(), output);
}
// optional uint32 destination_index_for_move = 7 [default = 0];
if (has_destination_index_for_move()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->destination_index_for_move(), output);
}
// optional uint32 number_of_indices_moved = 8 [default = 0];
if (has_number_of_indices_moved()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->number_of_indices_moved(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* ShuffleMappingArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required uint32 start_index = 1;
if (has_start_index()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->start_index(), target);
}
// required uint32 end_index = 2;
if (has_end_index()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->end_index(), target);
}
// repeated .TSK.ShuffleMappingArchive.Entry entries = 3;
for (int i = 0; i < this->entries_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->entries(i), target);
}
// optional bool is_vertical = 4 [default = true];
if (has_is_vertical()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(4, this->is_vertical(), target);
}
// optional bool is_move_operation = 5 [default = false];
if (has_is_move_operation()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->is_move_operation(), target);
}
// optional uint32 first_moved_index = 6 [default = 0];
if (has_first_moved_index()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(6, this->first_moved_index(), target);
}
// optional uint32 destination_index_for_move = 7 [default = 0];
if (has_destination_index_for_move()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->destination_index_for_move(), target);
}
// optional uint32 number_of_indices_moved = 8 [default = 0];
if (has_number_of_indices_moved()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->number_of_indices_moved(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int ShuffleMappingArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required uint32 start_index = 1;
if (has_start_index()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->start_index());
}
// required uint32 end_index = 2;
if (has_end_index()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->end_index());
}
// optional bool is_vertical = 4 [default = true];
if (has_is_vertical()) {
total_size += 1 + 1;
}
// optional bool is_move_operation = 5 [default = false];
if (has_is_move_operation()) {
total_size += 1 + 1;
}
// optional uint32 first_moved_index = 6 [default = 0];
if (has_first_moved_index()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->first_moved_index());
}
// optional uint32 destination_index_for_move = 7 [default = 0];
if (has_destination_index_for_move()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->destination_index_for_move());
}
// optional uint32 number_of_indices_moved = 8 [default = 0];
if (has_number_of_indices_moved()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->number_of_indices_moved());
}
}
// repeated .TSK.ShuffleMappingArchive.Entry entries = 3;
total_size += 1 * this->entries_size();
for (int i = 0; i < this->entries_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->entries(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ShuffleMappingArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ShuffleMappingArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const ShuffleMappingArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ShuffleMappingArchive::MergeFrom(const ShuffleMappingArchive& from) {
GOOGLE_CHECK_NE(&from, this);
entries_.MergeFrom(from.entries_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_start_index()) {
set_start_index(from.start_index());
}
if (from.has_end_index()) {
set_end_index(from.end_index());
}
if (from.has_is_vertical()) {
set_is_vertical(from.is_vertical());
}
if (from.has_is_move_operation()) {
set_is_move_operation(from.is_move_operation());
}
if (from.has_first_moved_index()) {
set_first_moved_index(from.first_moved_index());
}
if (from.has_destination_index_for_move()) {
set_destination_index_for_move(from.destination_index_for_move());
}
if (from.has_number_of_indices_moved()) {
set_number_of_indices_moved(from.number_of_indices_moved());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ShuffleMappingArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ShuffleMappingArchive::CopyFrom(const ShuffleMappingArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ShuffleMappingArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
for (int i = 0; i < entries_size(); i++) {
if (!this->entries(i).IsInitialized()) return false;
}
return true;
}
void ShuffleMappingArchive::Swap(ShuffleMappingArchive* other) {
if (other != this) {
std::swap(start_index_, other->start_index_);
std::swap(end_index_, other->end_index_);
entries_.Swap(&other->entries_);
std::swap(is_vertical_, other->is_vertical_);
std::swap(is_move_operation_, other->is_move_operation_);
std::swap(first_moved_index_, other->first_moved_index_);
std::swap(destination_index_for_move_, other->destination_index_for_move_);
std::swap(number_of_indices_moved_, other->number_of_indices_moved_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ShuffleMappingArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ShuffleMappingArchive_descriptor_;
metadata.reflection = ShuffleMappingArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int ProgressiveCommandGroupArchive::kSuperFieldNumber;
#endif // !_MSC_VER
ProgressiveCommandGroupArchive::ProgressiveCommandGroupArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void ProgressiveCommandGroupArchive::InitAsDefaultInstance() {
super_ = const_cast< ::TSK::CommandGroupArchive*>(&::TSK::CommandGroupArchive::default_instance());
}
ProgressiveCommandGroupArchive::ProgressiveCommandGroupArchive(const ProgressiveCommandGroupArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void ProgressiveCommandGroupArchive::SharedCtor() {
_cached_size_ = 0;
super_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
ProgressiveCommandGroupArchive::~ProgressiveCommandGroupArchive() {
SharedDtor();
}
void ProgressiveCommandGroupArchive::SharedDtor() {
if (this != default_instance_) {
delete super_;
}
}
void ProgressiveCommandGroupArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* ProgressiveCommandGroupArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return ProgressiveCommandGroupArchive_descriptor_;
}
const ProgressiveCommandGroupArchive& ProgressiveCommandGroupArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
ProgressiveCommandGroupArchive* ProgressiveCommandGroupArchive::default_instance_ = NULL;
ProgressiveCommandGroupArchive* ProgressiveCommandGroupArchive::New() const {
return new ProgressiveCommandGroupArchive;
}
void ProgressiveCommandGroupArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_super()) {
if (super_ != NULL) super_->::TSK::CommandGroupArchive::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool ProgressiveCommandGroupArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .TSK.CommandGroupArchive super = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_super()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void ProgressiveCommandGroupArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .TSK.CommandGroupArchive super = 1;
if (has_super()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->super(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* ProgressiveCommandGroupArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .TSK.CommandGroupArchive super = 1;
if (has_super()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->super(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int ProgressiveCommandGroupArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .TSK.CommandGroupArchive super = 1;
if (has_super()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->super());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void ProgressiveCommandGroupArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const ProgressiveCommandGroupArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const ProgressiveCommandGroupArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void ProgressiveCommandGroupArchive::MergeFrom(const ProgressiveCommandGroupArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_super()) {
mutable_super()->::TSK::CommandGroupArchive::MergeFrom(from.super());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void ProgressiveCommandGroupArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void ProgressiveCommandGroupArchive::CopyFrom(const ProgressiveCommandGroupArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool ProgressiveCommandGroupArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_super()) {
if (!this->super().IsInitialized()) return false;
}
return true;
}
void ProgressiveCommandGroupArchive::Swap(ProgressiveCommandGroupArchive* other) {
if (other != this) {
std::swap(super_, other->super_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata ProgressiveCommandGroupArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = ProgressiveCommandGroupArchive_descriptor_;
metadata.reflection = ProgressiveCommandGroupArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CommandSelectionBehaviorHistoryArchive_Entry::kCommandFieldNumber;
const int CommandSelectionBehaviorHistoryArchive_Entry::kCommandSelectionBehaviorFieldNumber;
#endif // !_MSC_VER
CommandSelectionBehaviorHistoryArchive_Entry::CommandSelectionBehaviorHistoryArchive_Entry()
: ::google::protobuf::Message() {
SharedCtor();
}
void CommandSelectionBehaviorHistoryArchive_Entry::InitAsDefaultInstance() {
command_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
command_selection_behavior_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
CommandSelectionBehaviorHistoryArchive_Entry::CommandSelectionBehaviorHistoryArchive_Entry(const CommandSelectionBehaviorHistoryArchive_Entry& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void CommandSelectionBehaviorHistoryArchive_Entry::SharedCtor() {
_cached_size_ = 0;
command_ = NULL;
command_selection_behavior_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CommandSelectionBehaviorHistoryArchive_Entry::~CommandSelectionBehaviorHistoryArchive_Entry() {
SharedDtor();
}
void CommandSelectionBehaviorHistoryArchive_Entry::SharedDtor() {
if (this != default_instance_) {
delete command_;
delete command_selection_behavior_;
}
}
void CommandSelectionBehaviorHistoryArchive_Entry::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CommandSelectionBehaviorHistoryArchive_Entry::descriptor() {
protobuf_AssignDescriptorsOnce();
return CommandSelectionBehaviorHistoryArchive_Entry_descriptor_;
}
const CommandSelectionBehaviorHistoryArchive_Entry& CommandSelectionBehaviorHistoryArchive_Entry::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
CommandSelectionBehaviorHistoryArchive_Entry* CommandSelectionBehaviorHistoryArchive_Entry::default_instance_ = NULL;
CommandSelectionBehaviorHistoryArchive_Entry* CommandSelectionBehaviorHistoryArchive_Entry::New() const {
return new CommandSelectionBehaviorHistoryArchive_Entry;
}
void CommandSelectionBehaviorHistoryArchive_Entry::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_command()) {
if (command_ != NULL) command_->::TSP::Reference::Clear();
}
if (has_command_selection_behavior()) {
if (command_selection_behavior_ != NULL) command_selection_behavior_->::TSP::Reference::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CommandSelectionBehaviorHistoryArchive_Entry::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .TSP.Reference command = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_command()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_command_selection_behavior;
break;
}
// required .TSP.Reference command_selection_behavior = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_command_selection_behavior:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_command_selection_behavior()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void CommandSelectionBehaviorHistoryArchive_Entry::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .TSP.Reference command = 1;
if (has_command()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->command(), output);
}
// required .TSP.Reference command_selection_behavior = 2;
if (has_command_selection_behavior()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->command_selection_behavior(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* CommandSelectionBehaviorHistoryArchive_Entry::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .TSP.Reference command = 1;
if (has_command()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->command(), target);
}
// required .TSP.Reference command_selection_behavior = 2;
if (has_command_selection_behavior()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->command_selection_behavior(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int CommandSelectionBehaviorHistoryArchive_Entry::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .TSP.Reference command = 1;
if (has_command()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->command());
}
// required .TSP.Reference command_selection_behavior = 2;
if (has_command_selection_behavior()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->command_selection_behavior());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CommandSelectionBehaviorHistoryArchive_Entry::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CommandSelectionBehaviorHistoryArchive_Entry* source =
::google::protobuf::internal::dynamic_cast_if_available<const CommandSelectionBehaviorHistoryArchive_Entry*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CommandSelectionBehaviorHistoryArchive_Entry::MergeFrom(const CommandSelectionBehaviorHistoryArchive_Entry& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_command()) {
mutable_command()->::TSP::Reference::MergeFrom(from.command());
}
if (from.has_command_selection_behavior()) {
mutable_command_selection_behavior()->::TSP::Reference::MergeFrom(from.command_selection_behavior());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CommandSelectionBehaviorHistoryArchive_Entry::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CommandSelectionBehaviorHistoryArchive_Entry::CopyFrom(const CommandSelectionBehaviorHistoryArchive_Entry& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CommandSelectionBehaviorHistoryArchive_Entry::IsInitialized() const {
if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false;
if (has_command()) {
if (!this->command().IsInitialized()) return false;
}
if (has_command_selection_behavior()) {
if (!this->command_selection_behavior().IsInitialized()) return false;
}
return true;
}
void CommandSelectionBehaviorHistoryArchive_Entry::Swap(CommandSelectionBehaviorHistoryArchive_Entry* other) {
if (other != this) {
std::swap(command_, other->command_);
std::swap(command_selection_behavior_, other->command_selection_behavior_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CommandSelectionBehaviorHistoryArchive_Entry::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CommandSelectionBehaviorHistoryArchive_Entry_descriptor_;
metadata.reflection = CommandSelectionBehaviorHistoryArchive_Entry_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CommandSelectionBehaviorHistoryArchive::kEntriesFieldNumber;
#endif // !_MSC_VER
CommandSelectionBehaviorHistoryArchive::CommandSelectionBehaviorHistoryArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void CommandSelectionBehaviorHistoryArchive::InitAsDefaultInstance() {
}
CommandSelectionBehaviorHistoryArchive::CommandSelectionBehaviorHistoryArchive(const CommandSelectionBehaviorHistoryArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void CommandSelectionBehaviorHistoryArchive::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CommandSelectionBehaviorHistoryArchive::~CommandSelectionBehaviorHistoryArchive() {
SharedDtor();
}
void CommandSelectionBehaviorHistoryArchive::SharedDtor() {
if (this != default_instance_) {
}
}
void CommandSelectionBehaviorHistoryArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CommandSelectionBehaviorHistoryArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return CommandSelectionBehaviorHistoryArchive_descriptor_;
}
const CommandSelectionBehaviorHistoryArchive& CommandSelectionBehaviorHistoryArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
CommandSelectionBehaviorHistoryArchive* CommandSelectionBehaviorHistoryArchive::default_instance_ = NULL;
CommandSelectionBehaviorHistoryArchive* CommandSelectionBehaviorHistoryArchive::New() const {
return new CommandSelectionBehaviorHistoryArchive;
}
void CommandSelectionBehaviorHistoryArchive::Clear() {
entries_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CommandSelectionBehaviorHistoryArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .TSK.CommandSelectionBehaviorHistoryArchive.Entry entries = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_entries:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_entries()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(10)) goto parse_entries;
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void CommandSelectionBehaviorHistoryArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// repeated .TSK.CommandSelectionBehaviorHistoryArchive.Entry entries = 1;
for (int i = 0; i < this->entries_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->entries(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* CommandSelectionBehaviorHistoryArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// repeated .TSK.CommandSelectionBehaviorHistoryArchive.Entry entries = 1;
for (int i = 0; i < this->entries_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->entries(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int CommandSelectionBehaviorHistoryArchive::ByteSize() const {
int total_size = 0;
// repeated .TSK.CommandSelectionBehaviorHistoryArchive.Entry entries = 1;
total_size += 1 * this->entries_size();
for (int i = 0; i < this->entries_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->entries(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CommandSelectionBehaviorHistoryArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CommandSelectionBehaviorHistoryArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const CommandSelectionBehaviorHistoryArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CommandSelectionBehaviorHistoryArchive::MergeFrom(const CommandSelectionBehaviorHistoryArchive& from) {
GOOGLE_CHECK_NE(&from, this);
entries_.MergeFrom(from.entries_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CommandSelectionBehaviorHistoryArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CommandSelectionBehaviorHistoryArchive::CopyFrom(const CommandSelectionBehaviorHistoryArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CommandSelectionBehaviorHistoryArchive::IsInitialized() const {
for (int i = 0; i < entries_size(); i++) {
if (!this->entries(i).IsInitialized()) return false;
}
return true;
}
void CommandSelectionBehaviorHistoryArchive::Swap(CommandSelectionBehaviorHistoryArchive* other) {
if (other != this) {
entries_.Swap(&other->entries_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CommandSelectionBehaviorHistoryArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CommandSelectionBehaviorHistoryArchive_descriptor_;
metadata.reflection = CommandSelectionBehaviorHistoryArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int UndoRedoStateCommandSelectionBehaviorArchive::kUndoRedoStateFieldNumber;
#endif // !_MSC_VER
UndoRedoStateCommandSelectionBehaviorArchive::UndoRedoStateCommandSelectionBehaviorArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void UndoRedoStateCommandSelectionBehaviorArchive::InitAsDefaultInstance() {
undo_redo_state_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
UndoRedoStateCommandSelectionBehaviorArchive::UndoRedoStateCommandSelectionBehaviorArchive(const UndoRedoStateCommandSelectionBehaviorArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void UndoRedoStateCommandSelectionBehaviorArchive::SharedCtor() {
_cached_size_ = 0;
undo_redo_state_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
UndoRedoStateCommandSelectionBehaviorArchive::~UndoRedoStateCommandSelectionBehaviorArchive() {
SharedDtor();
}
void UndoRedoStateCommandSelectionBehaviorArchive::SharedDtor() {
if (this != default_instance_) {
delete undo_redo_state_;
}
}
void UndoRedoStateCommandSelectionBehaviorArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* UndoRedoStateCommandSelectionBehaviorArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return UndoRedoStateCommandSelectionBehaviorArchive_descriptor_;
}
const UndoRedoStateCommandSelectionBehaviorArchive& UndoRedoStateCommandSelectionBehaviorArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
UndoRedoStateCommandSelectionBehaviorArchive* UndoRedoStateCommandSelectionBehaviorArchive::default_instance_ = NULL;
UndoRedoStateCommandSelectionBehaviorArchive* UndoRedoStateCommandSelectionBehaviorArchive::New() const {
return new UndoRedoStateCommandSelectionBehaviorArchive;
}
void UndoRedoStateCommandSelectionBehaviorArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_undo_redo_state()) {
if (undo_redo_state_ != NULL) undo_redo_state_->::TSP::Reference::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool UndoRedoStateCommandSelectionBehaviorArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional .TSP.Reference undo_redo_state = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_undo_redo_state()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void UndoRedoStateCommandSelectionBehaviorArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// optional .TSP.Reference undo_redo_state = 2;
if (has_undo_redo_state()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->undo_redo_state(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* UndoRedoStateCommandSelectionBehaviorArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// optional .TSP.Reference undo_redo_state = 2;
if (has_undo_redo_state()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->undo_redo_state(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int UndoRedoStateCommandSelectionBehaviorArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional .TSP.Reference undo_redo_state = 2;
if (has_undo_redo_state()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->undo_redo_state());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void UndoRedoStateCommandSelectionBehaviorArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const UndoRedoStateCommandSelectionBehaviorArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const UndoRedoStateCommandSelectionBehaviorArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void UndoRedoStateCommandSelectionBehaviorArchive::MergeFrom(const UndoRedoStateCommandSelectionBehaviorArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_undo_redo_state()) {
mutable_undo_redo_state()->::TSP::Reference::MergeFrom(from.undo_redo_state());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void UndoRedoStateCommandSelectionBehaviorArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void UndoRedoStateCommandSelectionBehaviorArchive::CopyFrom(const UndoRedoStateCommandSelectionBehaviorArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool UndoRedoStateCommandSelectionBehaviorArchive::IsInitialized() const {
if (has_undo_redo_state()) {
if (!this->undo_redo_state().IsInitialized()) return false;
}
return true;
}
void UndoRedoStateCommandSelectionBehaviorArchive::Swap(UndoRedoStateCommandSelectionBehaviorArchive* other) {
if (other != this) {
std::swap(undo_redo_state_, other->undo_redo_state_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata UndoRedoStateCommandSelectionBehaviorArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = UndoRedoStateCommandSelectionBehaviorArchive_descriptor_;
metadata.reflection = UndoRedoStateCommandSelectionBehaviorArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int FormatStructArchive::kFormatTypeFieldNumber;
const int FormatStructArchive::kDecimalPlacesFieldNumber;
const int FormatStructArchive::kCurrencyCodeFieldNumber;
const int FormatStructArchive::kNegativeStyleFieldNumber;
const int FormatStructArchive::kShowThousandsSeparatorFieldNumber;
const int FormatStructArchive::kUseAccountingStyleFieldNumber;
const int FormatStructArchive::kDurationStyleFieldNumber;
const int FormatStructArchive::kBaseFieldNumber;
const int FormatStructArchive::kBasePlacesFieldNumber;
const int FormatStructArchive::kBaseUseMinusSignFieldNumber;
const int FormatStructArchive::kFractionAccuracyFieldNumber;
const int FormatStructArchive::kSuppressDateFormatFieldNumber;
const int FormatStructArchive::kSuppressTimeFormatFieldNumber;
const int FormatStructArchive::kDateTimeFormatFieldNumber;
const int FormatStructArchive::kDurationUnitLargestFieldNumber;
const int FormatStructArchive::kDurationUnitSmallestFieldNumber;
const int FormatStructArchive::kCustomIdFieldNumber;
const int FormatStructArchive::kCustomFormatStringFieldNumber;
const int FormatStructArchive::kScaleFactorFieldNumber;
const int FormatStructArchive::kRequiresFractionReplacementFieldNumber;
const int FormatStructArchive::kControlMinimumFieldNumber;
const int FormatStructArchive::kControlMaximumFieldNumber;
const int FormatStructArchive::kControlIncrementFieldNumber;
const int FormatStructArchive::kControlFormatTypeFieldNumber;
const int FormatStructArchive::kSliderOrientationFieldNumber;
const int FormatStructArchive::kSliderPositionFieldNumber;
const int FormatStructArchive::kDecimalWidthFieldNumber;
const int FormatStructArchive::kMinIntegerWidthFieldNumber;
const int FormatStructArchive::kNumNonspaceIntegerDigitsFieldNumber;
const int FormatStructArchive::kNumNonspaceDecimalDigitsFieldNumber;
const int FormatStructArchive::kIndexFromRightLastIntegerFieldNumber;
const int FormatStructArchive::kInterstitialStringsFieldNumber;
const int FormatStructArchive::kIntersStrInsertionIndexesFieldNumber;
const int FormatStructArchive::kNumHashDecimalDigitsFieldNumber;
const int FormatStructArchive::kTotalNumDecimalDigitsFieldNumber;
const int FormatStructArchive::kIsComplexFieldNumber;
const int FormatStructArchive::kContainsIntegerTokenFieldNumber;
const int FormatStructArchive::kMultipleChoiceListInitialValueFieldNumber;
const int FormatStructArchive::kMultipleChoiceListIdFieldNumber;
const int FormatStructArchive::kUseAutomaticDurationUnitsFieldNumber;
#endif // !_MSC_VER
FormatStructArchive::FormatStructArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void FormatStructArchive::InitAsDefaultInstance() {
inters_str_insertion_indexes_ = const_cast< ::TSP::IndexSet*>(&::TSP::IndexSet::default_instance());
}
FormatStructArchive::FormatStructArchive(const FormatStructArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void FormatStructArchive::SharedCtor() {
_cached_size_ = 0;
format_type_ = 0u;
decimal_places_ = 0u;
currency_code_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
negative_style_ = 0u;
show_thousands_separator_ = false;
use_accounting_style_ = false;
duration_style_ = 0u;
base_ = 0u;
base_places_ = 0u;
base_use_minus_sign_ = false;
fraction_accuracy_ = 0u;
suppress_date_format_ = false;
suppress_time_format_ = false;
date_time_format_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
duration_unit_largest_ = 0u;
duration_unit_smallest_ = 0u;
custom_id_ = 0u;
custom_format_string_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
scale_factor_ = 0;
requires_fraction_replacement_ = false;
control_minimum_ = 0;
control_maximum_ = 0;
control_increment_ = 0;
control_format_type_ = 0u;
slider_orientation_ = 0u;
slider_position_ = 0u;
decimal_width_ = 0u;
min_integer_width_ = 0u;
num_nonspace_integer_digits_ = 0u;
num_nonspace_decimal_digits_ = 0u;
index_from_right_last_integer_ = 0u;
inters_str_insertion_indexes_ = NULL;
num_hash_decimal_digits_ = 0u;
total_num_decimal_digits_ = 0u;
is_complex_ = false;
contains_integer_token_ = false;
multiple_choice_list_initial_value_ = 0u;
multiple_choice_list_id_ = 0u;
use_automatic_duration_units_ = false;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
FormatStructArchive::~FormatStructArchive() {
SharedDtor();
}
void FormatStructArchive::SharedDtor() {
if (currency_code_ != &::google::protobuf::internal::kEmptyString) {
delete currency_code_;
}
if (date_time_format_ != &::google::protobuf::internal::kEmptyString) {
delete date_time_format_;
}
if (custom_format_string_ != &::google::protobuf::internal::kEmptyString) {
delete custom_format_string_;
}
if (this != default_instance_) {
delete inters_str_insertion_indexes_;
}
}
void FormatStructArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* FormatStructArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return FormatStructArchive_descriptor_;
}
const FormatStructArchive& FormatStructArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
FormatStructArchive* FormatStructArchive::default_instance_ = NULL;
FormatStructArchive* FormatStructArchive::New() const {
return new FormatStructArchive;
}
void FormatStructArchive::Clear() {
_extensions_.Clear();
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
format_type_ = 0u;
decimal_places_ = 0u;
if (has_currency_code()) {
if (currency_code_ != &::google::protobuf::internal::kEmptyString) {
currency_code_->clear();
}
}
negative_style_ = 0u;
show_thousands_separator_ = false;
use_accounting_style_ = false;
duration_style_ = 0u;
base_ = 0u;
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
base_places_ = 0u;
base_use_minus_sign_ = false;
fraction_accuracy_ = 0u;
suppress_date_format_ = false;
suppress_time_format_ = false;
if (has_date_time_format()) {
if (date_time_format_ != &::google::protobuf::internal::kEmptyString) {
date_time_format_->clear();
}
}
duration_unit_largest_ = 0u;
duration_unit_smallest_ = 0u;
}
if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) {
custom_id_ = 0u;
if (has_custom_format_string()) {
if (custom_format_string_ != &::google::protobuf::internal::kEmptyString) {
custom_format_string_->clear();
}
}
scale_factor_ = 0;
requires_fraction_replacement_ = false;
control_minimum_ = 0;
control_maximum_ = 0;
control_increment_ = 0;
control_format_type_ = 0u;
}
if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) {
slider_orientation_ = 0u;
slider_position_ = 0u;
decimal_width_ = 0u;
min_integer_width_ = 0u;
num_nonspace_integer_digits_ = 0u;
num_nonspace_decimal_digits_ = 0u;
index_from_right_last_integer_ = 0u;
}
if (_has_bits_[32 / 32] & (0xffu << (32 % 32))) {
if (has_inters_str_insertion_indexes()) {
if (inters_str_insertion_indexes_ != NULL) inters_str_insertion_indexes_->::TSP::IndexSet::Clear();
}
num_hash_decimal_digits_ = 0u;
total_num_decimal_digits_ = 0u;
is_complex_ = false;
contains_integer_token_ = false;
multiple_choice_list_initial_value_ = 0u;
multiple_choice_list_id_ = 0u;
use_automatic_duration_units_ = false;
}
interstitial_strings_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool FormatStructArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required uint32 format_type = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &format_type_)));
set_has_format_type();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(16)) goto parse_decimal_places;
break;
}
// optional uint32 decimal_places = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_decimal_places:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &decimal_places_)));
set_has_decimal_places();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_currency_code;
break;
}
// optional string currency_code = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_currency_code:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_currency_code()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->currency_code().data(), this->currency_code().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(32)) goto parse_negative_style;
break;
}
// optional uint32 negative_style = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_negative_style:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &negative_style_)));
set_has_negative_style();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(40)) goto parse_show_thousands_separator;
break;
}
// optional bool show_thousands_separator = 5;
case 5: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_show_thousands_separator:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &show_thousands_separator_)));
set_has_show_thousands_separator();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(48)) goto parse_use_accounting_style;
break;
}
// optional bool use_accounting_style = 6;
case 6: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_use_accounting_style:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &use_accounting_style_)));
set_has_use_accounting_style();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(56)) goto parse_duration_style;
break;
}
// optional uint32 duration_style = 7;
case 7: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_duration_style:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &duration_style_)));
set_has_duration_style();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(64)) goto parse_base;
break;
}
// optional uint32 base = 8;
case 8: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_base:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &base_)));
set_has_base();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(72)) goto parse_base_places;
break;
}
// optional uint32 base_places = 9;
case 9: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_base_places:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &base_places_)));
set_has_base_places();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(80)) goto parse_base_use_minus_sign;
break;
}
// optional bool base_use_minus_sign = 10;
case 10: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_base_use_minus_sign:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &base_use_minus_sign_)));
set_has_base_use_minus_sign();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(88)) goto parse_fraction_accuracy;
break;
}
// optional uint32 fraction_accuracy = 11;
case 11: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_fraction_accuracy:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &fraction_accuracy_)));
set_has_fraction_accuracy();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(96)) goto parse_suppress_date_format;
break;
}
// optional bool suppress_date_format = 12;
case 12: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_suppress_date_format:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &suppress_date_format_)));
set_has_suppress_date_format();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(104)) goto parse_suppress_time_format;
break;
}
// optional bool suppress_time_format = 13;
case 13: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_suppress_time_format:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &suppress_time_format_)));
set_has_suppress_time_format();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(114)) goto parse_date_time_format;
break;
}
// optional string date_time_format = 14;
case 14: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_date_time_format:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_date_time_format()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->date_time_format().data(), this->date_time_format().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(120)) goto parse_duration_unit_largest;
break;
}
// optional uint32 duration_unit_largest = 15;
case 15: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_duration_unit_largest:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &duration_unit_largest_)));
set_has_duration_unit_largest();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(128)) goto parse_duration_unit_smallest;
break;
}
// optional uint32 duration_unit_smallest = 16;
case 16: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_duration_unit_smallest:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &duration_unit_smallest_)));
set_has_duration_unit_smallest();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(136)) goto parse_custom_id;
break;
}
// optional uint32 custom_id = 17;
case 17: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_custom_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &custom_id_)));
set_has_custom_id();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(146)) goto parse_custom_format_string;
break;
}
// optional string custom_format_string = 18;
case 18: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_custom_format_string:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_custom_format_string()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->custom_format_string().data(), this->custom_format_string().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(153)) goto parse_scale_factor;
break;
}
// optional double scale_factor = 19;
case 19: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) {
parse_scale_factor:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
input, &scale_factor_)));
set_has_scale_factor();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(160)) goto parse_requires_fraction_replacement;
break;
}
// optional bool requires_fraction_replacement = 20;
case 20: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_requires_fraction_replacement:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &requires_fraction_replacement_)));
set_has_requires_fraction_replacement();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(169)) goto parse_control_minimum;
break;
}
// optional double control_minimum = 21;
case 21: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) {
parse_control_minimum:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
input, &control_minimum_)));
set_has_control_minimum();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(177)) goto parse_control_maximum;
break;
}
// optional double control_maximum = 22;
case 22: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) {
parse_control_maximum:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
input, &control_maximum_)));
set_has_control_maximum();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(185)) goto parse_control_increment;
break;
}
// optional double control_increment = 23;
case 23: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) {
parse_control_increment:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
input, &control_increment_)));
set_has_control_increment();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(192)) goto parse_control_format_type;
break;
}
// optional uint32 control_format_type = 24;
case 24: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_control_format_type:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &control_format_type_)));
set_has_control_format_type();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(200)) goto parse_slider_orientation;
break;
}
// optional uint32 slider_orientation = 25;
case 25: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_slider_orientation:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &slider_orientation_)));
set_has_slider_orientation();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(208)) goto parse_slider_position;
break;
}
// optional uint32 slider_position = 26;
case 26: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_slider_position:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &slider_position_)));
set_has_slider_position();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(216)) goto parse_decimal_width;
break;
}
// optional uint32 decimal_width = 27;
case 27: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_decimal_width:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &decimal_width_)));
set_has_decimal_width();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(224)) goto parse_min_integer_width;
break;
}
// optional uint32 min_integer_width = 28;
case 28: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_min_integer_width:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &min_integer_width_)));
set_has_min_integer_width();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(232)) goto parse_num_nonspace_integer_digits;
break;
}
// optional uint32 num_nonspace_integer_digits = 29;
case 29: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_num_nonspace_integer_digits:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &num_nonspace_integer_digits_)));
set_has_num_nonspace_integer_digits();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(240)) goto parse_num_nonspace_decimal_digits;
break;
}
// optional uint32 num_nonspace_decimal_digits = 30;
case 30: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_num_nonspace_decimal_digits:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &num_nonspace_decimal_digits_)));
set_has_num_nonspace_decimal_digits();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(248)) goto parse_index_from_right_last_integer;
break;
}
// optional uint32 index_from_right_last_integer = 31;
case 31: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_index_from_right_last_integer:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &index_from_right_last_integer_)));
set_has_index_from_right_last_integer();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(258)) goto parse_interstitial_strings;
break;
}
// repeated string interstitial_strings = 32;
case 32: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_interstitial_strings:
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->add_interstitial_strings()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->interstitial_strings(this->interstitial_strings_size() - 1).data(),
this->interstitial_strings(this->interstitial_strings_size() - 1).length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(258)) goto parse_interstitial_strings;
if (input->ExpectTag(266)) goto parse_inters_str_insertion_indexes;
break;
}
// optional .TSP.IndexSet inters_str_insertion_indexes = 33;
case 33: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_inters_str_insertion_indexes:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_inters_str_insertion_indexes()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(272)) goto parse_num_hash_decimal_digits;
break;
}
// optional uint32 num_hash_decimal_digits = 34;
case 34: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_num_hash_decimal_digits:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &num_hash_decimal_digits_)));
set_has_num_hash_decimal_digits();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(280)) goto parse_total_num_decimal_digits;
break;
}
// optional uint32 total_num_decimal_digits = 35;
case 35: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_total_num_decimal_digits:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &total_num_decimal_digits_)));
set_has_total_num_decimal_digits();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(288)) goto parse_is_complex;
break;
}
// optional bool is_complex = 36;
case 36: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_is_complex:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &is_complex_)));
set_has_is_complex();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(296)) goto parse_contains_integer_token;
break;
}
// optional bool contains_integer_token = 37;
case 37: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_contains_integer_token:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &contains_integer_token_)));
set_has_contains_integer_token();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(304)) goto parse_multiple_choice_list_initial_value;
break;
}
// optional uint32 multiple_choice_list_initial_value = 38;
case 38: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_multiple_choice_list_initial_value:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &multiple_choice_list_initial_value_)));
set_has_multiple_choice_list_initial_value();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(312)) goto parse_multiple_choice_list_id;
break;
}
// optional uint32 multiple_choice_list_id = 39;
case 39: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_multiple_choice_list_id:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &multiple_choice_list_id_)));
set_has_multiple_choice_list_id();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(320)) goto parse_use_automatic_duration_units;
break;
}
// optional bool use_automatic_duration_units = 40;
case 40: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_use_automatic_duration_units:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>(
input, &use_automatic_duration_units_)));
set_has_use_automatic_duration_units();
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
if ((80000u <= tag && tag < 160000u)) {
DO_(_extensions_.ParseField(tag, input, default_instance_,
mutable_unknown_fields()));
continue;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void FormatStructArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required uint32 format_type = 1;
if (has_format_type()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->format_type(), output);
}
// optional uint32 decimal_places = 2;
if (has_decimal_places()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->decimal_places(), output);
}
// optional string currency_code = 3;
if (has_currency_code()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->currency_code().data(), this->currency_code().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
3, this->currency_code(), output);
}
// optional uint32 negative_style = 4;
if (has_negative_style()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(4, this->negative_style(), output);
}
// optional bool show_thousands_separator = 5;
if (has_show_thousands_separator()) {
::google::protobuf::internal::WireFormatLite::WriteBool(5, this->show_thousands_separator(), output);
}
// optional bool use_accounting_style = 6;
if (has_use_accounting_style()) {
::google::protobuf::internal::WireFormatLite::WriteBool(6, this->use_accounting_style(), output);
}
// optional uint32 duration_style = 7;
if (has_duration_style()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(7, this->duration_style(), output);
}
// optional uint32 base = 8;
if (has_base()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(8, this->base(), output);
}
// optional uint32 base_places = 9;
if (has_base_places()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(9, this->base_places(), output);
}
// optional bool base_use_minus_sign = 10;
if (has_base_use_minus_sign()) {
::google::protobuf::internal::WireFormatLite::WriteBool(10, this->base_use_minus_sign(), output);
}
// optional uint32 fraction_accuracy = 11;
if (has_fraction_accuracy()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(11, this->fraction_accuracy(), output);
}
// optional bool suppress_date_format = 12;
if (has_suppress_date_format()) {
::google::protobuf::internal::WireFormatLite::WriteBool(12, this->suppress_date_format(), output);
}
// optional bool suppress_time_format = 13;
if (has_suppress_time_format()) {
::google::protobuf::internal::WireFormatLite::WriteBool(13, this->suppress_time_format(), output);
}
// optional string date_time_format = 14;
if (has_date_time_format()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->date_time_format().data(), this->date_time_format().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
14, this->date_time_format(), output);
}
// optional uint32 duration_unit_largest = 15;
if (has_duration_unit_largest()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(15, this->duration_unit_largest(), output);
}
// optional uint32 duration_unit_smallest = 16;
if (has_duration_unit_smallest()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(16, this->duration_unit_smallest(), output);
}
// optional uint32 custom_id = 17;
if (has_custom_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(17, this->custom_id(), output);
}
// optional string custom_format_string = 18;
if (has_custom_format_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->custom_format_string().data(), this->custom_format_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
18, this->custom_format_string(), output);
}
// optional double scale_factor = 19;
if (has_scale_factor()) {
::google::protobuf::internal::WireFormatLite::WriteDouble(19, this->scale_factor(), output);
}
// optional bool requires_fraction_replacement = 20;
if (has_requires_fraction_replacement()) {
::google::protobuf::internal::WireFormatLite::WriteBool(20, this->requires_fraction_replacement(), output);
}
// optional double control_minimum = 21;
if (has_control_minimum()) {
::google::protobuf::internal::WireFormatLite::WriteDouble(21, this->control_minimum(), output);
}
// optional double control_maximum = 22;
if (has_control_maximum()) {
::google::protobuf::internal::WireFormatLite::WriteDouble(22, this->control_maximum(), output);
}
// optional double control_increment = 23;
if (has_control_increment()) {
::google::protobuf::internal::WireFormatLite::WriteDouble(23, this->control_increment(), output);
}
// optional uint32 control_format_type = 24;
if (has_control_format_type()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(24, this->control_format_type(), output);
}
// optional uint32 slider_orientation = 25;
if (has_slider_orientation()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(25, this->slider_orientation(), output);
}
// optional uint32 slider_position = 26;
if (has_slider_position()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(26, this->slider_position(), output);
}
// optional uint32 decimal_width = 27;
if (has_decimal_width()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(27, this->decimal_width(), output);
}
// optional uint32 min_integer_width = 28;
if (has_min_integer_width()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(28, this->min_integer_width(), output);
}
// optional uint32 num_nonspace_integer_digits = 29;
if (has_num_nonspace_integer_digits()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(29, this->num_nonspace_integer_digits(), output);
}
// optional uint32 num_nonspace_decimal_digits = 30;
if (has_num_nonspace_decimal_digits()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(30, this->num_nonspace_decimal_digits(), output);
}
// optional uint32 index_from_right_last_integer = 31;
if (has_index_from_right_last_integer()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(31, this->index_from_right_last_integer(), output);
}
// repeated string interstitial_strings = 32;
for (int i = 0; i < this->interstitial_strings_size(); i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->interstitial_strings(i).data(), this->interstitial_strings(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
32, this->interstitial_strings(i), output);
}
// optional .TSP.IndexSet inters_str_insertion_indexes = 33;
if (has_inters_str_insertion_indexes()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
33, this->inters_str_insertion_indexes(), output);
}
// optional uint32 num_hash_decimal_digits = 34;
if (has_num_hash_decimal_digits()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(34, this->num_hash_decimal_digits(), output);
}
// optional uint32 total_num_decimal_digits = 35;
if (has_total_num_decimal_digits()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(35, this->total_num_decimal_digits(), output);
}
// optional bool is_complex = 36;
if (has_is_complex()) {
::google::protobuf::internal::WireFormatLite::WriteBool(36, this->is_complex(), output);
}
// optional bool contains_integer_token = 37;
if (has_contains_integer_token()) {
::google::protobuf::internal::WireFormatLite::WriteBool(37, this->contains_integer_token(), output);
}
// optional uint32 multiple_choice_list_initial_value = 38;
if (has_multiple_choice_list_initial_value()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(38, this->multiple_choice_list_initial_value(), output);
}
// optional uint32 multiple_choice_list_id = 39;
if (has_multiple_choice_list_id()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(39, this->multiple_choice_list_id(), output);
}
// optional bool use_automatic_duration_units = 40;
if (has_use_automatic_duration_units()) {
::google::protobuf::internal::WireFormatLite::WriteBool(40, this->use_automatic_duration_units(), output);
}
// Extension range [10000, 20000)
_extensions_.SerializeWithCachedSizes(
10000, 20000, output);
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* FormatStructArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required uint32 format_type = 1;
if (has_format_type()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->format_type(), target);
}
// optional uint32 decimal_places = 2;
if (has_decimal_places()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->decimal_places(), target);
}
// optional string currency_code = 3;
if (has_currency_code()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->currency_code().data(), this->currency_code().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
3, this->currency_code(), target);
}
// optional uint32 negative_style = 4;
if (has_negative_style()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(4, this->negative_style(), target);
}
// optional bool show_thousands_separator = 5;
if (has_show_thousands_separator()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(5, this->show_thousands_separator(), target);
}
// optional bool use_accounting_style = 6;
if (has_use_accounting_style()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(6, this->use_accounting_style(), target);
}
// optional uint32 duration_style = 7;
if (has_duration_style()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(7, this->duration_style(), target);
}
// optional uint32 base = 8;
if (has_base()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(8, this->base(), target);
}
// optional uint32 base_places = 9;
if (has_base_places()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(9, this->base_places(), target);
}
// optional bool base_use_minus_sign = 10;
if (has_base_use_minus_sign()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(10, this->base_use_minus_sign(), target);
}
// optional uint32 fraction_accuracy = 11;
if (has_fraction_accuracy()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(11, this->fraction_accuracy(), target);
}
// optional bool suppress_date_format = 12;
if (has_suppress_date_format()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(12, this->suppress_date_format(), target);
}
// optional bool suppress_time_format = 13;
if (has_suppress_time_format()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(13, this->suppress_time_format(), target);
}
// optional string date_time_format = 14;
if (has_date_time_format()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->date_time_format().data(), this->date_time_format().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
14, this->date_time_format(), target);
}
// optional uint32 duration_unit_largest = 15;
if (has_duration_unit_largest()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(15, this->duration_unit_largest(), target);
}
// optional uint32 duration_unit_smallest = 16;
if (has_duration_unit_smallest()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(16, this->duration_unit_smallest(), target);
}
// optional uint32 custom_id = 17;
if (has_custom_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(17, this->custom_id(), target);
}
// optional string custom_format_string = 18;
if (has_custom_format_string()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->custom_format_string().data(), this->custom_format_string().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
18, this->custom_format_string(), target);
}
// optional double scale_factor = 19;
if (has_scale_factor()) {
target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(19, this->scale_factor(), target);
}
// optional bool requires_fraction_replacement = 20;
if (has_requires_fraction_replacement()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(20, this->requires_fraction_replacement(), target);
}
// optional double control_minimum = 21;
if (has_control_minimum()) {
target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(21, this->control_minimum(), target);
}
// optional double control_maximum = 22;
if (has_control_maximum()) {
target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(22, this->control_maximum(), target);
}
// optional double control_increment = 23;
if (has_control_increment()) {
target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(23, this->control_increment(), target);
}
// optional uint32 control_format_type = 24;
if (has_control_format_type()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(24, this->control_format_type(), target);
}
// optional uint32 slider_orientation = 25;
if (has_slider_orientation()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(25, this->slider_orientation(), target);
}
// optional uint32 slider_position = 26;
if (has_slider_position()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(26, this->slider_position(), target);
}
// optional uint32 decimal_width = 27;
if (has_decimal_width()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(27, this->decimal_width(), target);
}
// optional uint32 min_integer_width = 28;
if (has_min_integer_width()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(28, this->min_integer_width(), target);
}
// optional uint32 num_nonspace_integer_digits = 29;
if (has_num_nonspace_integer_digits()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(29, this->num_nonspace_integer_digits(), target);
}
// optional uint32 num_nonspace_decimal_digits = 30;
if (has_num_nonspace_decimal_digits()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(30, this->num_nonspace_decimal_digits(), target);
}
// optional uint32 index_from_right_last_integer = 31;
if (has_index_from_right_last_integer()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(31, this->index_from_right_last_integer(), target);
}
// repeated string interstitial_strings = 32;
for (int i = 0; i < this->interstitial_strings_size(); i++) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->interstitial_strings(i).data(), this->interstitial_strings(i).length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target = ::google::protobuf::internal::WireFormatLite::
WriteStringToArray(32, this->interstitial_strings(i), target);
}
// optional .TSP.IndexSet inters_str_insertion_indexes = 33;
if (has_inters_str_insertion_indexes()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
33, this->inters_str_insertion_indexes(), target);
}
// optional uint32 num_hash_decimal_digits = 34;
if (has_num_hash_decimal_digits()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(34, this->num_hash_decimal_digits(), target);
}
// optional uint32 total_num_decimal_digits = 35;
if (has_total_num_decimal_digits()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(35, this->total_num_decimal_digits(), target);
}
// optional bool is_complex = 36;
if (has_is_complex()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(36, this->is_complex(), target);
}
// optional bool contains_integer_token = 37;
if (has_contains_integer_token()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(37, this->contains_integer_token(), target);
}
// optional uint32 multiple_choice_list_initial_value = 38;
if (has_multiple_choice_list_initial_value()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(38, this->multiple_choice_list_initial_value(), target);
}
// optional uint32 multiple_choice_list_id = 39;
if (has_multiple_choice_list_id()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(39, this->multiple_choice_list_id(), target);
}
// optional bool use_automatic_duration_units = 40;
if (has_use_automatic_duration_units()) {
target = ::google::protobuf::internal::WireFormatLite::WriteBoolToArray(40, this->use_automatic_duration_units(), target);
}
// Extension range [10000, 20000)
target = _extensions_.SerializeWithCachedSizesToArray(
10000, 20000, target);
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int FormatStructArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required uint32 format_type = 1;
if (has_format_type()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->format_type());
}
// optional uint32 decimal_places = 2;
if (has_decimal_places()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->decimal_places());
}
// optional string currency_code = 3;
if (has_currency_code()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->currency_code());
}
// optional uint32 negative_style = 4;
if (has_negative_style()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->negative_style());
}
// optional bool show_thousands_separator = 5;
if (has_show_thousands_separator()) {
total_size += 1 + 1;
}
// optional bool use_accounting_style = 6;
if (has_use_accounting_style()) {
total_size += 1 + 1;
}
// optional uint32 duration_style = 7;
if (has_duration_style()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->duration_style());
}
// optional uint32 base = 8;
if (has_base()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->base());
}
}
if (_has_bits_[8 / 32] & (0xffu << (8 % 32))) {
// optional uint32 base_places = 9;
if (has_base_places()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->base_places());
}
// optional bool base_use_minus_sign = 10;
if (has_base_use_minus_sign()) {
total_size += 1 + 1;
}
// optional uint32 fraction_accuracy = 11;
if (has_fraction_accuracy()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->fraction_accuracy());
}
// optional bool suppress_date_format = 12;
if (has_suppress_date_format()) {
total_size += 1 + 1;
}
// optional bool suppress_time_format = 13;
if (has_suppress_time_format()) {
total_size += 1 + 1;
}
// optional string date_time_format = 14;
if (has_date_time_format()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->date_time_format());
}
// optional uint32 duration_unit_largest = 15;
if (has_duration_unit_largest()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->duration_unit_largest());
}
// optional uint32 duration_unit_smallest = 16;
if (has_duration_unit_smallest()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->duration_unit_smallest());
}
}
if (_has_bits_[16 / 32] & (0xffu << (16 % 32))) {
// optional uint32 custom_id = 17;
if (has_custom_id()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->custom_id());
}
// optional string custom_format_string = 18;
if (has_custom_format_string()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->custom_format_string());
}
// optional double scale_factor = 19;
if (has_scale_factor()) {
total_size += 2 + 8;
}
// optional bool requires_fraction_replacement = 20;
if (has_requires_fraction_replacement()) {
total_size += 2 + 1;
}
// optional double control_minimum = 21;
if (has_control_minimum()) {
total_size += 2 + 8;
}
// optional double control_maximum = 22;
if (has_control_maximum()) {
total_size += 2 + 8;
}
// optional double control_increment = 23;
if (has_control_increment()) {
total_size += 2 + 8;
}
// optional uint32 control_format_type = 24;
if (has_control_format_type()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->control_format_type());
}
}
if (_has_bits_[24 / 32] & (0xffu << (24 % 32))) {
// optional uint32 slider_orientation = 25;
if (has_slider_orientation()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->slider_orientation());
}
// optional uint32 slider_position = 26;
if (has_slider_position()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->slider_position());
}
// optional uint32 decimal_width = 27;
if (has_decimal_width()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->decimal_width());
}
// optional uint32 min_integer_width = 28;
if (has_min_integer_width()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->min_integer_width());
}
// optional uint32 num_nonspace_integer_digits = 29;
if (has_num_nonspace_integer_digits()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->num_nonspace_integer_digits());
}
// optional uint32 num_nonspace_decimal_digits = 30;
if (has_num_nonspace_decimal_digits()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->num_nonspace_decimal_digits());
}
// optional uint32 index_from_right_last_integer = 31;
if (has_index_from_right_last_integer()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->index_from_right_last_integer());
}
}
if (_has_bits_[32 / 32] & (0xffu << (32 % 32))) {
// optional .TSP.IndexSet inters_str_insertion_indexes = 33;
if (has_inters_str_insertion_indexes()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->inters_str_insertion_indexes());
}
// optional uint32 num_hash_decimal_digits = 34;
if (has_num_hash_decimal_digits()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->num_hash_decimal_digits());
}
// optional uint32 total_num_decimal_digits = 35;
if (has_total_num_decimal_digits()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->total_num_decimal_digits());
}
// optional bool is_complex = 36;
if (has_is_complex()) {
total_size += 2 + 1;
}
// optional bool contains_integer_token = 37;
if (has_contains_integer_token()) {
total_size += 2 + 1;
}
// optional uint32 multiple_choice_list_initial_value = 38;
if (has_multiple_choice_list_initial_value()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->multiple_choice_list_initial_value());
}
// optional uint32 multiple_choice_list_id = 39;
if (has_multiple_choice_list_id()) {
total_size += 2 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->multiple_choice_list_id());
}
// optional bool use_automatic_duration_units = 40;
if (has_use_automatic_duration_units()) {
total_size += 2 + 1;
}
}
// repeated string interstitial_strings = 32;
total_size += 2 * this->interstitial_strings_size();
for (int i = 0; i < this->interstitial_strings_size(); i++) {
total_size += ::google::protobuf::internal::WireFormatLite::StringSize(
this->interstitial_strings(i));
}
total_size += _extensions_.ByteSize();
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void FormatStructArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const FormatStructArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const FormatStructArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void FormatStructArchive::MergeFrom(const FormatStructArchive& from) {
GOOGLE_CHECK_NE(&from, this);
interstitial_strings_.MergeFrom(from.interstitial_strings_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_format_type()) {
set_format_type(from.format_type());
}
if (from.has_decimal_places()) {
set_decimal_places(from.decimal_places());
}
if (from.has_currency_code()) {
set_currency_code(from.currency_code());
}
if (from.has_negative_style()) {
set_negative_style(from.negative_style());
}
if (from.has_show_thousands_separator()) {
set_show_thousands_separator(from.show_thousands_separator());
}
if (from.has_use_accounting_style()) {
set_use_accounting_style(from.use_accounting_style());
}
if (from.has_duration_style()) {
set_duration_style(from.duration_style());
}
if (from.has_base()) {
set_base(from.base());
}
}
if (from._has_bits_[8 / 32] & (0xffu << (8 % 32))) {
if (from.has_base_places()) {
set_base_places(from.base_places());
}
if (from.has_base_use_minus_sign()) {
set_base_use_minus_sign(from.base_use_minus_sign());
}
if (from.has_fraction_accuracy()) {
set_fraction_accuracy(from.fraction_accuracy());
}
if (from.has_suppress_date_format()) {
set_suppress_date_format(from.suppress_date_format());
}
if (from.has_suppress_time_format()) {
set_suppress_time_format(from.suppress_time_format());
}
if (from.has_date_time_format()) {
set_date_time_format(from.date_time_format());
}
if (from.has_duration_unit_largest()) {
set_duration_unit_largest(from.duration_unit_largest());
}
if (from.has_duration_unit_smallest()) {
set_duration_unit_smallest(from.duration_unit_smallest());
}
}
if (from._has_bits_[16 / 32] & (0xffu << (16 % 32))) {
if (from.has_custom_id()) {
set_custom_id(from.custom_id());
}
if (from.has_custom_format_string()) {
set_custom_format_string(from.custom_format_string());
}
if (from.has_scale_factor()) {
set_scale_factor(from.scale_factor());
}
if (from.has_requires_fraction_replacement()) {
set_requires_fraction_replacement(from.requires_fraction_replacement());
}
if (from.has_control_minimum()) {
set_control_minimum(from.control_minimum());
}
if (from.has_control_maximum()) {
set_control_maximum(from.control_maximum());
}
if (from.has_control_increment()) {
set_control_increment(from.control_increment());
}
if (from.has_control_format_type()) {
set_control_format_type(from.control_format_type());
}
}
if (from._has_bits_[24 / 32] & (0xffu << (24 % 32))) {
if (from.has_slider_orientation()) {
set_slider_orientation(from.slider_orientation());
}
if (from.has_slider_position()) {
set_slider_position(from.slider_position());
}
if (from.has_decimal_width()) {
set_decimal_width(from.decimal_width());
}
if (from.has_min_integer_width()) {
set_min_integer_width(from.min_integer_width());
}
if (from.has_num_nonspace_integer_digits()) {
set_num_nonspace_integer_digits(from.num_nonspace_integer_digits());
}
if (from.has_num_nonspace_decimal_digits()) {
set_num_nonspace_decimal_digits(from.num_nonspace_decimal_digits());
}
if (from.has_index_from_right_last_integer()) {
set_index_from_right_last_integer(from.index_from_right_last_integer());
}
}
if (from._has_bits_[32 / 32] & (0xffu << (32 % 32))) {
if (from.has_inters_str_insertion_indexes()) {
mutable_inters_str_insertion_indexes()->::TSP::IndexSet::MergeFrom(from.inters_str_insertion_indexes());
}
if (from.has_num_hash_decimal_digits()) {
set_num_hash_decimal_digits(from.num_hash_decimal_digits());
}
if (from.has_total_num_decimal_digits()) {
set_total_num_decimal_digits(from.total_num_decimal_digits());
}
if (from.has_is_complex()) {
set_is_complex(from.is_complex());
}
if (from.has_contains_integer_token()) {
set_contains_integer_token(from.contains_integer_token());
}
if (from.has_multiple_choice_list_initial_value()) {
set_multiple_choice_list_initial_value(from.multiple_choice_list_initial_value());
}
if (from.has_multiple_choice_list_id()) {
set_multiple_choice_list_id(from.multiple_choice_list_id());
}
if (from.has_use_automatic_duration_units()) {
set_use_automatic_duration_units(from.use_automatic_duration_units());
}
}
_extensions_.MergeFrom(from._extensions_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void FormatStructArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void FormatStructArchive::CopyFrom(const FormatStructArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool FormatStructArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_inters_str_insertion_indexes()) {
if (!this->inters_str_insertion_indexes().IsInitialized()) return false;
}
if (!_extensions_.IsInitialized()) return false; return true;
}
void FormatStructArchive::Swap(FormatStructArchive* other) {
if (other != this) {
std::swap(format_type_, other->format_type_);
std::swap(decimal_places_, other->decimal_places_);
std::swap(currency_code_, other->currency_code_);
std::swap(negative_style_, other->negative_style_);
std::swap(show_thousands_separator_, other->show_thousands_separator_);
std::swap(use_accounting_style_, other->use_accounting_style_);
std::swap(duration_style_, other->duration_style_);
std::swap(base_, other->base_);
std::swap(base_places_, other->base_places_);
std::swap(base_use_minus_sign_, other->base_use_minus_sign_);
std::swap(fraction_accuracy_, other->fraction_accuracy_);
std::swap(suppress_date_format_, other->suppress_date_format_);
std::swap(suppress_time_format_, other->suppress_time_format_);
std::swap(date_time_format_, other->date_time_format_);
std::swap(duration_unit_largest_, other->duration_unit_largest_);
std::swap(duration_unit_smallest_, other->duration_unit_smallest_);
std::swap(custom_id_, other->custom_id_);
std::swap(custom_format_string_, other->custom_format_string_);
std::swap(scale_factor_, other->scale_factor_);
std::swap(requires_fraction_replacement_, other->requires_fraction_replacement_);
std::swap(control_minimum_, other->control_minimum_);
std::swap(control_maximum_, other->control_maximum_);
std::swap(control_increment_, other->control_increment_);
std::swap(control_format_type_, other->control_format_type_);
std::swap(slider_orientation_, other->slider_orientation_);
std::swap(slider_position_, other->slider_position_);
std::swap(decimal_width_, other->decimal_width_);
std::swap(min_integer_width_, other->min_integer_width_);
std::swap(num_nonspace_integer_digits_, other->num_nonspace_integer_digits_);
std::swap(num_nonspace_decimal_digits_, other->num_nonspace_decimal_digits_);
std::swap(index_from_right_last_integer_, other->index_from_right_last_integer_);
interstitial_strings_.Swap(&other->interstitial_strings_);
std::swap(inters_str_insertion_indexes_, other->inters_str_insertion_indexes_);
std::swap(num_hash_decimal_digits_, other->num_hash_decimal_digits_);
std::swap(total_num_decimal_digits_, other->total_num_decimal_digits_);
std::swap(is_complex_, other->is_complex_);
std::swap(contains_integer_token_, other->contains_integer_token_);
std::swap(multiple_choice_list_initial_value_, other->multiple_choice_list_initial_value_);
std::swap(multiple_choice_list_id_, other->multiple_choice_list_id_);
std::swap(use_automatic_duration_units_, other->use_automatic_duration_units_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
std::swap(_has_bits_[1], other->_has_bits_[1]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
_extensions_.Swap(&other->_extensions_);
}
}
::google::protobuf::Metadata FormatStructArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = FormatStructArchive_descriptor_;
metadata.reflection = FormatStructArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int CustomFormatArchive_Condition::kConditionTypeFieldNumber;
const int CustomFormatArchive_Condition::kConditionValueFieldNumber;
const int CustomFormatArchive_Condition::kConditionFormatFieldNumber;
const int CustomFormatArchive_Condition::kConditionValueDblFieldNumber;
#endif // !_MSC_VER
CustomFormatArchive_Condition::CustomFormatArchive_Condition()
: ::google::protobuf::Message() {
SharedCtor();
}
void CustomFormatArchive_Condition::InitAsDefaultInstance() {
condition_format_ = const_cast< ::TSK::FormatStructArchive*>(&::TSK::FormatStructArchive::default_instance());
}
CustomFormatArchive_Condition::CustomFormatArchive_Condition(const CustomFormatArchive_Condition& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void CustomFormatArchive_Condition::SharedCtor() {
_cached_size_ = 0;
condition_type_ = 0u;
condition_value_ = 0;
condition_format_ = NULL;
condition_value_dbl_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CustomFormatArchive_Condition::~CustomFormatArchive_Condition() {
SharedDtor();
}
void CustomFormatArchive_Condition::SharedDtor() {
if (this != default_instance_) {
delete condition_format_;
}
}
void CustomFormatArchive_Condition::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CustomFormatArchive_Condition::descriptor() {
protobuf_AssignDescriptorsOnce();
return CustomFormatArchive_Condition_descriptor_;
}
const CustomFormatArchive_Condition& CustomFormatArchive_Condition::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
CustomFormatArchive_Condition* CustomFormatArchive_Condition::default_instance_ = NULL;
CustomFormatArchive_Condition* CustomFormatArchive_Condition::New() const {
return new CustomFormatArchive_Condition;
}
void CustomFormatArchive_Condition::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
condition_type_ = 0u;
condition_value_ = 0;
if (has_condition_format()) {
if (condition_format_ != NULL) condition_format_->::TSK::FormatStructArchive::Clear();
}
condition_value_dbl_ = 0;
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CustomFormatArchive_Condition::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required uint32 condition_type = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &condition_type_)));
set_has_condition_type();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(21)) goto parse_condition_value;
break;
}
// optional float condition_value = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) {
parse_condition_value:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>(
input, &condition_value_)));
set_has_condition_value();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_condition_format;
break;
}
// required .TSK.FormatStructArchive condition_format = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_condition_format:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_condition_format()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(33)) goto parse_condition_value_dbl;
break;
}
// optional double condition_value_dbl = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED64) {
parse_condition_value_dbl:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
double, ::google::protobuf::internal::WireFormatLite::TYPE_DOUBLE>(
input, &condition_value_dbl_)));
set_has_condition_value_dbl();
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void CustomFormatArchive_Condition::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required uint32 condition_type = 1;
if (has_condition_type()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(1, this->condition_type(), output);
}
// optional float condition_value = 2;
if (has_condition_value()) {
::google::protobuf::internal::WireFormatLite::WriteFloat(2, this->condition_value(), output);
}
// required .TSK.FormatStructArchive condition_format = 3;
if (has_condition_format()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->condition_format(), output);
}
// optional double condition_value_dbl = 4;
if (has_condition_value_dbl()) {
::google::protobuf::internal::WireFormatLite::WriteDouble(4, this->condition_value_dbl(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* CustomFormatArchive_Condition::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required uint32 condition_type = 1;
if (has_condition_type()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(1, this->condition_type(), target);
}
// optional float condition_value = 2;
if (has_condition_value()) {
target = ::google::protobuf::internal::WireFormatLite::WriteFloatToArray(2, this->condition_value(), target);
}
// required .TSK.FormatStructArchive condition_format = 3;
if (has_condition_format()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->condition_format(), target);
}
// optional double condition_value_dbl = 4;
if (has_condition_value_dbl()) {
target = ::google::protobuf::internal::WireFormatLite::WriteDoubleToArray(4, this->condition_value_dbl(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int CustomFormatArchive_Condition::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required uint32 condition_type = 1;
if (has_condition_type()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->condition_type());
}
// optional float condition_value = 2;
if (has_condition_value()) {
total_size += 1 + 4;
}
// required .TSK.FormatStructArchive condition_format = 3;
if (has_condition_format()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->condition_format());
}
// optional double condition_value_dbl = 4;
if (has_condition_value_dbl()) {
total_size += 1 + 8;
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CustomFormatArchive_Condition::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CustomFormatArchive_Condition* source =
::google::protobuf::internal::dynamic_cast_if_available<const CustomFormatArchive_Condition*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CustomFormatArchive_Condition::MergeFrom(const CustomFormatArchive_Condition& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_condition_type()) {
set_condition_type(from.condition_type());
}
if (from.has_condition_value()) {
set_condition_value(from.condition_value());
}
if (from.has_condition_format()) {
mutable_condition_format()->::TSK::FormatStructArchive::MergeFrom(from.condition_format());
}
if (from.has_condition_value_dbl()) {
set_condition_value_dbl(from.condition_value_dbl());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CustomFormatArchive_Condition::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CustomFormatArchive_Condition::CopyFrom(const CustomFormatArchive_Condition& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CustomFormatArchive_Condition::IsInitialized() const {
if ((_has_bits_[0] & 0x00000005) != 0x00000005) return false;
if (has_condition_format()) {
if (!this->condition_format().IsInitialized()) return false;
}
return true;
}
void CustomFormatArchive_Condition::Swap(CustomFormatArchive_Condition* other) {
if (other != this) {
std::swap(condition_type_, other->condition_type_);
std::swap(condition_value_, other->condition_value_);
std::swap(condition_format_, other->condition_format_);
std::swap(condition_value_dbl_, other->condition_value_dbl_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CustomFormatArchive_Condition::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CustomFormatArchive_Condition_descriptor_;
metadata.reflection = CustomFormatArchive_Condition_reflection_;
return metadata;
}
// -------------------------------------------------------------------
#ifndef _MSC_VER
const int CustomFormatArchive::kNameFieldNumber;
const int CustomFormatArchive::kFormatTypeFieldNumber;
const int CustomFormatArchive::kDefaultFormatFieldNumber;
const int CustomFormatArchive::kConditionsFieldNumber;
#endif // !_MSC_VER
CustomFormatArchive::CustomFormatArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void CustomFormatArchive::InitAsDefaultInstance() {
default_format_ = const_cast< ::TSK::FormatStructArchive*>(&::TSK::FormatStructArchive::default_instance());
}
CustomFormatArchive::CustomFormatArchive(const CustomFormatArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void CustomFormatArchive::SharedCtor() {
_cached_size_ = 0;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
format_type_ = 0u;
default_format_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
CustomFormatArchive::~CustomFormatArchive() {
SharedDtor();
}
void CustomFormatArchive::SharedDtor() {
if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
if (this != default_instance_) {
delete default_format_;
}
}
void CustomFormatArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* CustomFormatArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return CustomFormatArchive_descriptor_;
}
const CustomFormatArchive& CustomFormatArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
CustomFormatArchive* CustomFormatArchive::default_instance_ = NULL;
CustomFormatArchive* CustomFormatArchive::New() const {
return new CustomFormatArchive;
}
void CustomFormatArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_name()) {
if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
}
format_type_ = 0u;
if (has_default_format()) {
if (default_format_ != NULL) default_format_->::TSK::FormatStructArchive::Clear();
}
}
conditions_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool CustomFormatArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required string name = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(16)) goto parse_format_type;
break;
}
// required uint32 format_type = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) {
parse_format_type:
DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive<
::google::protobuf::uint32, ::google::protobuf::internal::WireFormatLite::TYPE_UINT32>(
input, &format_type_)));
set_has_format_type();
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_default_format;
break;
}
// required .TSK.FormatStructArchive default_format = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_default_format:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_default_format()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(34)) goto parse_conditions;
break;
}
// repeated .TSK.CustomFormatArchive.Condition conditions = 4;
case 4: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_conditions:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_conditions()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(34)) goto parse_conditions;
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void CustomFormatArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
1, this->name(), output);
}
// required uint32 format_type = 2;
if (has_format_type()) {
::google::protobuf::internal::WireFormatLite::WriteUInt32(2, this->format_type(), output);
}
// required .TSK.FormatStructArchive default_format = 3;
if (has_default_format()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->default_format(), output);
}
// repeated .TSK.CustomFormatArchive.Condition conditions = 4;
for (int i = 0; i < this->conditions_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
4, this->conditions(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* CustomFormatArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// required uint32 format_type = 2;
if (has_format_type()) {
target = ::google::protobuf::internal::WireFormatLite::WriteUInt32ToArray(2, this->format_type(), target);
}
// required .TSK.FormatStructArchive default_format = 3;
if (has_default_format()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->default_format(), target);
}
// repeated .TSK.CustomFormatArchive.Condition conditions = 4;
for (int i = 0; i < this->conditions_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
4, this->conditions(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int CustomFormatArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// required uint32 format_type = 2;
if (has_format_type()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::UInt32Size(
this->format_type());
}
// required .TSK.FormatStructArchive default_format = 3;
if (has_default_format()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->default_format());
}
}
// repeated .TSK.CustomFormatArchive.Condition conditions = 4;
total_size += 1 * this->conditions_size();
for (int i = 0; i < this->conditions_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->conditions(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void CustomFormatArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const CustomFormatArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const CustomFormatArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void CustomFormatArchive::MergeFrom(const CustomFormatArchive& from) {
GOOGLE_CHECK_NE(&from, this);
conditions_.MergeFrom(from.conditions_);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_name()) {
set_name(from.name());
}
if (from.has_format_type()) {
set_format_type(from.format_type());
}
if (from.has_default_format()) {
mutable_default_format()->::TSK::FormatStructArchive::MergeFrom(from.default_format());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void CustomFormatArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void CustomFormatArchive::CopyFrom(const CustomFormatArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool CustomFormatArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000007) != 0x00000007) return false;
if (has_default_format()) {
if (!this->default_format().IsInitialized()) return false;
}
for (int i = 0; i < conditions_size(); i++) {
if (!this->conditions(i).IsInitialized()) return false;
}
return true;
}
void CustomFormatArchive::Swap(CustomFormatArchive* other) {
if (other != this) {
std::swap(name_, other->name_);
std::swap(format_type_, other->format_type_);
std::swap(default_format_, other->default_format_);
conditions_.Swap(&other->conditions_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata CustomFormatArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = CustomFormatArchive_descriptor_;
metadata.reflection = CustomFormatArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int AnnotationAuthorArchive::kNameFieldNumber;
const int AnnotationAuthorArchive::kColorFieldNumber;
#endif // !_MSC_VER
AnnotationAuthorArchive::AnnotationAuthorArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void AnnotationAuthorArchive::InitAsDefaultInstance() {
color_ = const_cast< ::TSP::Color*>(&::TSP::Color::default_instance());
}
AnnotationAuthorArchive::AnnotationAuthorArchive(const AnnotationAuthorArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void AnnotationAuthorArchive::SharedCtor() {
_cached_size_ = 0;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
color_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
AnnotationAuthorArchive::~AnnotationAuthorArchive() {
SharedDtor();
}
void AnnotationAuthorArchive::SharedDtor() {
if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
if (this != default_instance_) {
delete color_;
}
}
void AnnotationAuthorArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AnnotationAuthorArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return AnnotationAuthorArchive_descriptor_;
}
const AnnotationAuthorArchive& AnnotationAuthorArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
AnnotationAuthorArchive* AnnotationAuthorArchive::default_instance_ = NULL;
AnnotationAuthorArchive* AnnotationAuthorArchive::New() const {
return new AnnotationAuthorArchive;
}
void AnnotationAuthorArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_name()) {
if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
}
if (has_color()) {
if (color_ != NULL) color_->::TSP::Color::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool AnnotationAuthorArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_color;
break;
}
// optional .TSP.Color color = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_color:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_color()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void AnnotationAuthorArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// optional string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
1, this->name(), output);
}
// optional .TSP.Color color = 2;
if (has_color()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->color(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* AnnotationAuthorArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// optional string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional .TSP.Color color = 2;
if (has_color()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->color(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int AnnotationAuthorArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .TSP.Color color = 2;
if (has_color()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->color());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AnnotationAuthorArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const AnnotationAuthorArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const AnnotationAuthorArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void AnnotationAuthorArchive::MergeFrom(const AnnotationAuthorArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_name()) {
set_name(from.name());
}
if (from.has_color()) {
mutable_color()->::TSP::Color::MergeFrom(from.color());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void AnnotationAuthorArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AnnotationAuthorArchive::CopyFrom(const AnnotationAuthorArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool AnnotationAuthorArchive::IsInitialized() const {
if (has_color()) {
if (!this->color().IsInitialized()) return false;
}
return true;
}
void AnnotationAuthorArchive::Swap(AnnotationAuthorArchive* other) {
if (other != this) {
std::swap(name_, other->name_);
std::swap(color_, other->color_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata AnnotationAuthorArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AnnotationAuthorArchive_descriptor_;
metadata.reflection = AnnotationAuthorArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int DeprecatedChangeAuthorArchive::kNameFieldNumber;
const int DeprecatedChangeAuthorArchive::kChangeColorFieldNumber;
#endif // !_MSC_VER
DeprecatedChangeAuthorArchive::DeprecatedChangeAuthorArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void DeprecatedChangeAuthorArchive::InitAsDefaultInstance() {
change_color_ = const_cast< ::TSP::Color*>(&::TSP::Color::default_instance());
}
DeprecatedChangeAuthorArchive::DeprecatedChangeAuthorArchive(const DeprecatedChangeAuthorArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void DeprecatedChangeAuthorArchive::SharedCtor() {
_cached_size_ = 0;
name_ = const_cast< ::std::string*>(&::google::protobuf::internal::kEmptyString);
change_color_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
DeprecatedChangeAuthorArchive::~DeprecatedChangeAuthorArchive() {
SharedDtor();
}
void DeprecatedChangeAuthorArchive::SharedDtor() {
if (name_ != &::google::protobuf::internal::kEmptyString) {
delete name_;
}
if (this != default_instance_) {
delete change_color_;
}
}
void DeprecatedChangeAuthorArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* DeprecatedChangeAuthorArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return DeprecatedChangeAuthorArchive_descriptor_;
}
const DeprecatedChangeAuthorArchive& DeprecatedChangeAuthorArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
DeprecatedChangeAuthorArchive* DeprecatedChangeAuthorArchive::default_instance_ = NULL;
DeprecatedChangeAuthorArchive* DeprecatedChangeAuthorArchive::New() const {
return new DeprecatedChangeAuthorArchive;
}
void DeprecatedChangeAuthorArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_name()) {
if (name_ != &::google::protobuf::internal::kEmptyString) {
name_->clear();
}
}
if (has_change_color()) {
if (change_color_ != NULL) change_color_->::TSP::Color::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool DeprecatedChangeAuthorArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// optional string name = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadString(
input, this->mutable_name()));
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::PARSE);
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_change_color;
break;
}
// optional .TSP.Color change_color = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_change_color:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_change_color()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void DeprecatedChangeAuthorArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// optional string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
::google::protobuf::internal::WireFormatLite::WriteString(
1, this->name(), output);
}
// optional .TSP.Color change_color = 2;
if (has_change_color()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->change_color(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* DeprecatedChangeAuthorArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// optional string name = 1;
if (has_name()) {
::google::protobuf::internal::WireFormat::VerifyUTF8String(
this->name().data(), this->name().length(),
::google::protobuf::internal::WireFormat::SERIALIZE);
target =
::google::protobuf::internal::WireFormatLite::WriteStringToArray(
1, this->name(), target);
}
// optional .TSP.Color change_color = 2;
if (has_change_color()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->change_color(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int DeprecatedChangeAuthorArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// optional string name = 1;
if (has_name()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::StringSize(
this->name());
}
// optional .TSP.Color change_color = 2;
if (has_change_color()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->change_color());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void DeprecatedChangeAuthorArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const DeprecatedChangeAuthorArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const DeprecatedChangeAuthorArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void DeprecatedChangeAuthorArchive::MergeFrom(const DeprecatedChangeAuthorArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_name()) {
set_name(from.name());
}
if (from.has_change_color()) {
mutable_change_color()->::TSP::Color::MergeFrom(from.change_color());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void DeprecatedChangeAuthorArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void DeprecatedChangeAuthorArchive::CopyFrom(const DeprecatedChangeAuthorArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool DeprecatedChangeAuthorArchive::IsInitialized() const {
if (has_change_color()) {
if (!this->change_color().IsInitialized()) return false;
}
return true;
}
void DeprecatedChangeAuthorArchive::Swap(DeprecatedChangeAuthorArchive* other) {
if (other != this) {
std::swap(name_, other->name_);
std::swap(change_color_, other->change_color_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata DeprecatedChangeAuthorArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = DeprecatedChangeAuthorArchive_descriptor_;
metadata.reflection = DeprecatedChangeAuthorArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int AnnotationAuthorStorageArchive::kAnnotationAuthorFieldNumber;
#endif // !_MSC_VER
AnnotationAuthorStorageArchive::AnnotationAuthorStorageArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void AnnotationAuthorStorageArchive::InitAsDefaultInstance() {
}
AnnotationAuthorStorageArchive::AnnotationAuthorStorageArchive(const AnnotationAuthorStorageArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void AnnotationAuthorStorageArchive::SharedCtor() {
_cached_size_ = 0;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
AnnotationAuthorStorageArchive::~AnnotationAuthorStorageArchive() {
SharedDtor();
}
void AnnotationAuthorStorageArchive::SharedDtor() {
if (this != default_instance_) {
}
}
void AnnotationAuthorStorageArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AnnotationAuthorStorageArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return AnnotationAuthorStorageArchive_descriptor_;
}
const AnnotationAuthorStorageArchive& AnnotationAuthorStorageArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
AnnotationAuthorStorageArchive* AnnotationAuthorStorageArchive::default_instance_ = NULL;
AnnotationAuthorStorageArchive* AnnotationAuthorStorageArchive::New() const {
return new AnnotationAuthorStorageArchive;
}
void AnnotationAuthorStorageArchive::Clear() {
annotation_author_.Clear();
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool AnnotationAuthorStorageArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// repeated .TSP.Reference annotation_author = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_annotation_author:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, add_annotation_author()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(10)) goto parse_annotation_author;
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void AnnotationAuthorStorageArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// repeated .TSP.Reference annotation_author = 1;
for (int i = 0; i < this->annotation_author_size(); i++) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->annotation_author(i), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* AnnotationAuthorStorageArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// repeated .TSP.Reference annotation_author = 1;
for (int i = 0; i < this->annotation_author_size(); i++) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->annotation_author(i), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int AnnotationAuthorStorageArchive::ByteSize() const {
int total_size = 0;
// repeated .TSP.Reference annotation_author = 1;
total_size += 1 * this->annotation_author_size();
for (int i = 0; i < this->annotation_author_size(); i++) {
total_size +=
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->annotation_author(i));
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AnnotationAuthorStorageArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const AnnotationAuthorStorageArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const AnnotationAuthorStorageArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void AnnotationAuthorStorageArchive::MergeFrom(const AnnotationAuthorStorageArchive& from) {
GOOGLE_CHECK_NE(&from, this);
annotation_author_.MergeFrom(from.annotation_author_);
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void AnnotationAuthorStorageArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AnnotationAuthorStorageArchive::CopyFrom(const AnnotationAuthorStorageArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool AnnotationAuthorStorageArchive::IsInitialized() const {
for (int i = 0; i < annotation_author_size(); i++) {
if (!this->annotation_author(i).IsInitialized()) return false;
}
return true;
}
void AnnotationAuthorStorageArchive::Swap(AnnotationAuthorStorageArchive* other) {
if (other != this) {
annotation_author_.Swap(&other->annotation_author_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata AnnotationAuthorStorageArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AnnotationAuthorStorageArchive_descriptor_;
metadata.reflection = AnnotationAuthorStorageArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int AddAnnotationAuthorCommandArchive::kSuperFieldNumber;
const int AddAnnotationAuthorCommandArchive::kDocumentRootFieldNumber;
const int AddAnnotationAuthorCommandArchive::kAnnotationAuthorFieldNumber;
#endif // !_MSC_VER
AddAnnotationAuthorCommandArchive::AddAnnotationAuthorCommandArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void AddAnnotationAuthorCommandArchive::InitAsDefaultInstance() {
super_ = const_cast< ::TSK::CommandArchive*>(&::TSK::CommandArchive::default_instance());
document_root_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
annotation_author_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
}
AddAnnotationAuthorCommandArchive::AddAnnotationAuthorCommandArchive(const AddAnnotationAuthorCommandArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void AddAnnotationAuthorCommandArchive::SharedCtor() {
_cached_size_ = 0;
super_ = NULL;
document_root_ = NULL;
annotation_author_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
AddAnnotationAuthorCommandArchive::~AddAnnotationAuthorCommandArchive() {
SharedDtor();
}
void AddAnnotationAuthorCommandArchive::SharedDtor() {
if (this != default_instance_) {
delete super_;
delete document_root_;
delete annotation_author_;
}
}
void AddAnnotationAuthorCommandArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* AddAnnotationAuthorCommandArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return AddAnnotationAuthorCommandArchive_descriptor_;
}
const AddAnnotationAuthorCommandArchive& AddAnnotationAuthorCommandArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
AddAnnotationAuthorCommandArchive* AddAnnotationAuthorCommandArchive::default_instance_ = NULL;
AddAnnotationAuthorCommandArchive* AddAnnotationAuthorCommandArchive::New() const {
return new AddAnnotationAuthorCommandArchive;
}
void AddAnnotationAuthorCommandArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_super()) {
if (super_ != NULL) super_->::TSK::CommandArchive::Clear();
}
if (has_document_root()) {
if (document_root_ != NULL) document_root_->::TSP::Reference::Clear();
}
if (has_annotation_author()) {
if (annotation_author_ != NULL) annotation_author_->::TSP::Reference::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool AddAnnotationAuthorCommandArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .TSK.CommandArchive super = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_super()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_document_root;
break;
}
// optional .TSP.Reference document_root = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_document_root:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_document_root()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_annotation_author;
break;
}
// optional .TSP.Reference annotation_author = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_annotation_author:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_annotation_author()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void AddAnnotationAuthorCommandArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->super(), output);
}
// optional .TSP.Reference document_root = 2;
if (has_document_root()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->document_root(), output);
}
// optional .TSP.Reference annotation_author = 3;
if (has_annotation_author()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->annotation_author(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* AddAnnotationAuthorCommandArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->super(), target);
}
// optional .TSP.Reference document_root = 2;
if (has_document_root()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->document_root(), target);
}
// optional .TSP.Reference annotation_author = 3;
if (has_annotation_author()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->annotation_author(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int AddAnnotationAuthorCommandArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->super());
}
// optional .TSP.Reference document_root = 2;
if (has_document_root()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->document_root());
}
// optional .TSP.Reference annotation_author = 3;
if (has_annotation_author()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->annotation_author());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void AddAnnotationAuthorCommandArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const AddAnnotationAuthorCommandArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const AddAnnotationAuthorCommandArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void AddAnnotationAuthorCommandArchive::MergeFrom(const AddAnnotationAuthorCommandArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_super()) {
mutable_super()->::TSK::CommandArchive::MergeFrom(from.super());
}
if (from.has_document_root()) {
mutable_document_root()->::TSP::Reference::MergeFrom(from.document_root());
}
if (from.has_annotation_author()) {
mutable_annotation_author()->::TSP::Reference::MergeFrom(from.annotation_author());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void AddAnnotationAuthorCommandArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void AddAnnotationAuthorCommandArchive::CopyFrom(const AddAnnotationAuthorCommandArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool AddAnnotationAuthorCommandArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_super()) {
if (!this->super().IsInitialized()) return false;
}
if (has_document_root()) {
if (!this->document_root().IsInitialized()) return false;
}
if (has_annotation_author()) {
if (!this->annotation_author().IsInitialized()) return false;
}
return true;
}
void AddAnnotationAuthorCommandArchive::Swap(AddAnnotationAuthorCommandArchive* other) {
if (other != this) {
std::swap(super_, other->super_);
std::swap(document_root_, other->document_root_);
std::swap(annotation_author_, other->annotation_author_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata AddAnnotationAuthorCommandArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = AddAnnotationAuthorCommandArchive_descriptor_;
metadata.reflection = AddAnnotationAuthorCommandArchive_reflection_;
return metadata;
}
// ===================================================================
#ifndef _MSC_VER
const int SetAnnotationAuthorColorCommandArchive::kSuperFieldNumber;
const int SetAnnotationAuthorColorCommandArchive::kAnnotationAuthorFieldNumber;
const int SetAnnotationAuthorColorCommandArchive::kColorFieldNumber;
#endif // !_MSC_VER
SetAnnotationAuthorColorCommandArchive::SetAnnotationAuthorColorCommandArchive()
: ::google::protobuf::Message() {
SharedCtor();
}
void SetAnnotationAuthorColorCommandArchive::InitAsDefaultInstance() {
super_ = const_cast< ::TSK::CommandArchive*>(&::TSK::CommandArchive::default_instance());
annotation_author_ = const_cast< ::TSP::Reference*>(&::TSP::Reference::default_instance());
color_ = const_cast< ::TSP::Color*>(&::TSP::Color::default_instance());
}
SetAnnotationAuthorColorCommandArchive::SetAnnotationAuthorColorCommandArchive(const SetAnnotationAuthorColorCommandArchive& from)
: ::google::protobuf::Message() {
SharedCtor();
MergeFrom(from);
}
void SetAnnotationAuthorColorCommandArchive::SharedCtor() {
_cached_size_ = 0;
super_ = NULL;
annotation_author_ = NULL;
color_ = NULL;
::memset(_has_bits_, 0, sizeof(_has_bits_));
}
SetAnnotationAuthorColorCommandArchive::~SetAnnotationAuthorColorCommandArchive() {
SharedDtor();
}
void SetAnnotationAuthorColorCommandArchive::SharedDtor() {
if (this != default_instance_) {
delete super_;
delete annotation_author_;
delete color_;
}
}
void SetAnnotationAuthorColorCommandArchive::SetCachedSize(int size) const {
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
}
const ::google::protobuf::Descriptor* SetAnnotationAuthorColorCommandArchive::descriptor() {
protobuf_AssignDescriptorsOnce();
return SetAnnotationAuthorColorCommandArchive_descriptor_;
}
const SetAnnotationAuthorColorCommandArchive& SetAnnotationAuthorColorCommandArchive::default_instance() {
if (default_instance_ == NULL) protobuf_AddDesc_TSKArchives_2eproto();
return *default_instance_;
}
SetAnnotationAuthorColorCommandArchive* SetAnnotationAuthorColorCommandArchive::default_instance_ = NULL;
SetAnnotationAuthorColorCommandArchive* SetAnnotationAuthorColorCommandArchive::New() const {
return new SetAnnotationAuthorColorCommandArchive;
}
void SetAnnotationAuthorColorCommandArchive::Clear() {
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (has_super()) {
if (super_ != NULL) super_->::TSK::CommandArchive::Clear();
}
if (has_annotation_author()) {
if (annotation_author_ != NULL) annotation_author_->::TSP::Reference::Clear();
}
if (has_color()) {
if (color_ != NULL) color_->::TSP::Color::Clear();
}
}
::memset(_has_bits_, 0, sizeof(_has_bits_));
mutable_unknown_fields()->Clear();
}
bool SetAnnotationAuthorColorCommandArchive::MergePartialFromCodedStream(
::google::protobuf::io::CodedInputStream* input) {
#define DO_(EXPRESSION) if (!(EXPRESSION)) return false
::google::protobuf::uint32 tag;
while ((tag = input->ReadTag()) != 0) {
switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) {
// required .TSK.CommandArchive super = 1;
case 1: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_super()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(18)) goto parse_annotation_author;
break;
}
// optional .TSP.Reference annotation_author = 2;
case 2: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_annotation_author:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_annotation_author()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectTag(26)) goto parse_color;
break;
}
// optional .TSP.Color color = 3;
case 3: {
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) {
parse_color:
DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual(
input, mutable_color()));
} else {
goto handle_uninterpreted;
}
if (input->ExpectAtEnd()) return true;
break;
}
default: {
handle_uninterpreted:
if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) ==
::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) {
return true;
}
DO_(::google::protobuf::internal::WireFormat::SkipField(
input, tag, mutable_unknown_fields()));
break;
}
}
}
return true;
#undef DO_
}
void SetAnnotationAuthorColorCommandArchive::SerializeWithCachedSizes(
::google::protobuf::io::CodedOutputStream* output) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
1, this->super(), output);
}
// optional .TSP.Reference annotation_author = 2;
if (has_annotation_author()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
2, this->annotation_author(), output);
}
// optional .TSP.Color color = 3;
if (has_color()) {
::google::protobuf::internal::WireFormatLite::WriteMessageMaybeToArray(
3, this->color(), output);
}
if (!unknown_fields().empty()) {
::google::protobuf::internal::WireFormat::SerializeUnknownFields(
unknown_fields(), output);
}
}
::google::protobuf::uint8* SetAnnotationAuthorColorCommandArchive::SerializeWithCachedSizesToArray(
::google::protobuf::uint8* target) const {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
1, this->super(), target);
}
// optional .TSP.Reference annotation_author = 2;
if (has_annotation_author()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
2, this->annotation_author(), target);
}
// optional .TSP.Color color = 3;
if (has_color()) {
target = ::google::protobuf::internal::WireFormatLite::
WriteMessageNoVirtualToArray(
3, this->color(), target);
}
if (!unknown_fields().empty()) {
target = ::google::protobuf::internal::WireFormat::SerializeUnknownFieldsToArray(
unknown_fields(), target);
}
return target;
}
int SetAnnotationAuthorColorCommandArchive::ByteSize() const {
int total_size = 0;
if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) {
// required .TSK.CommandArchive super = 1;
if (has_super()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->super());
}
// optional .TSP.Reference annotation_author = 2;
if (has_annotation_author()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->annotation_author());
}
// optional .TSP.Color color = 3;
if (has_color()) {
total_size += 1 +
::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual(
this->color());
}
}
if (!unknown_fields().empty()) {
total_size +=
::google::protobuf::internal::WireFormat::ComputeUnknownFieldsSize(
unknown_fields());
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN();
_cached_size_ = total_size;
GOOGLE_SAFE_CONCURRENT_WRITES_END();
return total_size;
}
void SetAnnotationAuthorColorCommandArchive::MergeFrom(const ::google::protobuf::Message& from) {
GOOGLE_CHECK_NE(&from, this);
const SetAnnotationAuthorColorCommandArchive* source =
::google::protobuf::internal::dynamic_cast_if_available<const SetAnnotationAuthorColorCommandArchive*>(
&from);
if (source == NULL) {
::google::protobuf::internal::ReflectionOps::Merge(from, this);
} else {
MergeFrom(*source);
}
}
void SetAnnotationAuthorColorCommandArchive::MergeFrom(const SetAnnotationAuthorColorCommandArchive& from) {
GOOGLE_CHECK_NE(&from, this);
if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) {
if (from.has_super()) {
mutable_super()->::TSK::CommandArchive::MergeFrom(from.super());
}
if (from.has_annotation_author()) {
mutable_annotation_author()->::TSP::Reference::MergeFrom(from.annotation_author());
}
if (from.has_color()) {
mutable_color()->::TSP::Color::MergeFrom(from.color());
}
}
mutable_unknown_fields()->MergeFrom(from.unknown_fields());
}
void SetAnnotationAuthorColorCommandArchive::CopyFrom(const ::google::protobuf::Message& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
void SetAnnotationAuthorColorCommandArchive::CopyFrom(const SetAnnotationAuthorColorCommandArchive& from) {
if (&from == this) return;
Clear();
MergeFrom(from);
}
bool SetAnnotationAuthorColorCommandArchive::IsInitialized() const {
if ((_has_bits_[0] & 0x00000001) != 0x00000001) return false;
if (has_super()) {
if (!this->super().IsInitialized()) return false;
}
if (has_annotation_author()) {
if (!this->annotation_author().IsInitialized()) return false;
}
if (has_color()) {
if (!this->color().IsInitialized()) return false;
}
return true;
}
void SetAnnotationAuthorColorCommandArchive::Swap(SetAnnotationAuthorColorCommandArchive* other) {
if (other != this) {
std::swap(super_, other->super_);
std::swap(annotation_author_, other->annotation_author_);
std::swap(color_, other->color_);
std::swap(_has_bits_[0], other->_has_bits_[0]);
_unknown_fields_.Swap(&other->_unknown_fields_);
std::swap(_cached_size_, other->_cached_size_);
}
}
::google::protobuf::Metadata SetAnnotationAuthorColorCommandArchive::GetMetadata() const {
protobuf_AssignDescriptorsOnce();
::google::protobuf::Metadata metadata;
metadata.descriptor = SetAnnotationAuthorColorCommandArchive_descriptor_;
metadata.reflection = SetAnnotationAuthorColorCommandArchive_reflection_;
return metadata;
}
// @@protoc_insertion_point(namespace_scope)
} // namespace TSK
// @@protoc_insertion_point(global_scope)
| 36.709969 | 148 | 0.701114 | obriensp |
c95c9d295d62bbc0622c60ec9b1c4dd0ff4cb26b | 2,655 | tpp | C++ | core/include/jiminy/core/TelemetryData.tpp | matthieuvigne/jiminy | f893b2254a9e695a4154b941b599536756ea3d8b | [
"MIT"
] | null | null | null | core/include/jiminy/core/TelemetryData.tpp | matthieuvigne/jiminy | f893b2254a9e695a4154b941b599536756ea3d8b | [
"MIT"
] | null | null | null | core/include/jiminy/core/TelemetryData.tpp | matthieuvigne/jiminy | f893b2254a9e695a4154b941b599536756ea3d8b | [
"MIT"
] | null | null | null | ///////////////////////////////////////////////////////////////////////////////
///
/// \brief Manage the data structures of the telemetry.
///
///////////////////////////////////////////////////////////////////////////////
#ifndef JIMINY_TELEMETRY_DATA_TPP
#define JIMINY_TELEMETRY_DATA_TPP
#include <iostream>
#include <string>
namespace jiminy
{
template <typename T>
result_t TelemetryData::internalRegisterVariable(struct memHeader * header,
std::string const & variableName,
T * & positionInBufferOut)
{
char_t * const memAddress = reinterpret_cast<char_t*>(header);
// Check in local cache before.
auto entry = entriesMap_.find(variableName);
if (entry != entriesMap_.end())
{
positionInBufferOut = static_cast<T*>(entry->second);
return result_t::SUCCESS;
}
// Check in shared memory.
int32_t positionInBuffer = findEntry(header, variableName);
if (positionInBuffer != -1)
{
char_t * address = memAddress + header->startDataSection + sizeof(T) * static_cast<uint32_t>(positionInBuffer);
entriesMap_[variableName] = static_cast<void*>(address);
positionInBufferOut = static_cast<T*>(entriesMap_[variableName]);
return result_t::SUCCESS;
}
if (!header->isRegisteringAvailable)
{
std::cout << "Error - TelemetryData::updateValue - Entry not found: register it if possible." << std::endl;
return result_t::ERROR_GENERIC;
}
if ((header->nextFreeNameOffset + static_cast<int64_t>(variableName.size()) + 1) >= header->startDataSection)
{
std::cout << "Error - TelemetryData::updateValue - TODO" << std::endl; //TODO: write appropriate error message
return result_t::ERROR_GENERIC;
}
char_t * const namePos = memAddress + header->nextFreeNameOffset; // Compute record address
memcpy(namePos, variableName.data(), variableName.size());
header->nextFreeNameOffset += variableName.size();
header->nextFreeNameOffset += 1U; // Null-terminated.
char_t * const dataPos = memAddress + header->nextFreeDataOffset;
entriesMap_[variableName] = static_cast<void*>(dataPos);
positionInBufferOut = static_cast<T*>(entriesMap_[variableName]);
header->nextFreeDataOffset += sizeof(T);
return result_t::SUCCESS;
}
} // namespace jiminy
#endif // JIMINY_TELEMETRY_DATA_TPP | 39.626866 | 123 | 0.576271 | matthieuvigne |
c95d1f32a126e87c0bd04e977e216963c3f79924 | 21,858 | hpp | C++ | src/localizer/data_loader.hpp | deepguider/RoadGPS | 7db4669a54da98a854886b89b6922fb8c7a60f33 | [
"Apache-2.0",
"BSD-3-Clause"
] | 2 | 2019-05-22T12:47:34.000Z | 2019-05-23T15:43:47.000Z | src/localizer/data_loader.hpp | deepguider/RoadGPS | 7db4669a54da98a854886b89b6922fb8c7a60f33 | [
"Apache-2.0",
"BSD-3-Clause"
] | null | null | null | src/localizer/data_loader.hpp | deepguider/RoadGPS | 7db4669a54da98a854886b89b6922fb8c7a60f33 | [
"Apache-2.0",
"BSD-3-Clause"
] | 1 | 2019-08-09T06:50:46.000Z | 2019-08-09T06:50:46.000Z | #ifndef __DATA_LOADER_HPP__
#define __DATA_LOADER_HPP__
#include "core/basic_type.hpp"
#include "utils/opencx.hpp"
namespace dg
{
/**
* @brief Type definitions of observed data
*/
enum
{
/** GPS data (time, lat, lon) */
DATA_GPS = 0,
/** IMU data (time, w, x, y, z) */
DATA_IMU = 1,
/** POI data */
DATA_POI = 2,
/** VPS data */
DATA_VPS = 3,
/** Intersection classifier data (time, v, confidence) */
DATA_IntersectCls = 4,
/** RoadLR data (time, v, confidence) */
DATA_RoadLR = 5,
/** RoadTheta data */
DATA_RoadTheta = 6,
/** OCR data */
DATA_OCR = 7
};
/**
* @brief DataLoader
*
* This implement interfaces for loading and providing timestamped sensor data
*/
class DataLoader
{
public:
bool load(const std::string& video_file, const std::string& gps_file, const std::string& ahrs_file = "", const std::string& ocr_file = "", const std::string& poi_file = "", const std::string& vps_file = "", const std::string& intersection_file = "", const std::string& roadlr_file = "", const std::string& roadtheta_file = "")
{
clear();
if (!gps_file.empty())
{
const std::string ANDRO_POSTFIX = "AndroSensor.csv";
const std::string postfix = gps_file.substr(gps_file.length() - ANDRO_POSTFIX.length(), ANDRO_POSTFIX.length());
if (postfix.compare(ANDRO_POSTFIX) == 0)
m_gps_data = readAndroGPS(gps_file);
else
m_gps_data = readROSGPSFix(gps_file);
if (m_gps_data.empty()) return false;
}
if (!ahrs_file.empty())
{
m_ahrs_data = readROSAHRS(ahrs_file);
if (m_ahrs_data.empty()) return false;
}
if (!ocr_file.empty())
{
m_ocr_vdata = readOCR(ocr_file, m_ocr_sdata);
if (m_ocr_vdata.empty()) return false;
}
if (!poi_file.empty())
{
m_poi_data = readPOI(poi_file);
if (m_poi_data.empty()) return false;
}
if (!vps_file.empty())
{
m_vps_data = readVPS(vps_file);
if (m_vps_data.empty()) return false;
}
if (!intersection_file.empty())
{
m_intersection_data = readIntersection(intersection_file);
if (m_intersection_data.empty()) return false;
}
if (!roadlr_file.empty())
{
m_roadlr_data = readRoadLR(roadlr_file);
if (m_roadlr_data.empty()) return false;
}
if (!roadtheta_file.empty())
{
m_roadtheta_data = readRoadTheta(roadtheta_file);
if (m_roadtheta_data.empty()) return false;
}
if (!m_ahrs_data.empty()) m_first_data_time = m_ahrs_data.front()[0];
else if (!m_gps_data.empty()) m_first_data_time = m_gps_data.front()[0];
else m_first_data_time = 0;
if (!video_file.empty())
{
if (!m_camera_data.open(video_file)) return false;
m_video_fps = m_camera_data.get(cv::VideoCaptureProperties::CAP_PROP_FPS);
m_total_frames = (int)m_camera_data.get(cv::VideoCaptureProperties::CAP_PROP_FRAME_COUNT);
if (!m_ahrs_data.empty())
{
m_first_data_time = m_ahrs_data.front()[0];
m_video_scale = m_video_fps * (m_ahrs_data.back()[0] - m_first_data_time) / m_total_frames;
}
else if (!m_gps_data.empty())
{
m_first_data_time = m_gps_data.front()[0];
m_video_scale = m_video_fps * (m_gps_data.back()[0] - m_first_data_time) / m_total_frames;
}
else
{
m_video_scale = 1;
}
}
return true;
}
/**
* Get next datum in the order of time squence
* @param[out] type The returned data type
* @param[out] data The returned data
* @param[out] timestamp The timestamp of the returned data
*/
bool getNext(int& type, std::vector<double>& vdata, std::vector<std::string>& sdata, dg::Timestamp& timestamp)
{
double min_time = DBL_MAX;
cx::CSVReader::Double2D* min_data = nullptr;
cx::CSVReader::String2D* min_sdata = nullptr;
size_t* min_index = nullptr;
int min_type = -1;
if (m_gps_index < m_gps_data.size() && m_gps_data[m_gps_index][0] < min_time)
{
min_time = m_gps_data[m_gps_index][0];
min_data = &m_gps_data;
min_index = &m_gps_index;
min_type = DATA_GPS;
}
if (m_ahrs_index < m_ahrs_data.size() && m_ahrs_data[m_ahrs_index][0] < min_time)
{
min_time = m_ahrs_data[m_ahrs_index][0];
min_data = &m_ahrs_data;
min_index = &m_ahrs_index;
min_type = DATA_IMU;
}
if (m_ocr_index < m_ocr_vdata.size() && m_ocr_vdata[m_ocr_index][0] < min_time)
{
min_time = m_ocr_vdata[m_ocr_index][0];
min_data = &m_ocr_vdata;
min_sdata = &m_ocr_sdata;
min_index = &m_ocr_index;
min_type = DATA_OCR;
}
if (m_poi_index < m_poi_data.size() && m_poi_data[m_poi_index][0] < min_time)
{
min_time = m_poi_data[m_poi_index][0];
min_data = &m_poi_data;
min_index = &m_poi_index;
min_type = DATA_POI;
}
if (m_vps_index < m_vps_data.size() && m_vps_data[m_vps_index][0] < min_time)
{
min_time = m_vps_data[m_vps_index][0];
min_data = &m_vps_data;
min_index = &m_vps_index;
min_type = DATA_VPS;
}
if (m_intersection_index < m_intersection_data.size() && m_intersection_data[m_intersection_index][0] < min_time)
{
min_time = m_intersection_data[m_intersection_index][0];
min_data = &m_intersection_data;
min_index = &m_intersection_index;
min_type = DATA_IntersectCls;
}
if (m_roadlr_index < m_roadlr_data.size() && m_roadlr_data[m_roadlr_index][0] < min_time)
{
min_time = m_roadlr_data[m_roadlr_index][0];
min_data = &m_roadlr_data;
min_index = &m_roadlr_index;
min_type = DATA_RoadLR;
}
if (m_roadtheta_index < m_roadtheta_data.size() && m_roadtheta_data[m_roadtheta_index][0] < min_time)
{
min_time = m_roadtheta_data[m_roadtheta_index][0];
min_data = &m_roadtheta_data;
min_index = &m_roadtheta_index;
min_type = DATA_RoadTheta;
}
if (min_data)
{
if (min_sdata) sdata = (*min_sdata)[*min_index];
vdata = (*min_data)[*min_index];
type = min_type;
timestamp = min_time;
(*min_index)++;
return true;
}
return false;
}
/**
* Get next datum as long as its timestamp doesn't exceed a given reference time.
* @param[in] ref_time A givan reference time
* @param[out] type The returned data type
* @param[out] data The returned data
* @param[out] timestamp The timestamp of the returned data
*/
bool getNextUntil(dg::Timestamp ref_time, int& type, std::vector<double>& vdata, std::vector<std::string>& sdata, dg::Timestamp& timestamp)
{
double min_time = ref_time;
cx::CSVReader::Double2D* min_data = nullptr;
cx::CSVReader::String2D* min_sdata = nullptr;
size_t* min_index = nullptr;
int min_type = -1;
if (m_gps_index < m_gps_data.size() && m_gps_data[m_gps_index][0] <= min_time)
{
min_time = m_gps_data[m_gps_index][0];
min_data = &m_gps_data;
min_index = &m_gps_index;
min_type = DATA_GPS;
}
if (m_ahrs_index < m_ahrs_data.size() && m_ahrs_data[m_ahrs_index][0] <= min_time)
{
min_time = m_ahrs_data[m_ahrs_index][0];
min_data = &m_ahrs_data;
min_index = &m_ahrs_index;
min_type = DATA_IMU;
}
if (m_ocr_index < m_ocr_vdata.size() && m_ocr_vdata[m_ocr_index][0] <= min_time)
{
min_time = m_ocr_vdata[m_ocr_index][0];
min_data = &m_ocr_vdata;
min_sdata = &m_ocr_sdata;
min_index = &m_ocr_index;
min_type = DATA_OCR;
}
if (m_poi_index < m_poi_data.size() && m_poi_data[m_poi_index][0] <= min_time)
{
min_time = m_poi_data[m_poi_index][0];
min_data = &m_poi_data;
min_index = &m_poi_index;
min_type = DATA_POI;
}
if (m_vps_index < m_vps_data.size() && m_vps_data[m_vps_index][0] <= min_time)
{
min_time = m_vps_data[m_vps_index][0];
min_data = &m_vps_data;
min_index = &m_vps_index;
min_type = DATA_VPS;
}
if (m_intersection_index < m_intersection_data.size() && m_intersection_data[m_intersection_index][0] <= min_time)
{
min_time = m_intersection_data[m_intersection_index][0];
min_data = &m_intersection_data;
min_index = &m_intersection_index;
min_type = DATA_IntersectCls;
}
if (m_roadlr_index < m_roadlr_data.size() && m_roadlr_data[m_roadlr_index][0] <= min_time)
{
min_time = m_roadlr_data[m_roadlr_index][0];
min_data = &m_roadlr_data;
min_index = &m_roadlr_index;
min_type = DATA_RoadLR;
}
if (m_roadtheta_index < m_roadtheta_data.size() && m_roadtheta_data[m_roadtheta_index][0] <= min_time)
{
min_time = m_roadtheta_data[m_roadtheta_index][0];
min_data = &m_roadtheta_data;
min_index = &m_roadtheta_index;
min_type = DATA_RoadTheta;
}
if (min_data)
{
if (min_sdata) sdata = (*min_sdata)[*min_index];
vdata = (*min_data)[*min_index];
type = min_type;
timestamp = min_time;
(*min_index)++;
return true;
}
return false;
}
/**
* Get image frame that is closest to a given timestamp
* @param time The input timestamp
*/
cv::Mat getFrame(const Timestamp time)
{
cv::Mat frame;
if (m_camera_data.isOpened())
{
int frame_i = (int)((time - m_first_data_time) * m_video_fps / m_video_scale + 0.5);
m_camera_data.set(cv::VideoCaptureProperties::CAP_PROP_POS_FRAMES, frame_i);
m_camera_data >> frame;
}
return frame;
}
/**
* Get image frame that is closest to a given timestamp
* @param time The input timestamp
* @param fnumber The frame number of the returned image frame
*/
cv::Mat getFrame(const Timestamp time, int& fnumber)
{
cv::Mat frame;
if (m_camera_data.isOpened())
{
int frame_i = (int)((time - m_first_data_time) * m_video_fps / m_video_scale + 0.5);
m_camera_data.set(cv::VideoCaptureProperties::CAP_PROP_POS_FRAMES, frame_i);
m_camera_data >> frame;
fnumber = frame_i;
}
return frame;
}
/**
* Get a next image frame from the camera data
* @param[out] time The timestamp of the returned image frame
* @param fnumber The frame number of the returned image frame
*/
cv::Mat getNextFrame(Timestamp& time, int& fnumber)
{
cv::Mat frame;
if (m_camera_data.isOpened() && m_frame_index < m_total_frames)
{
m_camera_data.set(cv::VideoCaptureProperties::CAP_PROP_POS_FRAMES, m_frame_index);
m_camera_data >> frame;
time = m_frame_index * m_video_scale / m_video_fps + m_first_data_time;
fnumber = m_frame_index;
m_frame_index++;
}
return frame;
}
/**
* Get a next image frame from the camera data
* @param[out] time The timestamp of the returned image frame
*/
cv::Mat getNextFrame(Timestamp& time)
{
cv::Mat frame;
if (m_camera_data.isOpened() && m_frame_index < m_total_frames)
{
m_camera_data.set(cv::VideoCaptureProperties::CAP_PROP_POS_FRAMES, m_frame_index);
m_camera_data >> frame;
time = m_frame_index * m_video_scale / m_video_fps + m_first_data_time;
m_frame_index++;
}
return frame;
}
/**
* Change the start time of data
* @param skip_time The amount of time to skip from the begining (Unit: [sec])
*/
void setStartSkipTime(double skip_time)
{
if (m_first_data_time < 0) return; // there is no loaded data
m_gps_index = 0;
m_ahrs_index = 0;
m_intersection_index = 0;
m_vps_index = 0;
m_roadlr_index = 0;
m_ocr_index = 0;
m_poi_index = 0;
m_roadtheta_index = 0;
m_frame_index = 0;
if (skip_time <= 0) return;
double start_time = m_first_data_time + skip_time;
if (!m_gps_data.empty())
{
while (m_gps_index<m_gps_data.size() && m_gps_data[m_gps_index][0] < start_time) m_gps_index++;
}
if (!m_ahrs_data.empty())
{
while (m_ahrs_index < m_ahrs_data.size() && m_ahrs_data[m_ahrs_index][0] < start_time) m_ahrs_index++;
}
if (!m_ocr_vdata.empty())
{
while (m_ocr_index < m_ocr_vdata.size() && m_ocr_vdata[m_ocr_index][0] < start_time) m_ocr_index++;
}
if (!m_poi_data.empty())
{
while (m_poi_index < m_poi_data.size() && m_poi_data[m_poi_index][0] < start_time) m_poi_index++;
}
if (!m_vps_data.empty())
{
while (m_vps_index < m_vps_data.size() && m_vps_data[m_vps_index][0] < start_time) m_vps_index++;
}
if (!m_intersection_data.empty())
{
while (m_intersection_index < m_intersection_data.size() && m_intersection_data[m_intersection_index][0] < start_time) m_intersection_index++;
}
if (!m_roadlr_data.empty())
{
while (m_roadlr_index < m_roadlr_data.size() && m_roadlr_data[m_roadlr_index][0] < start_time) m_roadlr_index++;
}
if (!m_roadtheta_data.empty())
{
while (m_roadtheta_index < m_roadtheta_data.size() && m_roadtheta_data[m_roadtheta_index][0] < start_time) m_roadtheta_index++;
}
if (m_camera_data.isOpened())
{
m_frame_index = (int)((start_time - m_first_data_time) * m_video_fps / m_video_scale + 0.5);
}
}
double getStartTime() const { return m_first_data_time; }
bool empty() const
{
return !m_camera_data.isOpened() && m_gps_data.empty() && m_ahrs_data.empty() && m_ocr_sdata.empty() && m_ocr_vdata.empty() && m_poi_data.empty() && m_vps_data.empty() && m_intersection_data.empty() && m_roadlr_data.empty() && m_roadtheta_data.empty();
}
protected:
void clear()
{
m_camera_data.release();
m_gps_data.clear();
m_ahrs_data.clear();
m_ocr_vdata.clear();
m_ocr_sdata.clear();
m_poi_data.clear();
m_vps_data.clear();
m_intersection_data.clear();
m_roadlr_data.clear();
m_roadtheta_data.clear();
m_gps_index = 0;
m_ahrs_index = 0;
m_ocr_index = 0;
m_poi_index = 0;
m_vps_index = 0;
m_intersection_index = 0;
m_roadlr_index = 0;
m_roadtheta_index = 0;
m_video_scale = 1;
m_video_fps = -1;
m_first_data_time = -1;
m_total_frames = 0;
m_frame_index = 0;
}
cx::CSVReader::Double2D readROSGPSFix(const std::string& gps_file)
{
cx::CSVReader::Double2D data;
cx::CSVReader csv;
if (csv.open(gps_file))
{
cx::CSVReader::Double2D raw_data = csv.extDouble2D(1, { 2, 3, 5, 7, 8 }); // Skip the header
if (!raw_data.empty())
{
for (auto row = raw_data.begin(); row != raw_data.end(); row++)
{
double status = row->at(2);
if (status < 0) continue; // skip nan data
double timestamp = row->at(0) + 1e-9 * row->at(1);
dg::LatLon ll(row->at(3), row->at(4));
std::vector<double> datum = { timestamp, ll.lat, ll.lon };
data.push_back(datum);
}
}
}
return data;
}
cx::CSVReader::Double2D readAndroGPS(const std::string& gps_file)
{
cx::CSVReader::Double2D data;
cx::CSVReader csv;
if (csv.open(gps_file, ';'))
{
cx::CSVReader::Double2D raw_data = csv.extDouble2D(2, { 31, 22, 23, 28 }); // Skip the header
if (!raw_data.empty())
{
for (auto row = raw_data.begin(); row != raw_data.end(); row++)
{
double timestamp = 1e-3 * row->at(0);
dg::LatLon ll(row->at(1), row->at(2));
double accuracy = row->at(3);
std::vector<double> datum = { timestamp, ll.lat, ll.lon, accuracy };
data.push_back(datum);
}
}
}
return data;
}
cx::CSVReader::Double2D readROSAHRS(const std::string& ahrs_file)
{
cx::CSVReader::Double2D data;
cx::CSVReader csv;
if (csv.open(ahrs_file))
{
// time,seq,secs,nsecs,frame_id,orientation.x,orientation.y,orientation.z,.orientation.w
cx::CSVReader::Double2D raw_data = csv.extDouble2D(1, { 2, 3, 5, 6, 7, 8 }); // Skip the header
if (!raw_data.empty())
{
for (auto row = raw_data.begin(); row != raw_data.end(); row++)
{
double timestamp = row->at(0) + 1e-9 * row->at(1);
data.push_back({ timestamp, row->at(5), row->at(2), row->at(3), row->at(4) }); // t, quaternion w,x,y,z
}
}
}
return data;
}
cx::CSVReader::Double2D readIntersection(const std::string& clue_file)
{
cx::CSVReader csv;
if (csv.open(clue_file))
{
// framenumber,timestamp,v,confidence
cx::CSVReader::Double2D raw_data = csv.extDouble2D(1, { 1, 2, 3 }); // Skip the header
return raw_data;
}
return cx::CSVReader::Double2D();
}
cx::CSVReader::Double2D readRoadLR(const std::string& clue_file)
{
cx::CSVReader csv;
if (csv.open(clue_file))
{
// fnumber,timestamp,v,confidence,lr_side(string)
cx::CSVReader::Double2D raw_data = csv.extDouble2D(1, { 1, 2, 3 }); // Skip the header
return raw_data;
}
return cx::CSVReader::Double2D();
}
cx::CSVReader::Double2D readRoadTheta(const std::string& clue_file)
{
cx::CSVReader csv;
if (csv.open(clue_file))
{
// fnumber,timestamp,vx,vy,theta,confidence
cx::CSVReader::Double2D raw_data = csv.extDouble2D(1, { 1, 2, 3, 4, 5 }); // Skip the header
return raw_data;
}
return cx::CSVReader::Double2D();
}
cx::CSVReader::Double2D readOCR(const std::string& clue_file, cx::CSVReader::String2D& sdata)
{
cx::CSVReader csv;
sdata.clear();
if (csv.open(clue_file))
{
// fnumber,timestamp,dname,confidence,xmin,ymin,xmax,ymax,lat,lon
sdata = csv.extString2D(1, { 2 }); // Skip the header
cx::CSVReader::Double2D raw_vdata = csv.extDouble2D(1, { 1, 3, 4, 5, 6, 7 }); // Skip the header
return raw_vdata;
}
return cx::CSVReader::Double2D();
}
cx::CSVReader::Double2D readPOI(const std::string& clue_file)
{
cx::CSVReader csv;
if (csv.open(clue_file))
{
// fnumber,timestamp,poi_id,poi_x,poi_y,distance,angle,confidence
cx::CSVReader::Double2D raw_data = csv.extDouble2D(1, { 1, 2, 3, 4, 5, 6, 7 }); // Skip the header
return raw_data;
}
return cx::CSVReader::Double2D();
}
cx::CSVReader::Double2D readVPS(const std::string& clue_file)
{
cx::CSVReader csv;
if (csv.open(clue_file))
{
// fnumber,timestamp,svid,svidx,pred_lat,pred_lon,distance,angle,confidence,curr_lat,curr_lon,utm_err
cx::CSVReader::Double2D raw_data = csv.extDouble2D(1, { 1, 2, 3, 4, 5, 6, 7, 8 }); // Skip the header
return raw_data;
}
return cx::CSVReader::Double2D();
}
cv::VideoCapture m_camera_data;
cx::CSVReader::Double2D m_gps_data;
cx::CSVReader::Double2D m_ahrs_data;
cx::CSVReader::String2D m_ocr_sdata;
cx::CSVReader::Double2D m_ocr_vdata;
cx::CSVReader::Double2D m_poi_data;
cx::CSVReader::Double2D m_vps_data;
cx::CSVReader::Double2D m_intersection_data;
cx::CSVReader::Double2D m_roadlr_data;
cx::CSVReader::Double2D m_roadtheta_data;
size_t m_gps_index = 0;
size_t m_ahrs_index = 0;
size_t m_ocr_index = 0;
size_t m_poi_index = 0;
size_t m_vps_index = 0;
size_t m_intersection_index = 0;
size_t m_roadlr_index = 0;
size_t m_roadtheta_index = 0;
double m_first_data_time = -1;
double m_video_scale = 1;
double m_video_fps = -1;
int m_total_frames = 0;
int m_frame_index = 0;
}; // End of 'DataLoader'
} // End of 'dg'
#endif // End of '__DATA_LOADER_HPP__'
| 34.640254 | 330 | 0.566566 | deepguider |
c960bc4204cf3b5412b1a4dfcab2a738dbb8c815 | 3,442 | cpp | C++ | Course_2_Ordered Data Structures/Week_3_Advanced Tree Structures/Week3_Challenge_implementation.cpp | pgautam8601/Accelerated_Computer_Science_Fundamentals_Specialization | 2c11f943ab1f7e41e374f10708cf7b357979d5c3 | [
"MIT"
] | 37 | 2020-01-04T08:27:54.000Z | 2022-03-28T07:37:16.000Z | Course_2_Ordered Data Structures/Week_3_Advanced Tree Structures/Week3_Challenge_implementation.cpp | pgautam8601/Accelerated_Computer_Science_Fundamentals_Specialization | 2c11f943ab1f7e41e374f10708cf7b357979d5c3 | [
"MIT"
] | null | null | null | Course_2_Ordered Data Structures/Week_3_Advanced Tree Structures/Week3_Challenge_implementation.cpp | pgautam8601/Accelerated_Computer_Science_Fundamentals_Specialization | 2c11f943ab1f7e41e374f10708cf7b357979d5c3 | [
"MIT"
] | 25 | 2020-04-29T18:37:01.000Z | 2022-03-20T13:15:34.000Z |
// The height of a node is the number of edges in
// its longest chain of descendants.
// Implement computeHeight to compute the height
// of the subtree rooted at the node n. Note that
// this function does not return a value. You should
// store the calculated height in that node's own
// height member variable. Your function should also
// do the same for EVERY node in the subtree rooted
// at the current node. (This naturally lends itself
// to a recursive solution!)
// Assume that the following includes have already been
// provided. You should not need any other includes
// than these.
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <string>
using namespace std;
// You have also the following class Node already defined.
// You cannot change this class definition, so it is
// shown here in a comment for your reference only:
class Node {
public:
int height; // to be set by computeHeight()
Node *left, *right;
Node() { height = -1; left = right = nullptr; }
~Node() {
delete left;
left = nullptr;
delete right;
right = nullptr;
}
};
void computeHeight(Node *n) {
if( nullptr == n )
{
//std::cout << "null, empty" << std::endl;
return;
}
else
{
//std::cout << "calcing left sub tree" << std::endl;
Node *leftNode = n->left;
computeHeight( leftNode );
//std::cout << "calcing right sub tree" << std::endl;
Node *rightNode = n->right;
computeHeight( rightNode );
if( nullptr == leftNode && nullptr == rightNode )
{
// current node is leave node, height = 0
n->height = 0;
}
else if( nullptr == leftNode && nullptr != rightNode )
{
//current node adds right node's height
n->height = 1 + rightNode->height;
}
else if( nullptr == rightNode && nullptr != leftNode )
{
//current node adds left node's height
n->height = 1 + leftNode->height;
}
else
{
//current node has two sub-tree
//adds the one with longer height
if( leftNode->height >= rightNode->height )
{
n->height = 1 + leftNode->height;
}
else
{
n->height = 1 + rightNode->height;
}
}
return;
}
//end of if( nullptr == n ) ... else ...
}
//end of function computeHeight
// This function prints the tree in a nested linear format.
void printTree(const Node *n) {
if (!n) return;
std::cout << n->height << "(";
printTree(n->left);
std::cout << ")(";
printTree(n->right);
std::cout << ")";
}
// The printTreeVertical function gives you a verbose,
// vertical printout of the tree, where the leftmost nodes
// are displayed highest. This function has already been
// defined in some hidden code.
// It has this function prototype: void printTreeVertical(const Node* n);
// This main() function is for your personal testing with
// the Run button. When you're ready, click Submit to have
// your work tested and graded.
// expected output of main:
/*
3(0()())(2(0()())(1()(0()())))
*/
int main() {
Node *n = new Node();
n->left = new Node();
n->right = new Node();
n->right->left = new Node();
n->right->right = new Node();
n->right->right->right = new Node();
computeHeight(n);
printTree(n);
std::cout << std::endl << std::endl;
//printTreeVertical(n);
// The Node destructor will recursively
// delete its children nodes.
delete n;
n = nullptr;
return 0;
}
| 23.256757 | 73 | 0.626089 | pgautam8601 |
c9616b0871dbbf789c73c33b7865c497f13e351a | 1,199 | cpp | C++ | src/dynarmic/frontend/A32/translate/impl/a32_exception_generating.cpp | liushuyu/dynarmic | 40afbe19279820e59382b7460643c62398ba0fb8 | [
"0BSD"
] | 77 | 2021-09-03T09:40:01.000Z | 2022-03-30T05:18:36.000Z | src/dynarmic/frontend/A32/translate/impl/a32_exception_generating.cpp | xerpi/dynarmic | bcfe377aaa5138af740e90af5be7a7dff7b62a52 | [
"0BSD"
] | 16 | 2021-09-03T13:13:54.000Z | 2022-03-30T20:07:38.000Z | src/dynarmic/frontend/A32/translate/impl/a32_exception_generating.cpp | xerpi/dynarmic | bcfe377aaa5138af740e90af5be7a7dff7b62a52 | [
"0BSD"
] | 15 | 2021-09-01T11:19:26.000Z | 2022-03-27T09:19:14.000Z | /* This file is part of the dynarmic project.
* Copyright (c) 2016 MerryMage
* SPDX-License-Identifier: 0BSD
*/
#include "dynarmic/frontend/A32/translate/impl/a32_translate_impl.h"
#include "dynarmic/interface/A32/config.h"
namespace Dynarmic::A32 {
// BKPT #<imm16>
bool TranslatorVisitor::arm_BKPT(Cond cond, Imm<12> /*imm12*/, Imm<4> /*imm4*/) {
if (cond != Cond::AL && !options.define_unpredictable_behaviour) {
return UnpredictableInstruction();
}
// UNPREDICTABLE: The instruction executes conditionally.
if (!ArmConditionPassed(cond)) {
return true;
}
return RaiseException(Exception::Breakpoint);
}
// SVC<c> #<imm24>
bool TranslatorVisitor::arm_SVC(Cond cond, Imm<24> imm24) {
if (!ArmConditionPassed(cond)) {
return true;
}
const u32 imm32 = imm24.ZeroExtend();
ir.PushRSB(ir.current_location.AdvancePC(4));
ir.BranchWritePC(ir.Imm32(ir.current_location.PC() + 4));
ir.CallSupervisor(ir.Imm32(imm32));
ir.SetTerm(IR::Term::CheckHalt{IR::Term::PopRSBHint{}});
return false;
}
// UDF<c> #<imm16>
bool TranslatorVisitor::arm_UDF() {
return UndefinedInstruction();
}
} // namespace Dynarmic::A32
| 26.644444 | 81 | 0.681401 | liushuyu |
c961f1b6fca899f8e3f4c2719f1970f98b1a52b7 | 4,399 | cpp | C++ | framework/src/manager/TBoardConfigDAQ.cpp | AudreyFrancisco/MultiLadderOperation | fd6fefd616d73487835c31bc9916bbd8490d1864 | [
"BSD-4-Clause"
] | null | null | null | framework/src/manager/TBoardConfigDAQ.cpp | AudreyFrancisco/MultiLadderOperation | fd6fefd616d73487835c31bc9916bbd8490d1864 | [
"BSD-4-Clause"
] | null | null | null | framework/src/manager/TBoardConfigDAQ.cpp | AudreyFrancisco/MultiLadderOperation | fd6fefd616d73487835c31bc9916bbd8490d1864 | [
"BSD-4-Clause"
] | null | null | null | #include "TBoardConfigDAQ.h"
using namespace std;
// default values for config parameters; less important ones are set in the TBoardConfig constructor
//---- ADC module
const int TBoardConfigDAQ::LIMIT_DIGITAL = 300;
const int TBoardConfigDAQ::LIMIT_IO = 50;
const int TBoardConfigDAQ::LIMIT_ANALOGUE = 300;
//---- READOUT module
const bool TBoardConfigDAQ::DATA_SAMPLING_EDGE = true;
const bool TBoardConfigDAQ::DATA_PKTBASED_EN = false;
const bool TBoardConfigDAQ::DATA_DDR_EN = false;
const int TBoardConfigDAQ::DATA_PORT = 2;
const bool TBoardConfigDAQ::HEADER_TYPE = true;
const int TBoardConfigDAQ::BOARD_VERSION = 1;
//---- TRIGGER module
const int TBoardConfigDAQ::TRIGGER_MODE = 2;
const uint32_t TBoardConfigDAQ::STROBE_DELAY = 10;
const bool TBoardConfigDAQ::BUSY_CONFIG = false;
const bool TBoardConfigDAQ::BUSY_OVERRIDE = true;
//---- RESET module
const int TBoardConfigDAQ::AUTOSHTDWN_TIME = 10;
const int TBoardConfigDAQ::CLOCK_ENABLE_TIME = 12;
const int TBoardConfigDAQ::SIGNAL_ENABLE_TIME = 12;
const int TBoardConfigDAQ::DRST_TIME = 13;
const int TBoardConfigDAQ::PULSE_STROBE_DELAY = 10;
const int TBoardConfigDAQ::STROBE_PULSE_SEQ = 2;
//___________________________________________________________________
TBoardConfigDAQ::TBoardConfigDAQ() : TBoardConfig()
{
//---- ADC module
fBoardType = TBoardType::kBOARD_DAQ;
// ADC config reg 0 !! values as found in old TDaqBoard::PowerOn()
fCurrentLimitDigital = LIMIT_DIGITAL;
fCurrentLimitIo = LIMIT_IO;
fAutoShutdownEnable = true;
fLDOEnable = false;
fADCEnable = false;
fADCSelfStop = false;
fDisableTstmpReset = true;
fPktBasedROEnableADC = false;
// ADC config reg 1
fCurrentLimitAnalogue = LIMIT_ANALOGUE;
// ADC config reg 2
fAutoShutOffDelay = 0;
fADCDownSamplingFact = 0;
//---- READOUT module
// Event builder config reg
fMaxDiffTriggers = 1; // TODO: check if any influence
fSamplingEdgeSelect = DATA_SAMPLING_EDGE; // 0: positive edge, 1: negative edge (for pA1 inverted..)
fPktBasedROEnable = DATA_PKTBASED_EN; // 0: disable, 1: enable
fDDREnable = DATA_DDR_EN; // 0: disable, 1: enable
fDataPortSelect = DATA_PORT; // 01: serial port, 10: parallel port
fFPGAEmulationMode = 0; // 00: FPGA is bus master
fHeaderType = HEADER_TYPE;
fBoardVersion = BOARD_VERSION;
//---- TRIGGER module
// Busy configuration register
//uint32_t fBusyDuration = 4;
// Trigger configuration register
fNTriggers = 1; // TODO: feature ever used?
fTriggerMode = TRIGGER_MODE;
fStrobeDuration = 10; // depreciated
fBusyConfig = BUSY_CONFIG;
// Strobe delay register
fStrobeDelay = STROBE_DELAY;
// Busy override register
fBusyOverride = BUSY_OVERRIDE;
//---- CMU module
// CMU config register
fManchesterDisable = true; // 0: enable manchester encoding; 1: disable
fSamplingEdgeSelectCMU = true; // 0: positive edge; 1: negative edge
fInvertCMUBus = false; // 0: bus not inverted; 1: bus inverted
fChipMaster = false; // 0: chip is master; 1: chip is slave
//---- RESET module
// PULSE DRST PRST duration reg
fPRSTDuration = 10; // depreciated
fDRSTDuration = 10; // TODO: should rather be done via opcode?
fPULSEDuration = 10; // depreciated
// Power up sequencer delay reg
fAutoShutdownTime = AUTOSHTDWN_TIME;
fClockEnableTime = CLOCK_ENABLE_TIME;
fSignalEnableTime = SIGNAL_ENABLE_TIME;
fDrstTime = DRST_TIME;
// PULSE STROBE delay sequence reg
fPulseDelay = PULSE_STROBE_DELAY;
fStrobePulseSeq = STROBE_PULSE_SEQ;
// PowerOnReset disable reg
fPORDisable = true; // 0; 0: enable POR; 1: disable
//---- ID module
//---- SOFTRESET module
// Software reset duration register
fSoftResetDuration = 10;
InitParamMap();
}
//___________________________________________________________________
void TBoardConfigDAQ::InitParamMap()
{
TBoardConfig::InitParamMap();
fSettings["BOARDVERSION"] = &fBoardVersion;
}
| 34.912698 | 105 | 0.663333 | AudreyFrancisco |
e920f92bb9bfd1a82b823b0637f22f25a8417780 | 2,286 | cpp | C++ | src/Pannah.cpp | kant/MockbaModular | bd40171f426c00e0fcfae2720a02d4acb4f877a9 | [
"MIT"
] | null | null | null | src/Pannah.cpp | kant/MockbaModular | bd40171f426c00e0fcfae2720a02d4acb4f877a9 | [
"MIT"
] | null | null | null | src/Pannah.cpp | kant/MockbaModular | bd40171f426c00e0fcfae2720a02d4acb4f877a9 | [
"MIT"
] | null | null | null | // Simple stereo panner by Mockba the Borg
#include "plugin.hpp"
#include "MockbaModular.hpp"
struct Pannah : Module {
enum ParamIds {
_KNOB_PARAM,
NUM_PARAMS
};
enum InputIds {
_MOD_INPUT,
_VOLTAGE_INPUT,
NUM_INPUTS
};
enum OutputIds {
_VOLTAGEL_OUTPUT,
_VOLTAGER_OUTPUT,
NUM_OUTPUTS
};
enum LightIds {
NUM_LIGHTS
};
Pannah() {
config(NUM_PARAMS, NUM_INPUTS, NUM_OUTPUTS, NUM_LIGHTS);
configParam(_KNOB_PARAM, 0.f, 1.f, 0.5f, "pan");
}
void process(const ProcessArgs& args) override;
};
void Pannah::process(const ProcessArgs& args) {
float pan = params[_KNOB_PARAM].getValue();
float in;
float outl = 0.f;
float outr = 0.f;
// Iterate over each channel
int channels = max(inputs[_VOLTAGE_INPUT].getChannels(), 1);
for (int c = 0; c < channels; ++c) {
in = inputs[_VOLTAGE_INPUT].getVoltage(c);
if (inputs[_MOD_INPUT].isConnected())
pan = clamp(inputs[_MOD_INPUT].getVoltage(), -5.f, 5.f) / 10.f + .5f;
outl = in * (1.f - pan);
outr = -in * pan;
outputs[_VOLTAGEL_OUTPUT].setVoltage(outl, c);
outputs[_VOLTAGER_OUTPUT].setVoltage(outr, c);
}
outputs[_VOLTAGEL_OUTPUT].setChannels(channels);
outputs[_VOLTAGER_OUTPUT].setChannels(channels);
}
struct PannahWidget : ModuleWidget {
PannahWidget(Pannah* module) {
setModule(module);
setPanel(APP->window->loadSvg(asset::plugin(pluginInstance, BGCOLOR)));
SvgWidget* panel = createWidget<SvgWidget>(Vec(0, 0));
panel->setSvg(APP->window->loadSvg(asset::plugin(pluginInstance, "res/Pannah.svg")));
addChild(panel);
// Screws
addChild(createWidget<_Screw>(Vec(0, 0)));
addChild(createWidget<_Screw>(Vec(box.size.x - RACK_GRID_WIDTH, RACK_GRID_HEIGHT - RACK_GRID_WIDTH)));
// Knobs
addParam(createParamCentered<_Knob>(mm2px(Vec(5.1, 57.0)), module, Pannah::_KNOB_PARAM));
// Inputs
addInput(createInputCentered<_Port>(mm2px(Vec(5.1, 68.0)), module, Pannah::_MOD_INPUT));
addInput(createInputCentered<_Port>(mm2px(Vec(5.1, 79.0)), module, Pannah::_VOLTAGE_INPUT));
// Outputs
addOutput(createOutputCentered<_Port>(mm2px(Vec(5.1, 90.0)), module, Pannah::_VOLTAGEL_OUTPUT));
addOutput(createOutputCentered<_Port>(mm2px(Vec(5.1, 101.0)), module, Pannah::_VOLTAGER_OUTPUT));
}
};
Model* modelPannah = createModel<Pannah, PannahWidget>("Pannah"); | 29.307692 | 104 | 0.712598 | kant |
e92273b438aa4442908b613347623338887019ab | 737 | cc | C++ | net/third_party/quic/core/frames/quic_ietf_blocked_frame.cc | zipated/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | net/third_party/quic/core/frames/quic_ietf_blocked_frame.cc | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | net/third_party/quic/core/frames/quic_ietf_blocked_frame.cc | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | // Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "net/third_party/quic/core/frames/quic_ietf_blocked_frame.h"
namespace net {
QuicIetfBlockedFrame::QuicIetfBlockedFrame() {}
QuicIetfBlockedFrame::QuicIetfBlockedFrame(QuicControlFrameId control_frame_id,
QuicStreamOffset offset)
: QuicControlFrame(control_frame_id), offset(offset) {}
std::ostream& operator<<(std::ostream& os, const QuicIetfBlockedFrame& frame) {
os << "{ control_frame_id: " << frame.control_frame_id
<< ", offset: " << frame.offset << " }\n";
return os;
}
} // namespace net
| 33.5 | 79 | 0.697422 | zipated |
e92295708437fbcded2658bb4649c80893391e51 | 6,798 | cpp | C++ | src/core/audio/pulseChannel.cpp | Amathlog/nes-emulator | e36682959e963827744631c73caa0df7f83d5853 | [
"MIT"
] | null | null | null | src/core/audio/pulseChannel.cpp | Amathlog/nes-emulator | e36682959e963827744631c73caa0df7f83d5853 | [
"MIT"
] | null | null | null | src/core/audio/pulseChannel.cpp | Amathlog/nes-emulator | e36682959e963827744631c73caa0df7f83d5853 | [
"MIT"
] | null | null | null | #include <core/audio/pulseChannel.h>
#include <core/constants.h>
#include <cstdint>
#include <string>
using NesEmulator::PulseChannel;
using NesEmulator::Sweep;
using NesEmulator::PulseRegister;
//////////////////////////////////////////////////////////////
// PULSE REGISTER
//////////////////////////////////////////////////////////////
void PulseRegister::Reset()
{
duty = 0;
enveloppeLoop = 0;
timer = 0;
lengthCounterReload = 0;
}
void PulseRegister::SerializeTo(Utils::IWriteVisitor& visitor) const
{
visitor.WriteValue(duty);
visitor.WriteValue(enveloppeLoop);
visitor.WriteValue(timer);
visitor.WriteValue(lengthCounterReload);
}
void PulseRegister::DeserializeFrom(Utils::IReadVisitor& visitor)
{
visitor.ReadValue(duty);
visitor.ReadValue(enveloppeLoop);
visitor.ReadValue(timer);
visitor.ReadValue(lengthCounterReload);
}
//////////////////////////////////////////////////////////////
// SWEEP
//////////////////////////////////////////////////////////////
void Sweep::Reset()
{
enabled = false;;
down = false;
reload = false;
shift = 0;
timer = 0;
period = 0;
change = 0;
mute = false;;
}
void Sweep::SerializeTo(Utils::IWriteVisitor& visitor) const
{
visitor.WriteValue(enabled);
visitor.WriteValue(down);
visitor.WriteValue(reload);
visitor.WriteValue(shift);
visitor.WriteValue(timer);
visitor.WriteValue(period);
visitor.WriteValue(change);
visitor.WriteValue(mute);
}
void Sweep::DeserializeFrom(Utils::IReadVisitor& visitor)
{
visitor.ReadValue(enabled);
visitor.ReadValue(down);
visitor.ReadValue(reload);
visitor.ReadValue(shift);
visitor.ReadValue(timer);
visitor.ReadValue(period);
visitor.ReadValue(change);
visitor.ReadValue(mute);
}
void Sweep::Track(uint16_t target)
{
// if (enabled)
// {
// change = target >> shift;
// mute = (target < 8) || (target > 0x7FF);
// }
change = target >> shift;
mute = (target < 8) | (target > 0x7FF);
}
void Sweep::Clock(uint16_t& target, bool isChannel1)
{
if (timer == 0 && enabled && shift > 0 && !mute)
{
if (target >= 8 && change < 0x07FF)
{
int16_t temp = down ? -change : change;
if (isChannel1 && down)
temp--;
target += temp;
}
}
if (timer == 0 || reload)
{
timer = period;
reload = false;
}
else
{
timer--;
}
mute = (target < 8) || (target > 0x7FF);
}
//////////////////////////////////////////////////////////////
// PULSE CHANNEL
//////////////////////////////////////////////////////////////
std::string PulseChannel::GetDutyCycleParameterName()
{
return std::string("dutyCyclePulse") + std::to_string(m_number);
}
std::string PulseChannel::GetFrequencyParameterName()
{
return std::string("freqPulse") + std::to_string(m_number);
}
std::string PulseChannel::GetOutputParameterName()
{
return std::string("outputPulse") + std::to_string(m_number);
}
std::string PulseChannel::GetEnveloppeOutputParameterName()
{
return std::string("outputEnvPulse") + std::to_string(m_number);
}
PulseChannel::PulseChannel(Tonic::Synth& synth, int number)
: m_number(number)
, m_frequency(440.0f)
{
Tonic::ControlGenerator controlDutyPulse = synth.addParameter(GetDutyCycleParameterName());
Tonic::ControlGenerator controlFreqPulse = synth.addParameter(GetFrequencyParameterName(), 440.0f);
Tonic::ControlGenerator controlOutputPulse = synth.addParameter(GetOutputParameterName());
Tonic::ControlGenerator controlOutputEnvPulse = synth.addParameter(GetEnveloppeOutputParameterName());
m_wave = controlOutputEnvPulse * controlOutputPulse * Tonic::RectWave().freq(controlFreqPulse).pwm(controlDutyPulse);
}
void PulseChannel::Update(double cpuFrequency, Tonic::Synth& synth)
{
double newEnableValue = m_lengthCounter > 0 ? 1.0 : 0.0;
if (m_sweep.mute || m_register.timer <= 8)
newEnableValue = 0.0;
double newFrequency = m_register.timer > 8 ? (cpuFrequency / (16.0 * (double)(m_register.timer + 1))) : m_frequency;
double newDutyCycle = 0.0;
switch (m_register.duty)
{
case 0:
newDutyCycle = 0.125;
break;
case 1:
newDutyCycle = 0.25;
break;
case 2:
newDutyCycle = 0.5;
break;
case 3:
newDutyCycle = 0.75;
break;
}
// Enveloppe output
if (m_enveloppe.updated)
{
float envOutput = (float)(m_enveloppe.output) / 15.0f;
synth.setParameter(GetEnveloppeOutputParameterName(), envOutput);
m_enveloppe.updated = false;
}
if (newFrequency != m_frequency)
{
m_frequency = newFrequency;
synth.setParameter(GetFrequencyParameterName(), (float)newFrequency);
}
if (newDutyCycle != m_dutyCycle)
{
m_dutyCycle = newDutyCycle;
synth.setParameter(GetDutyCycleParameterName(), (float)newDutyCycle);
}
if (newEnableValue != m_enableValue)
{
m_enableValue = newEnableValue;
synth.setParameter(GetOutputParameterName(), (float)newEnableValue);
}
}
void PulseChannel::SerializeTo(Utils::IWriteVisitor &visitor) const
{
m_register.SerializeTo(visitor);
m_sweep.SerializeTo(visitor);
m_enveloppe.SerializeTo(visitor);
visitor.WriteValue(m_frequency);
visitor.WriteValue(m_dutyCycle);
visitor.WriteValue(m_enableValue);
visitor.WriteValue(m_lengthCounter);
}
void PulseChannel::DeserializeFrom(Utils::IReadVisitor &visitor)
{
m_register.DeserializeFrom(visitor);
m_sweep.DeserializeFrom(visitor);
m_enveloppe.DeserializeFrom(visitor);
visitor.ReadValue(m_frequency);
visitor.ReadValue(m_dutyCycle);
visitor.ReadValue(m_enableValue);
visitor.ReadValue(m_lengthCounter);
}
void PulseChannel::Clock(bool isEnabled)
{
// Update length counter
// Enveloppe loop also count as pulseHalt
bool halt = m_register.enveloppeLoop > 0;
if (!isEnabled)
{
m_lengthCounter = 0;
}
else if(m_lengthCounter > 0 && !halt)
{
m_lengthCounter--;
}
// Update sweep
m_sweep.Clock(m_register.timer, m_number == 1);
}
void PulseChannel::ClockEnveloppe()
{
m_enveloppe.Clock(m_register.enveloppeLoop);
}
void PulseChannel::Track()
{
m_sweep.Track(m_register.timer);
}
void PulseChannel::Reset()
{
m_register.Reset();
m_sweep.Reset();
m_enveloppe.Reset();
m_frequency = 440.0f;
m_dutyCycle = 0.0;
m_enableValue = 0.0;
m_lengthCounter = 0;
}
void PulseChannel::ReloadCounter()
{
m_lengthCounter = Cst::APU_LENGTH_TABLE[m_register.lengthCounterReload];
} | 25.271375 | 121 | 0.62489 | Amathlog |
e922ce532dda6f1f4fac7a3faf31f6add14d9b5b | 8,808 | cpp | C++ | tams_ur5_bartender_image_processing/src/demo_bottle_publisher.cpp | TAMS-Group/tams_ur5_bartender | 36b5eeb97d8e00003c9a8a868431e97a4788d7de | [
"BSD-3-Clause"
] | 4 | 2018-01-23T22:04:25.000Z | 2020-10-25T03:57:16.000Z | tams_ur5_bartender_image_processing/src/demo_bottle_publisher.cpp | TAMS-Group/tams_ur5_bartender | 36b5eeb97d8e00003c9a8a868431e97a4788d7de | [
"BSD-3-Clause"
] | 1 | 2018-04-24T20:14:29.000Z | 2018-04-26T17:34:02.000Z | tams_ur5_bartender_image_processing/src/demo_bottle_publisher.cpp | TAMS-Group/tams_ur5_bartender | 36b5eeb97d8e00003c9a8a868431e97a4788d7de | [
"BSD-3-Clause"
] | 1 | 2018-01-09T13:53:55.000Z | 2018-01-09T13:53:55.000Z | /*
Copyright (c) 2017, Daniel Ahlers, Lars Henning Kayser, Jeremias Hartz, Maham Tanveer, Oke Martensen
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* Neither the name of the <organization> nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <ros/ros.h>
#include <moveit_msgs/CollisionObject.h>
#include <object_recognition_msgs/ObjectType.h>
#include <geometry_msgs/PoseStamped.h>
#include <geometry_msgs/Pose.h>
#include <geometry_msgs/Point.h>
#include <geometry_msgs/Quaternion.h>
#include <std_msgs/Float32.h>
#include <std_msgs/Float32MultiArray.h>
#include <find_object_2d/ObjectsStamped.h>
#include <tf/transform_listener.h>
#include <shape_msgs/SolidPrimitive.h>
#include <XmlRpcValue.h>
#include <XmlRpcException.h>
#include <tams_ur5_bartender_msgs/BarCollisionObjectArray.h>
class Bottle {
public:
Bottle() {
}
Bottle(std::string name, double height_bottle, double radius_bottle, double height_neck, double radius_neck, double height_label, double pos_x, double pos_y) :
name_(name),
height_bottle_(height_bottle),
radius_bottle_(radius_bottle),
height_neck_(height_neck),
radius_neck_(radius_neck),
height_label_(height_label),
pos_x_(pos_x),
pos_y_(pos_y){
}
std::string getName() const {
return name_;
}
double getHeight_bottle() const {
return height_bottle_;
}
double getRadius_bottle() const {
return radius_bottle_;
}
double getHeight_neck() const {
return height_neck_;
}
double getRadius_neck() const {
return radius_neck_;
}
double getHeight_label() const {
return height_label_;
}
double getPos_x() const {
return pos_x_;
}
double getPos_y() const {
return pos_y_;
}
private:
std::string name_;
double height_bottle_;
double radius_bottle_;
double height_neck_;
double radius_neck_;
double height_label_;
double pos_x_;
double pos_y_;
};
class BottleRecognition {
public:
BottleRecognition() : mapFrameId_("/table_top"), objFramePrefix_("object") {
ros::NodeHandle pnh("~");
pnh.param("map_frame_id", mapFrameId_, mapFrameId_);
pnh.param("object_prefix", objFramePrefix_, objFramePrefix_);
ros::NodeHandle nh;
object_pub_ = nh.advertise<tams_ur5_bartender_msgs::BarCollisionObjectArray>("recognizedObjects", 1);
pnh.getParam("bottles", bottles);
try {
for (int32_t i = 0; i < bottles.size(); ++i) {
XmlRpc::XmlRpcValue& b = bottles[i].begin()->second;
Bottle b1(b["name"],
double(b["height_bottle"]),
double(b["radius_bottle"]),
double(b["height_neck"]),
double(b["radius_neck"]),
double(b["height_label"]),
double(b["pos_x"]),
double(b["pos_y"]));
data_bottles[int(b["id"])] = b1;
}
} catch (XmlRpc::XmlRpcException & e) {
ROS_WARN("%s", e.getMessage().c_str());
}
}
void publishDemoObjects() {
tams_ur5_bartender_msgs::BarCollisionObjectArray recObjectArr;
//HEADER BAUEN
recObjectArr.header.stamp = ros::Time::now();
recObjectArr.header.frame_id = mapFrameId_;
for (unsigned int i = 1; i < 3; i += 1) {
moveit_msgs::CollisionObject Object;
object_recognition_msgs::ObjectType Type;
geometry_msgs::PoseStamped PoseStamped_bottle;
geometry_msgs::Pose Pose_bottle, Pose_neck;
geometry_msgs::Point Point_bottle, Point_neck;
geometry_msgs::Quaternion Orient;
shape_msgs::SolidPrimitive cylinder_bottle, cylinder_neck;
//header is the geometric frame of the camera
Object.header = recObjectArr.header;
//set primitives
cylinder_bottle.type = shape_msgs::SolidPrimitive::CYLINDER;
cylinder_neck.type = shape_msgs::SolidPrimitive::CYLINDER;
cylinder_bottle.dimensions.resize(2);
cylinder_neck.dimensions.resize(2);
int bottleID = i;
//Bottle Group id i.e. 1,2,3 -> 0
std::string bottle_name;
double height_bottle, radius_bottle, height_neck, radius_neck, height_label, pos_x, pos_y;
if (data_bottles.find(bottleID) == data_bottles.end()) {
ROS_ERROR("Can't find bottle in database");
bottle_name = "unknown";
height_bottle = 0.19;
radius_bottle = 0.075 / 2;
height_neck = 0.285;
radius_neck = 0.025 / 2;
height_label = 0.095;
} else {
bottle_name = data_bottles[bottleID].getName();
height_bottle = data_bottles[bottleID].getHeight_bottle();
radius_bottle = data_bottles[bottleID].getRadius_bottle();
height_neck = data_bottles[bottleID].getHeight_neck();
radius_neck = data_bottles[bottleID].getRadius_neck();
height_label = data_bottles[bottleID].getHeight_label();
pos_x = data_bottles[bottleID].getPos_x();
pos_y = data_bottles[bottleID].getPos_y();
}
//set type
Type.key = bottle_name;
Object.type = Type;
Object.id = bottle_name;
//generate cylinders
cylinder_bottle.dimensions[shape_msgs::SolidPrimitive::CYLINDER_HEIGHT] = height_bottle;
cylinder_bottle.dimensions[shape_msgs::SolidPrimitive::CYLINDER_RADIUS] = radius_bottle;
cylinder_neck.dimensions[shape_msgs::SolidPrimitive::CYLINDER_HEIGHT] = height_neck;
cylinder_neck.dimensions[shape_msgs::SolidPrimitive::CYLINDER_RADIUS] = radius_neck;
//add cylinders to object
Object.primitives.push_back(cylinder_bottle);
Object.primitives.push_back(cylinder_neck);
//calculate bottle offset
//BOTTLE POSE & ORIENT
Pose_bottle.orientation.w = 1;
Pose_bottle.position.x = pos_x;
Pose_bottle.position.y = pos_y;
Pose_bottle.position.z = height_bottle / 2;
PoseStamped_bottle.pose = Pose_bottle;
//move bottle neck up so it only sticks out ontop of the bottle
Pose_neck.orientation.w = 1;
Point_neck.x = Pose_bottle.position.x;
Point_neck.y = Pose_bottle.position.y;
Point_neck.z = height_bottle + height_neck / 2;
Pose_neck.position = Point_neck;
//add modelpositions to Object
Object.primitive_poses.push_back(Pose_bottle);
Object.primitive_poses.push_back(Pose_neck);
//add object to vector
recObjectArr.objects.push_back(Object);
}
object_pub_.publish(recObjectArr);
}
private:
std::string mapFrameId_;
std::string objFramePrefix_;
ros::Subscriber sub_;
tf::TransformListener tfListener_;
ros::Publisher object_pub_;
XmlRpc::XmlRpcValue bottles;
std::map <int, Bottle> data_bottles;
};
int main(int argc, char **argv) {
ros::init(argc, argv, "recognizedObjectsListener");
BottleRecognition sync;
ros::Rate loop_rate(1);
while (ros::ok()) {
sync.publishDemoObjects();
loop_rate.sleep();
}
}
| 36.547718 | 163 | 0.651567 | TAMS-Group |
e924bdd69f856700621cadaa1efb7e8713947fef | 641 | cpp | C++ | Uva/Egypt.cpp | Sowmik23/All-Codes | 212ef0d940fa84624bb2972a257768a830a709a3 | [
"MIT"
] | 5 | 2021-02-14T17:48:21.000Z | 2022-01-24T14:29:44.000Z | Uva/Egypt.cpp | Sowmik23/All-Codes | 212ef0d940fa84624bb2972a257768a830a709a3 | [
"MIT"
] | null | null | null | Uva/Egypt.cpp | Sowmik23/All-Codes | 212ef0d940fa84624bb2972a257768a830a709a3 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
int median(int x,int y,int z)
{
if((x<=y and x>=z) or (x>=y and x<=z)) return x;
else if((y<=x and y>=z) or (x<=y and y<=z)) return y;
else if((z>=x and z<=y) or (z<=x and z>=y)) return z;
}
int main()
{
int a,b,c,x,y,z;
while(scanf("%d%d%d",&x,&y,&z)==3)
{
if(x==0 and y==0 and z==0) break;
a = max(x,y);
a = max(a,z);
b = min(x,y);
b = min(b,z);
c = median(x,y,z);
//cout<<a<<" "<<b<<" "<<c<<endl;
long long d=a*a;
long long k = c*c;
long long m = b*b;
//cout<<d+k<<" "<<m<<endl;
if(d==k+m) printf("right\n");
else printf("wrong\n");
}
return 0;
}
| 18.852941 | 55 | 0.4961 | Sowmik23 |
e92794daae21721d34adbe55ca34f6ed6a7850e4 | 10,320 | cc | C++ | views/controls/textfield/textfield.cc | Gitman1989/chromium | 2b1cceae1075ef012fb225deec8b4c8bbe4bc897 | [
"BSD-3-Clause"
] | 2 | 2017-09-02T19:08:28.000Z | 2021-11-15T15:15:14.000Z | views/controls/textfield/textfield.cc | Gitman1989/chromium | 2b1cceae1075ef012fb225deec8b4c8bbe4bc897 | [
"BSD-3-Clause"
] | null | null | null | views/controls/textfield/textfield.cc | Gitman1989/chromium | 2b1cceae1075ef012fb225deec8b4c8bbe4bc897 | [
"BSD-3-Clause"
] | 1 | 2020-04-13T05:45:10.000Z | 2020-04-13T05:45:10.000Z | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "views/controls/textfield/textfield.h"
#if defined(OS_LINUX)
#include <gdk/gdkkeysyms.h>
#endif
#include <string>
#include "app/keyboard_codes.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "gfx/insets.h"
#include "views/controls/native/native_view_host.h"
#include "views/controls/textfield/native_textfield_wrapper.h"
#include "views/widget/widget.h"
#if defined(OS_LINUX)
#include "app/keyboard_code_conversion_gtk.h"
#elif defined(OS_WIN)
#include "app/win_util.h"
#include "base/win_util.h"
// TODO(beng): this should be removed when the OS_WIN hack from
// ViewHierarchyChanged is removed.
#include "views/controls/textfield/native_textfield_win.h"
#endif
namespace views {
// static
const char Textfield::kViewClassName[] = "views/Textfield";
/////////////////////////////////////////////////////////////////////////////
// Textfield
Textfield::Textfield()
: native_wrapper_(NULL),
controller_(NULL),
style_(STYLE_DEFAULT),
read_only_(false),
default_width_in_chars_(0),
draw_border_(true),
text_color_(SK_ColorBLACK),
use_default_text_color_(true),
background_color_(SK_ColorWHITE),
use_default_background_color_(true),
num_lines_(1),
initialized_(false),
horizontal_margins_were_set_(false),
vertical_margins_were_set_(false) {
SetFocusable(true);
}
Textfield::Textfield(StyleFlags style)
: native_wrapper_(NULL),
controller_(NULL),
style_(style),
read_only_(false),
default_width_in_chars_(0),
draw_border_(true),
text_color_(SK_ColorBLACK),
use_default_text_color_(true),
background_color_(SK_ColorWHITE),
use_default_background_color_(true),
num_lines_(1),
initialized_(false),
horizontal_margins_were_set_(false),
vertical_margins_were_set_(false) {
SetFocusable(true);
}
Textfield::~Textfield() {
}
void Textfield::SetController(Controller* controller) {
controller_ = controller;
}
Textfield::Controller* Textfield::GetController() const {
return controller_;
}
void Textfield::SetReadOnly(bool read_only) {
read_only_ = read_only;
if (native_wrapper_) {
native_wrapper_->UpdateReadOnly();
native_wrapper_->UpdateTextColor();
native_wrapper_->UpdateBackgroundColor();
}
}
bool Textfield::IsPassword() const {
return style_ & STYLE_PASSWORD;
}
void Textfield::SetPassword(bool password) {
if (password)
style_ = static_cast<StyleFlags>(style_ | STYLE_PASSWORD);
else
style_ = static_cast<StyleFlags>(style_ & ~STYLE_PASSWORD);
if (native_wrapper_)
native_wrapper_->UpdateIsPassword();
}
bool Textfield::IsMultiLine() const {
return !!(style_ & STYLE_MULTILINE);
}
void Textfield::SetText(const string16& text) {
text_ = text;
if (native_wrapper_)
native_wrapper_->UpdateText();
}
void Textfield::AppendText(const string16& text) {
text_ += text;
if (native_wrapper_)
native_wrapper_->AppendText(text);
}
void Textfield::SelectAll() {
if (native_wrapper_)
native_wrapper_->SelectAll();
}
string16 Textfield::GetSelectedText() const {
if (native_wrapper_)
return native_wrapper_->GetSelectedText();
return string16();
}
void Textfield::ClearSelection() const {
if (native_wrapper_)
native_wrapper_->ClearSelection();
}
void Textfield::SetTextColor(SkColor color) {
text_color_ = color;
use_default_text_color_ = false;
if (native_wrapper_)
native_wrapper_->UpdateTextColor();
}
void Textfield::UseDefaultTextColor() {
use_default_text_color_ = true;
if (native_wrapper_)
native_wrapper_->UpdateTextColor();
}
void Textfield::SetBackgroundColor(SkColor color) {
background_color_ = color;
use_default_background_color_ = false;
if (native_wrapper_)
native_wrapper_->UpdateBackgroundColor();
}
void Textfield::UseDefaultBackgroundColor() {
use_default_background_color_ = true;
if (native_wrapper_)
native_wrapper_->UpdateBackgroundColor();
}
void Textfield::SetFont(const gfx::Font& font) {
font_ = font;
if (native_wrapper_)
native_wrapper_->UpdateFont();
PreferredSizeChanged();
}
void Textfield::SetHorizontalMargins(int left, int right) {
margins_.Set(margins_.top(), left, margins_.bottom(), right);
horizontal_margins_were_set_ = true;
if (native_wrapper_)
native_wrapper_->UpdateHorizontalMargins();
PreferredSizeChanged();
}
void Textfield::SetVerticalMargins(int top, int bottom) {
margins_.Set(top, margins_.left(), bottom, margins_.right());
vertical_margins_were_set_ = true;
if (native_wrapper_)
native_wrapper_->UpdateVerticalMargins();
PreferredSizeChanged();
}
void Textfield::SetHeightInLines(int num_lines) {
DCHECK(IsMultiLine());
num_lines_ = num_lines;
PreferredSizeChanged();
}
void Textfield::RemoveBorder() {
if (!draw_border_)
return;
draw_border_ = false;
if (native_wrapper_)
native_wrapper_->UpdateBorder();
}
bool Textfield::GetHorizontalMargins(int* left, int* right) {
if (!horizontal_margins_were_set_)
return false;
*left = margins_.left();
*right = margins_.right();
return true;
}
bool Textfield::GetVerticalMargins(int* top, int* bottom) {
if (!vertical_margins_were_set_)
return false;
*top = margins_.top();
*bottom = margins_.bottom();
return true;
}
void Textfield::UpdateAllProperties() {
if (native_wrapper_) {
native_wrapper_->UpdateText();
native_wrapper_->UpdateTextColor();
native_wrapper_->UpdateBackgroundColor();
native_wrapper_->UpdateReadOnly();
native_wrapper_->UpdateFont();
native_wrapper_->UpdateEnabled();
native_wrapper_->UpdateBorder();
native_wrapper_->UpdateIsPassword();
native_wrapper_->UpdateHorizontalMargins();
native_wrapper_->UpdateVerticalMargins();
}
}
void Textfield::SyncText() {
if (native_wrapper_)
text_ = native_wrapper_->GetText();
}
bool Textfield::IsIMEComposing() const {
return native_wrapper_ && native_wrapper_->IsIMEComposing();
}
////////////////////////////////////////////////////////////////////////////////
// Textfield, View overrides:
void Textfield::Layout() {
if (native_wrapper_) {
native_wrapper_->GetView()->SetBounds(GetLocalBounds(true));
native_wrapper_->GetView()->Layout();
}
}
gfx::Size Textfield::GetPreferredSize() {
gfx::Insets insets;
if (draw_border_ && native_wrapper_)
insets = native_wrapper_->CalculateInsets();
return gfx::Size(font_.GetExpectedTextWidth(default_width_in_chars_) +
insets.width(),
num_lines_ * font_.GetHeight() + insets.height());
}
bool Textfield::IsFocusable() const {
return IsEnabled() && !read_only_;
}
void Textfield::AboutToRequestFocusFromTabTraversal(bool reverse) {
SelectAll();
}
bool Textfield::SkipDefaultKeyEventProcessing(const KeyEvent& e) {
// TODO(hamaji): Figure out which keyboard combinations we need to add here,
// similar to LocationBarView::SkipDefaultKeyEventProcessing.
app::KeyboardCode key = e.GetKeyCode();
if (key == app::VKEY_BACK)
return true; // We'll handle BackSpace ourselves.
#if defined(OS_WIN)
// We don't translate accelerators for ALT + NumPad digit on Windows, they are
// used for entering special characters. We do translate alt-home.
if (e.IsAltDown() && (key != app::VKEY_HOME) &&
win_util::IsNumPadDigit(key, e.IsExtendedKey()))
return true;
#endif
return false;
}
void Textfield::PaintFocusBorder(gfx::Canvas* canvas) {
if (NativeViewHost::kRenderNativeControlFocus)
View::PaintFocusBorder(canvas);
}
AccessibilityTypes::Role Textfield::GetAccessibleRole() {
return AccessibilityTypes::ROLE_TEXT;
}
AccessibilityTypes::State Textfield::GetAccessibleState() {
int state = 0;
if (read_only())
state |= AccessibilityTypes::STATE_READONLY;
if (IsPassword())
state |= AccessibilityTypes::STATE_PROTECTED;
return state;
}
std::wstring Textfield::GetAccessibleValue() {
if (!text_.empty())
return UTF16ToWide(text_);
return std::wstring();
}
void Textfield::SetEnabled(bool enabled) {
View::SetEnabled(enabled);
if (native_wrapper_)
native_wrapper_->UpdateEnabled();
}
void Textfield::Focus() {
if (native_wrapper_) {
// Forward the focus to the wrapper if it exists.
native_wrapper_->SetFocus();
} else {
// If there is no wrapper, cause the RootView to be focused so that we still
// get keyboard messages.
View::Focus();
}
}
void Textfield::ViewHierarchyChanged(bool is_add, View* parent, View* child) {
if (is_add && !native_wrapper_ && GetWidget() && !initialized_) {
initialized_ = true;
// The native wrapper's lifetime will be managed by the view hierarchy after
// we call AddChildView.
native_wrapper_ = NativeTextfieldWrapper::CreateWrapper(this);
AddChildView(native_wrapper_->GetView());
// TODO(beng): Move this initialization to NativeTextfieldWin once it
// subclasses NativeControlWin.
UpdateAllProperties();
#if defined(OS_WIN)
// TODO(beng): remove this once NativeTextfieldWin subclasses
// NativeControlWin. This is currently called to perform post-AddChildView
// initialization for the wrapper. The GTK version subclasses things
// correctly and doesn't need this.
//
// Remove the include for native_textfield_win.h above when you fix this.
static_cast<NativeTextfieldWin*>(native_wrapper_)->AttachHack();
#endif
}
}
std::string Textfield::GetClassName() const {
return kViewClassName;
}
app::KeyboardCode Textfield::Keystroke::GetKeyboardCode() const {
#if defined(OS_WIN)
return static_cast<app::KeyboardCode>(key_);
#else
return event_->GetKeyCode();
#endif
}
#if defined(OS_WIN)
bool Textfield::Keystroke::IsControlHeld() const {
return win_util::IsCtrlPressed();
}
bool Textfield::Keystroke::IsShiftHeld() const {
return win_util::IsShiftPressed();
}
#else
bool Textfield::Keystroke::IsControlHeld() const {
return event_->IsControlDown();
}
bool Textfield::Keystroke::IsShiftHeld() const {
return event_->IsShiftDown();
}
#endif
} // namespace views
| 26.875 | 80 | 0.714147 | Gitman1989 |
e927eab2aea1e5c562de11ca6fb068d95fede3b5 | 10,913 | cpp | C++ | implementations/ugene/src/plugins/CoreTests/src/GUrlTests.cpp | r-barnes/sw_comparison | 1ac2c9cc10a32badd6b8fb1e96516c97f7800176 | [
"BSD-Source-Code"
] | null | null | null | implementations/ugene/src/plugins/CoreTests/src/GUrlTests.cpp | r-barnes/sw_comparison | 1ac2c9cc10a32badd6b8fb1e96516c97f7800176 | [
"BSD-Source-Code"
] | null | null | null | implementations/ugene/src/plugins/CoreTests/src/GUrlTests.cpp | r-barnes/sw_comparison | 1ac2c9cc10a32badd6b8fb1e96516c97f7800176 | [
"BSD-Source-Code"
] | null | null | null | /**
* UGENE - Integrated Bioinformatics Tools.
* Copyright (C) 2008-2020 UniPro <ugene@unipro.ru>
* http://ugene.net
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "GUrlTests.h"
#include <QDir>
#include <U2Core/AppContext.h>
#include <U2Core/AppFileStorage.h>
#include <U2Core/GHints.h>
#include <U2Core/GObject.h>
#include <U2Core/GUrl.h>
#include <U2Core/U2SafePoints.h>
namespace U2 {
#define ORIGINAL_URL_ATTR "original"
#define EXPECTED_RESULT_ATTR "expected-result"
#define PLATFORM_ATTR "platform"
#define PLATFORM_WIN "win"
#define PLATFORM_UNIX "unix"
void GTest_ConvertPath::init(XMLTestFormat *, const QDomElement &el) {
originalUrl = el.attribute(ORIGINAL_URL_ATTR);
expectedResult = el.attribute(EXPECTED_RESULT_ATTR);
platform = el.attribute(PLATFORM_ATTR);
#ifdef Q_OS_WIN
QString currPlatform = PLATFORM_WIN;
#else
QString currPlatform = PLATFORM_UNIX;
#endif
runThisTest = (platform == currPlatform);
if (runThisTest) {
GUrl gurl(originalUrl);
result = gurl.getURLString();
isFileUrl = (gurl.getType() == GUrl_File);
}
}
Task::ReportResult GTest_ConvertPath::report() {
if (runThisTest) {
if (!isFileUrl) {
stateInfo.setError(tr("%1 isn't a File URL.").arg(originalUrl));
} else if (expectedResult != result) {
stateInfo.setError(tr("%1 was converted into %2, while %3 was expected").arg(originalUrl).arg(result).arg(expectedResult));
}
}
return ReportResult_Finished;
}
/************************************************************************/
/* GTest_CreateTmpDir */
/************************************************************************/
#define TEMP_DATA_DIR_ENV_ID "TEMP_DATA_DIR"
#define URL_ATTR "url"
#define DATA_ATTR "data"
#define EXISTS_ATTR "exists"
void GTest_CreateTmpDir::init(XMLTestFormat * /*tf*/, const QDomElement &el) {
url = el.attribute(URL_ATTR);
}
Task::ReportResult GTest_CreateTmpDir::report() {
QDir tmpDir(env->getVar(TEMP_DATA_DIR_ENV_ID));
bool exists = tmpDir.exists(url);
if (!exists) {
bool created = tmpDir.mkdir(url);
if (!created) {
setError("Can not create a folder: " + url);
}
}
return ReportResult_Finished;
}
/************************************************************************/
/* GTest_RemoveTmpDir */
/************************************************************************/
void GTest_RemoveTmpDir::init(XMLTestFormat * /*tf*/, const QDomElement &el) {
url = env->getVar(TEMP_DATA_DIR_ENV_ID) + "/" + el.attribute(URL_ATTR);
}
Task::ReportResult GTest_RemoveTmpDir::report() {
removeDir(url);
return ReportResult_Finished;
}
void GTest_RemoveTmpDir::removeDir(const QString &url) {
QDir dir(url);
bool removed = dir.removeRecursively();
if (!removed) {
setError(QString("Can not remove a dir: %1").arg(url));
}
}
/************************************************************************/
/* GTest_RemoveTmpFile */
/************************************************************************/
void GTest_RemoveTmpFile::init(XMLTestFormat * /*tf*/, const QDomElement &el) {
url = env->getVar(TEMP_DATA_DIR_ENV_ID) + "/" + el.attribute(URL_ATTR);
}
Task::ReportResult GTest_RemoveTmpFile::report() {
bool removed = QFile::remove(url);
if (!removed) {
setError(QString("Can not remove a file: %1").arg(url));
}
return ReportResult_Finished;
}
/************************************************************************/
/* GTest_CreateTmpFile */
/************************************************************************/
void GTest_CreateTmpFile::init(XMLTestFormat * /*tf*/, const QDomElement &el) {
url = env->getVar(TEMP_DATA_DIR_ENV_ID) + "/" + el.attribute(URL_ATTR);
data = el.attribute(DATA_ATTR);
}
Task::ReportResult GTest_CreateTmpFile::report() {
QFile file(url);
bool created = file.open(QIODevice::WriteOnly);
if (!created) {
setError(QString("Can not create a file: %1").arg(url));
return ReportResult_Finished;
}
file.write(data.replace("\\n", "\n").toLatin1());
file.close();
return ReportResult_Finished;
}
/************************************************************************/
/* GTest_CheckTmpFile */
/************************************************************************/
void GTest_CheckTmpFile::init(XMLTestFormat * /*tf*/, const QDomElement &el) {
url = env->getVar(TEMP_DATA_DIR_ENV_ID) + "/" + el.attribute(URL_ATTR);
exists = bool(el.attribute(EXISTS_ATTR).toInt());
}
Task::ReportResult GTest_CheckTmpFile::report() {
bool actual = QFile::exists(url);
if (exists != actual) {
setError(QString("File exist state failed. Expected: %1. Actual: %2").arg(exists).arg(actual));
}
return ReportResult_Finished;
}
/************************************************************************/
/* GTest_CheckStorageFile */
/************************************************************************/
void GTest_CheckStorageFile::init(XMLTestFormat *tf, const QDomElement &el) {
Q_UNUSED(tf);
storageUrl = AppContext::getAppFileStorage()->getStorageDir();
fileName = el.attribute(URL_ATTR);
exists = bool(el.attribute(EXISTS_ATTR).toInt());
}
Task::ReportResult GTest_CheckStorageFile::report() {
bool actual = findRecursive(storageUrl);
if (exists != actual) {
setError(QString("File exist state failed. Expected: %1. Actual: %2").arg(exists).arg(actual));
}
return ReportResult_Finished;
}
bool GTest_CheckStorageFile::findRecursive(const QString ¤tDirUrl) {
QDir currentDir(currentDirUrl);
QFileInfoList subDirList = currentDir.entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
QFileInfoList fileList = currentDir.entryInfoList(QDir::Files);
foreach (QFileInfo fileInfo, fileList) {
if (fileName == fileInfo.fileName()) {
return true;
}
}
foreach (QFileInfo dirInfo, subDirList) {
if (true == findRecursive(dirInfo.filePath())) {
return true;
}
}
return false;
}
/************************************************************************/
/* GTest_CheckCreationTime */
/************************************************************************/
#define URL_ATTR "url"
#define LESS_ATTR "lessThen"
#define MORE_ATTR "moreThen"
void GTest_CheckCreationTime::init(XMLTestFormat *tf, const QDomElement &el) {
Q_UNUSED(tf)
url = el.attribute(URL_ATTR);
XMLTestUtils::replacePrefix(env, url);
QString lessThen_string = el.attribute(LESS_ATTR);
QString moreThen_string = el.attribute(MORE_ATTR);
if (lessThen_string.isEmpty() && moreThen_string.isEmpty()) {
setError("lessThen or moreThen tag should be set, but neither was set");
return;
}
if (!lessThen_string.isEmpty() && !moreThen_string.isEmpty()) {
setError("lessThen or moreThen tag should be set, but both were set");
return;
}
int lessThen_int = -1;
int moreThen_int = -1;
if (!lessThen_string.isEmpty()) {
bool ok;
lessThen_int = lessThen_string.toInt(&ok);
if (!ok) {
setError("lessThen tag is not a number");
return;
}
}
if (!moreThen_string.isEmpty()) {
bool ok;
moreThen_int = moreThen_string.toInt(&ok);
if (!ok) {
setError("moreThen tag is not a number");
return;
}
}
lessThen = lessThen_int;
moreThen = moreThen_int;
}
Task::ReportResult GTest_CheckCreationTime::report() {
QFile f(url);
if (!f.exists()) {
setError("file " + url + " not found");
return Task::ReportResult_Finished;
}
QFileInfo info(f);
QDateTime created = info.created();
QDateTime now = QDateTime::currentDateTime();
int seconds = created.secsTo(now);
if (lessThen != -1) {
if (seconds > lessThen) {
setError(QString("time is more then expected: %1").arg(seconds));
return Task::ReportResult_Finished;
}
}
if (moreThen != -1) {
if (seconds < moreThen) {
setError(QString("time is less then expected: %1").arg(seconds));
return Task::ReportResult_Finished;
}
}
return Task::ReportResult_Finished;
}
/************************************************************************/
/* GTest_CheckFilesNum */
/************************************************************************/
#define FOLDER_ATTR "folder"
#define EXP_NUM "expected"
void GTest_CheckFilesNum::init(XMLTestFormat *tf, const QDomElement &el) {
Q_UNUSED(tf)
folder = el.attribute(FOLDER_ATTR);
QString num_string = el.attribute(EXP_NUM);
if (num_string.isEmpty()) {
setError("<expected> tag should be set");
return;
}
bool ok;
expectedNum = num_string.toInt(&ok);
if (!ok) {
setError("<expected> tab sould be integer");
}
}
Task::ReportResult GTest_CheckFilesNum::report() {
XMLTestUtils::replacePrefix(env, folder);
QDir d(folder);
if (!d.exists()) {
setError("file " + d.absolutePath());
return Task::ReportResult_Finished;
}
QFileInfoList list = d.entryInfoList();
int actualNum = list.size();
if (actualNum != expectedNum) {
setError(QString("Unexpected files number: %1").arg(actualNum));
return Task::ReportResult_Finished;
}
return Task::ReportResult_Finished;
}
/*******************************
* GUrlTests
*******************************/
QList<XMLTestFactory *> GUrlTests::createTestFactories() {
QList<XMLTestFactory *> res;
res.append(GTest_ConvertPath::createFactory());
res.append(GTest_CreateTmpDir::createFactory());
res.append(GTest_RemoveTmpDir::createFactory());
res.append(GTest_RemoveTmpFile::createFactory());
res.append(GTest_CreateTmpFile::createFactory());
res.append(GTest_CheckTmpFile::createFactory());
res.append(GTest_CheckStorageFile::createFactory());
res.append(GTest_CheckCreationTime::createFactory());
res.append(GTest_CheckFilesNum::createFactory());
return res;
}
} // namespace U2
| 33.069697 | 135 | 0.591863 | r-barnes |
e92b5390f10ade81dcdfd118507231b5b1fd91db | 3,983 | hpp | C++ | engine/include/engine/Model.hpp | vscav/contemplative-game | cadf92c1b44d226bf97a87f738ea3aad3e7dd376 | [
"MIT"
] | null | null | null | engine/include/engine/Model.hpp | vscav/contemplative-game | cadf92c1b44d226bf97a87f738ea3aad3e7dd376 | [
"MIT"
] | null | null | null | engine/include/engine/Model.hpp | vscav/contemplative-game | cadf92c1b44d226bf97a87f738ea3aad3e7dd376 | [
"MIT"
] | 1 | 2021-12-24T08:13:21.000Z | 2021-12-24T08:13:21.000Z | #pragma once
#ifndef _Model_HPP_
#define _Model_HPP_
#include <engine/Camera.hpp>
#include <engine/Shader.hpp>
#include <engine/Collider.hpp>
#include <engine/VertexArrayObject.hpp>
#include <engine/utils/filesystem.hpp>
#include <engine/dependencies/tiny_gltf.h>
#include <GL/glew.h>
#include <memory>
namespace engine
{
/// \class Model
/// \brief Class for instanciating 3D model and using gltf file routine (with tiny gltf library).
class Model
{
private:
tinygltf::Model m_model; /*!< The 3D model. */
Collider m_collider; /*!< The collider of the model. */
fs::path m_gltfFilePath; /*!< The path to the GLTF file which describes the 3D model. */
std::vector<GLuint> m_textureObjects; /*!< The vector of texture objects obtained from the model. */
std::vector<GLuint> m_bufferObjects; /*!< The vector of buffer objects obtained from the model. */
std::vector<GLuint> m_vertexArrayObjects; /*!< The vector of array objects computed from the model and its meshes. */
std::vector<VertexArrayObject::VaoRange> m_meshToVertexArrays; /*!< The vector containing the range of VAOs for each mesh. */
GLuint m_whiteTexture = 0; /*!< This will be used for the base color of objects that have no materials. */
public:
/// \brief Parameterized constructor.
/// \param gltfFilePath : The path to the GLTF file.
explicit Model(const std::string &gltfFilePath);
/// \brief Default destructor.
~Model() = default;
/// \brief Loads the GLTF file which describes the 3D model.
bool loadGltfFile(tinygltf::Model &model);
/// \brief Gets the collider of the model as a const reference.
/// \return The collider of the model as a const reference.
const Collider &collider() const { return m_collider; };
/// \brief Gets the collider of the model.
/// \return The collider of the model.
Collider &collider() { return m_collider; };
/// \brief Computes a vector of texture objects.
/// Each texture object is filled with an image and sampling parameters from the corresponding texture of the glTF file.
/// \param model : The 3D model.
/// \return A vector of texture objects.
/// \return A vector containing each texture objects.
std::vector<GLuint> createTextureObjects(const tinygltf::Model &model) const;
/// \brief Computes the vector of buffer objects from the 3D model and returns it.
/// \param model : The 3D model.
/// \return A vector of buffer objects.
/// \return A vector containing each vertex buffer objects.
std::vector<GLuint> createBufferObjects(const tinygltf::Model &model);
/// \brief Takes the 3D model and the vector of buffer objects previously created, creates an array of vertex array objects and returns it.
/// It then fills the input vector meshIndexToVaoRange with the range of VAOs for each mesh.
/// \param model : The 3D model.
/// \param bufferObjects : The vector of buffer objects obtained from the model.
/// \param meshToVertexArrays : The vector containing the range of VAOs for each mesh.
/// \return A vector containing each vertex array objects.
std::vector<GLuint> createVertexArrayObjects(const tinygltf::Model &model,
const std::vector<GLuint> &bufferObjects,
std::vector<VertexArrayObject::VaoRange> &meshToVertexArrays);
/// \brief Create the default texture to apply in case there are no other textures.
void createDefaultTexture();
/// \brief Renders the model to the screen/window.
/// \param shader : The shaders associated to the model and to its entity.
void render(Shader *shader);
};
} // namespace engine
#endif /* _Model_HPP_ */ | 47.416667 | 148 | 0.654532 | vscav |
e92e0960cf571d07187d5c035243bf4c8fbda2ee | 240 | cpp | C++ | Item.cpp | stephens2633/CppPractice | 05e886885466bc0fd43957c887c19545678e9230 | [
"MIT"
] | null | null | null | Item.cpp | stephens2633/CppPractice | 05e886885466bc0fd43957c887c19545678e9230 | [
"MIT"
] | null | null | null | Item.cpp | stephens2633/CppPractice | 05e886885466bc0fd43957c887c19545678e9230 | [
"MIT"
] | null | null | null | #include "Item.h"
#include<iostream>
using namespace std;
Item::Item()
{
//ctor
}
Item::~Item()
{
//dtor
}
void Item::getWriting(){
if(!writing.compare(""))
cout << "Nothing written" << endl;
else
cout << writing <<endl;
}
| 11.428571 | 36 | 0.595833 | stephens2633 |
e933ed10a9d7f4451080ef6f860b247fd56af44a | 683 | hpp | C++ | src/common/legacy/include/legacy/ngraph_ops/selu_ie.hpp | pazamelin/openvino | b7e8ef910d7ed8e52326d14dc6fd53b71d16ed48 | [
"Apache-2.0"
] | 1 | 2021-11-24T08:40:13.000Z | 2021-11-24T08:40:13.000Z | src/common/legacy/include/legacy/ngraph_ops/selu_ie.hpp | pazamelin/openvino | b7e8ef910d7ed8e52326d14dc6fd53b71d16ed48 | [
"Apache-2.0"
] | 58 | 2020-11-06T12:13:45.000Z | 2022-03-28T13:20:11.000Z | src/common/legacy/include/legacy/ngraph_ops/selu_ie.hpp | pazamelin/openvino | b7e8ef910d7ed8e52326d14dc6fd53b71d16ed48 | [
"Apache-2.0"
] | 2 | 2021-07-14T07:40:50.000Z | 2021-07-27T01:40:03.000Z | // Copyright (C) 2018-2021 Intel Corporation
// SPDX-License-Identifier: Apache-2.0
//
#pragma once
#include <memory>
#include <ie_api.h>
#include "ngraph/op/op.hpp"
namespace ngraph {
namespace op {
class SeluIE : public Op {
public:
OPENVINO_OP("SeluIE", "legacy");
BWDCMP_RTTI_DECLARATION;
SeluIE(const Output<Node> & input,
const float alpha,
const float gamma);
void validate_and_infer_types() override;
std::shared_ptr<Node> clone_with_new_inputs(const OutputVector& new_args) const override;
bool visit_attributes(AttributeVisitor& visitor) override;
float gamma, alpha;
};
} // namespace op
} // namespace ngraph
| 20.088235 | 93 | 0.698389 | pazamelin |
e93467516f91cd1e05f524991d849423a251e41a | 1,302 | hpp | C++ | tools/profiler/gui/include/treeitem.hpp | 00-01/gap_sdk | 25444d752b26ccf0b848301c381692d77172852c | [
"Apache-2.0"
] | 118 | 2018-05-22T08:45:59.000Z | 2022-03-30T07:00:45.000Z | tools/profiler/gui/include/treeitem.hpp | 00-01/gap_sdk | 25444d752b26ccf0b848301c381692d77172852c | [
"Apache-2.0"
] | 213 | 2018-07-25T02:37:32.000Z | 2022-03-30T18:04:01.000Z | tools/profiler/gui/include/treeitem.hpp | 00-01/gap_sdk | 25444d752b26ccf0b848301c381692d77172852c | [
"Apache-2.0"
] | 76 | 2018-07-04T08:19:27.000Z | 2022-03-24T09:58:05.000Z | /*
* Copyright (C) 2020 GreenWaves Technologies, SAS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef TREEITEM_H
#define TREEITEM_H
#include <QVariant>
#include <QVector>
//! [0]
class TreeItem
{
public:
explicit TreeItem(const QVector<QVariant> &data, TreeItem *parentItem = nullptr);
~TreeItem();
void appendChild(TreeItem *child);
TreeItem *child(int row);
int childCount() const;
int columnCount() const;
QVariant data(int column) const;
int row() const;
TreeItem *parentItem();
private:
QVector<TreeItem*> m_childItems;
QVector<QVariant> m_itemData;
TreeItem *m_parentItem;
};
//! [0]
#endif // TREEITEM_H
| 27.125 | 85 | 0.715822 | 00-01 |
e9352f717a0cf9277d2af3df76fac7a65f958819 | 1,040 | cpp | C++ | snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp | BohdanMosiyuk/samples | 59d435ba9e61e0fc19f5176c96b1cdbd53596142 | [
"CC-BY-4.0",
"MIT"
] | 2 | 2020-02-22T09:30:21.000Z | 2021-08-02T23:44:31.000Z | snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp | BohdanMosiyuk/samples | 59d435ba9e61e0fc19f5176c96b1cdbd53596142 | [
"CC-BY-4.0",
"MIT"
] | 555 | 2019-09-23T22:22:58.000Z | 2021-07-15T18:51:12.000Z | snippets/cpp/VS_Snippets_CLR_System/system.IO.TextReaderWriter/CPP/textrw.cpp | BohdanMosiyuk/samples | 59d435ba9e61e0fc19f5176c96b1cdbd53596142 | [
"CC-BY-4.0",
"MIT"
] | 3 | 2020-01-29T16:31:15.000Z | 2021-08-24T07:00:15.000Z |
// <Snippet1>
using namespace System;
using namespace System::IO;
// <Snippet4>
void WriteText( TextWriter^ textWriter )
{
textWriter->Write( "Invalid file path characters are: " );
textWriter->Write( Path::InvalidPathChars );
textWriter->Write( Char::Parse( "." ) );
}
// </Snippet4>
// <Snippet5>
void ReadText( TextReader^ textReader )
{
Console::WriteLine( "From {0} - {1}", textReader->GetType()->Name, textReader->ReadToEnd() );
}
// </Snippet5>
int main()
{
// <Snippet2>
TextWriter^ stringWriter = gcnew StringWriter;
TextWriter^ streamWriter = gcnew StreamWriter( "InvalidPathChars.txt" );
// </Snippet2>
WriteText( stringWriter );
WriteText( streamWriter );
streamWriter->Close();
// <Snippet3>
TextReader^ stringReader = gcnew StringReader( stringWriter->ToString() );
TextReader^ streamReader = gcnew StreamReader( "InvalidPathChars.txt" );
// </Snippet3>
ReadText( stringReader );
ReadText( streamReader );
streamReader->Close();
}
// </Snippet1>
| 22.12766 | 96 | 0.661538 | BohdanMosiyuk |
e938acd34564df6e26baa94ee69d6e654d7b2123 | 1,842 | cpp | C++ | apps/myApps/idolHackerthon/src/Scenes/SquareRippleScene.cpp | marble-seijin/idolHackerthon | a1f1312f4a9a4b1dc25eea94ee496088490f5cfc | [
"MIT"
] | null | null | null | apps/myApps/idolHackerthon/src/Scenes/SquareRippleScene.cpp | marble-seijin/idolHackerthon | a1f1312f4a9a4b1dc25eea94ee496088490f5cfc | [
"MIT"
] | null | null | null | apps/myApps/idolHackerthon/src/Scenes/SquareRippleScene.cpp | marble-seijin/idolHackerthon | a1f1312f4a9a4b1dc25eea94ee496088490f5cfc | [
"MIT"
] | null | null | null | //
// SquareRipple.cpp
// idolHackerthon
//
// Created by NAMBU AKIFUMI on 2015/09/12.
//
//
#include "SquareRippleScene.h"
SquareRippleScene::SquareRippleScene(){
ofBackground(255);
}
void SquareRippleScene::update(){
for (vector<SquareRipple>::iterator it = ripples.begin(); it != ripples.end(); ++it) {
if(it->isDead()){
ripples.erase(it);
-- it;
}
}
for (vector<SquareRipple>::iterator it = ripples.begin(); it != ripples.end(); ++it) {
it -> update();
}
}
void SquareRippleScene::draw(){
for (vector<SquareRipple>::iterator it = ripples.begin(); it != ripples.end(); ++it) {
it -> draw();
}
}
void SquareRippleScene::keyPressed(int key){
if(key==' '){
ripples.push_back(SquareRipple());
}
}
//--------------------------------------------------------------
void SquareRippleScene::keyReleased(int key){
}
//--------------------------------------------------------------
void SquareRippleScene::mouseMoved(int x, int y ){
}
//--------------------------------------------------------------
void SquareRippleScene::mouseDragged(int x, int y, int button){
}
//--------------------------------------------------------------
void SquareRippleScene::mousePressed(int x, int y, int button){
}
//--------------------------------------------------------------
void SquareRippleScene::mouseReleased(int x, int y, int button){
}
//--------------------------------------------------------------
void SquareRippleScene::windowResized(int w, int h){
}
//--------------------------------------------------------------
void SquareRippleScene::gotMessage(ofMessage msg){
}
//--------------------------------------------------------------
void SquareRippleScene::dragEvent(ofDragInfo dragInfo){
}
| 23.615385 | 90 | 0.449511 | marble-seijin |
e939008e50edd11d330217bc598402b9eca5c7e9 | 1,113 | cpp | C++ | src/ConcoleGame/clock.cpp | Aswiz/C_Plus_Plus | 6768a67e821a444383232c41915fb9b6d81ceac4 | [
"MIT"
] | null | null | null | src/ConcoleGame/clock.cpp | Aswiz/C_Plus_Plus | 6768a67e821a444383232c41915fb9b6d81ceac4 | [
"MIT"
] | null | null | null | src/ConcoleGame/clock.cpp | Aswiz/C_Plus_Plus | 6768a67e821a444383232c41915fb9b6d81ceac4 | [
"MIT"
] | null | null | null | //пример использования функции clock
#include <iostream> // для оператора cout
#include <ctime> // для функции clock
#include <cmath> // для функции sqrt
int frequencyPrimes (int n) // функция поиска простых чисел
{
int freq = n-1;
for (int i = 2; i <= n; ++i)
for (int j = sqrt( (float)i ); j > 1; --j)
if (i % j == 0)
{
--freq;
break;
}
return freq;
}
int main ()
{
std::cout << "Вычисление..." << std::endl;
int f = frequencyPrimes (100000); // ищем простые числа в интервале от 2 до 100000
int t = clock(); // получаем количество тиков времени
std::cout << "Количество простых чисел меньших 100 000 = "
<< f << std::endl;
std::cout << "Для вычисления понадобилось "
<< t << " тиков времени или "
<< ((float)t) / CLOCKS_PER_SEC << " секунд.n"
<< std::endl;
return 0;
} | 34.78125 | 105 | 0.446541 | Aswiz |
e93b15a3e3a00f4029aeda5835da7457c4e386a1 | 1,148 | cpp | C++ | tool/rokko_solvers.cpp | t-sakashita/rokko | ebd49e1198c4ec9e7612ad4a9806d16a4ff0bdc9 | [
"BSL-1.0"
] | 16 | 2015-01-31T18:57:48.000Z | 2022-03-18T19:04:49.000Z | tool/rokko_solvers.cpp | t-sakashita/rokko | ebd49e1198c4ec9e7612ad4a9806d16a4ff0bdc9 | [
"BSL-1.0"
] | 514 | 2015-02-05T14:56:54.000Z | 2021-06-25T09:29:52.000Z | tool/rokko_solvers.cpp | t-sakashita/rokko | ebd49e1198c4ec9e7612ad4a9806d16a4ff0bdc9 | [
"BSL-1.0"
] | 2 | 2015-06-16T04:22:23.000Z | 2019-06-01T07:10:01.000Z | /*****************************************************************************
*
* Rokko: Integrated Interface for libraries of eigenvalue decomposition
*
* Copyright (C) 2012-2019 by Rokko Developers https://github.com/t-sakashita/rokko
*
* Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*
*****************************************************************************/
#include <rokko/solver.hpp>
int main() {
std::cout << "[serial dense solvers]\n";
for(auto name : rokko::serial_dense_ev::solvers()) {
std::cout << " " << name << std::endl;
}
#ifdef ROKKO_HAVE_PARALLEL_DENSE_SOLVER
std::cout << "[parallel dense solvers]\n";
for(auto name : rokko::parallel_dense_ev::solvers()) {
std::cout << " " << name << std::endl;
}
#endif // ROKKO_HAVE_PARALLEL_DENSE_SOLVER
#ifdef ROKKO_HAVE_PARALLEL_SPARSE_SOLVER
std::cout << "[parallel sparse solvers]\n";
for(auto name : rokko::parallel_sparse_ev::solvers()) {
std::cout << " " << name << std::endl;
}
#endif // ROKKO_HAVE_PARALLEL_SPARSE_SOLVER
return 0;
}
| 31.888889 | 82 | 0.595819 | t-sakashita |
e93dfb562dc983971f42a200a07b431647652436 | 95 | cpp | C++ | contracts/test.inline/test.inline.cpp | TP-Lab/enumivo | 76d81a36d2db8cea93fb54cd95a6ec5f6c407f97 | [
"MIT"
] | 8 | 2018-08-02T02:31:19.000Z | 2018-08-16T03:31:02.000Z | contracts/test.inline/test.inline.cpp | TP-Lab/enumivo | 76d81a36d2db8cea93fb54cd95a6ec5f6c407f97 | [
"MIT"
] | null | null | null | contracts/test.inline/test.inline.cpp | TP-Lab/enumivo | 76d81a36d2db8cea93fb54cd95a6ec5f6c407f97 | [
"MIT"
] | null | null | null | #include <test.inline/test.inline.hpp>
ENUMIVO_ABI( enumivo::testinline, (reqauth)(forward) )
| 23.75 | 54 | 0.757895 | TP-Lab |
e940a1521fe800f6b9c0031a8587612926a5d3f7 | 507 | cpp | C++ | src/vjudge/CodeForces/1A/24160288_AC_15ms_0kB.cpp | lnkkerst/oj-codes | d778489182d644370b2a690aa92c3df6542cc306 | [
"MIT"
] | null | null | null | src/vjudge/CodeForces/1A/24160288_AC_15ms_0kB.cpp | lnkkerst/oj-codes | d778489182d644370b2a690aa92c3df6542cc306 | [
"MIT"
] | null | null | null | src/vjudge/CodeForces/1A/24160288_AC_15ms_0kB.cpp | lnkkerst/oj-codes | d778489182d644370b2a690aa92c3df6542cc306 | [
"MIT"
] | null | null | null | #include <cstdio>
#include <cctype>
#define int long long
int read() {
int ret, f = 1;
char ch;
while(!isdigit(ch = getchar())) (ch == '-') && (f = -1);
for(ret = ch - '0'; isdigit(ch = getchar()); ret *= 10, ret += ch - '0');
return ret * f;
}
void print(int x) {
if(x < 0) putchar('-'), x = -x;
if(x > 9) print(x / 10);
putchar(x % 10 + '0');
}
signed main() {
int n = read(), m = read(), a = read();
print(((m + a - 1) / a) * ((n + a - 1) / a));
return 0;
} | 22.043478 | 77 | 0.457594 | lnkkerst |
e940c26ed9a92c15255d1b8e3017b811662e8893 | 69,542 | cpp | C++ | src/plugProjectEbisawaU/ebiCardMgr_Load.cpp | projectPiki/pikmin2 | a431d992acde856d092889a515ecca0e07a3ea7c | [
"Unlicense"
] | 33 | 2021-12-08T11:10:59.000Z | 2022-03-26T19:59:37.000Z | src/plugProjectEbisawaU/ebiCardMgr_Load.cpp | projectPiki/pikmin2 | a431d992acde856d092889a515ecca0e07a3ea7c | [
"Unlicense"
] | 6 | 2021-12-22T17:54:31.000Z | 2022-01-07T21:43:18.000Z | src/plugProjectEbisawaU/ebiCardMgr_Load.cpp | projectPiki/pikmin2 | a431d992acde856d092889a515ecca0e07a3ea7c | [
"Unlicense"
] | 2 | 2022-01-04T06:00:49.000Z | 2022-01-26T07:27:28.000Z | #include "types.h"
/*
Generated from dpostproc
.section .rodata # 0x804732E0 - 0x8049E220
.global lbl_80497118
lbl_80497118:
.4byte 0x65626943
.4byte 0x6172644D
.4byte 0x67725F4C
.4byte 0x6F61642E
.4byte 0x63707000
.global lbl_8049712C
lbl_8049712C:
.asciz "P2Assert"
.skip 3
.section .data, "wa" # 0x8049E220 - 0x804EFC20
.global __vt__Q33ebi9CardError29FSMState_WN1_NowCreateNewFile
__vt__Q33ebi9CardError29FSMState_WN1_NowCreateNewFile:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError29FSMState_WN1_NowCreateNewFileFPQ33ebi9CardError4TMgr
.4byte do_cardRequest__Q33ebi9CardError29FSMState_WN1_NowCreateNewFileFv
.4byte
do_transitCardReady__Q33ebi9CardError29FSMState_WN1_NowCreateNewFileFPQ33ebi9CardError4TMgr
.4byte
do_transitCardNoCard__Q33ebi9CardError29FSMState_WN1_NowCreateNewFileFPQ33ebi9CardError4TMgr
.4byte
do_transitCardIOError__Q33ebi9CardError29FSMState_WN1_NowCreateNewFileFPQ33ebi9CardError4TMgr
.4byte
do_transitCardWrongDevice__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardWrongSector__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardBroken__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardEncoding__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardNoFileSpace__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardNoFileEntry__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardFileOpenError__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardSerialNoError__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError22FSMState_WN0_NowFormat
__vt__Q33ebi9CardError22FSMState_WN0_NowFormat:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError22FSMState_WN0_NowFormatFPQ33ebi9CardError4TMgr
.4byte do_cardRequest__Q33ebi9CardError22FSMState_WN0_NowFormatFv
.4byte
do_transitCardReady__Q33ebi9CardError22FSMState_WN0_NowFormatFPQ33ebi9CardError4TMgr
.4byte
do_transitCardNoCard__Q33ebi9CardError22FSMState_WN0_NowFormatFPQ33ebi9CardError4TMgr
.4byte
do_transitCardIOError__Q33ebi9CardError22FSMState_WN0_NowFormatFPQ33ebi9CardError4TMgr
.4byte
do_transitCardWrongDevice__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardWrongSector__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardBroken__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardEncoding__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardNoFileSpace__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardNoFileEntry__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardFileOpenError__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.4byte
do_transitCardSerialNoError__Q33ebi9CardError20FSMState_CardRequestFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError25FSMState_Q05_GameCantSave
__vt__Q33ebi9CardError25FSMState_Q05_GameCantSave:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError25FSMState_Q05_GameCantSaveFPQ33ebi9CardError4TMgr
.4byte
do_transitYes__Q33ebi9CardError25FSMState_Q05_GameCantSaveFPQ33ebi9CardError4TMgr
.4byte
do_transitNo__Q33ebi9CardError25FSMState_Q05_GameCantSaveFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError38FSMState_Q04_DoYouStartGameWithoutSave
__vt__Q33ebi9CardError38FSMState_Q04_DoYouStartGameWithoutSave:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError38FSMState_Q04_DoYouStartGameWithoutSaveFPQ33ebi9CardError4TMgr
.4byte
do_transitYes__Q33ebi9CardError38FSMState_Q04_DoYouStartGameWithoutSaveFPQ33ebi9CardError4TMgr
.4byte
do_transitNo__Q33ebi9CardError38FSMState_Q04_DoYouStartGameWithoutSaveFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError31FSMState_Q03_DoYouCreateNewFile
__vt__Q33ebi9CardError31FSMState_Q03_DoYouCreateNewFile:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError31FSMState_Q03_DoYouCreateNewFileFPQ33ebi9CardError4TMgr
.4byte
do_transitYes__Q33ebi9CardError31FSMState_Q03_DoYouCreateNewFileFPQ33ebi9CardError4TMgr
.4byte
do_transitNo__Q33ebi9CardError31FSMState_Q03_DoYouCreateNewFileFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError24FSMState_Q02_DoYouFormat
__vt__Q33ebi9CardError24FSMState_Q02_DoYouFormat:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError24FSMState_Q02_DoYouFormatFPQ33ebi9CardError4TMgr
.4byte
do_transitYes__Q33ebi9CardError24FSMState_Q02_DoYouFormatFPQ33ebi9CardError4TMgr
.4byte
do_transitNo__Q33ebi9CardError24FSMState_Q02_DoYouFormatFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError25FSMState_Q01_DoYouOpenIPL
__vt__Q33ebi9CardError25FSMState_Q01_DoYouOpenIPL:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError25FSMState_Q01_DoYouOpenIPLFPQ33ebi9CardError4TMgr
.4byte
do_transitYes__Q33ebi9CardError25FSMState_Q01_DoYouOpenIPLFPQ33ebi9CardError4TMgr
.4byte
do_transitNo__Q33ebi9CardError25FSMState_Q01_DoYouOpenIPLFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError37FSMState_Q00_DataBrokenAndDoYouFormat
__vt__Q33ebi9CardError37FSMState_Q00_DataBrokenAndDoYouFormat:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError17FSMState_QuestionFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError37FSMState_Q00_DataBrokenAndDoYouFormatFPQ33ebi9CardError4TMgr
.4byte
do_transitYes__Q33ebi9CardError37FSMState_Q00_DataBrokenAndDoYouFormatFPQ33ebi9CardError4TMgr
.4byte
do_transitNo__Q33ebi9CardError37FSMState_Q00_DataBrokenAndDoYouFormatFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError31FSMState_WF5_FailToSave_IOError
__vt__Q33ebi9CardError31FSMState_WF5_FailToSave_IOError:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError31FSMState_WF5_FailToSave_IOErrorFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError31FSMState_WF5_FailToSave_IOErrorFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError30FSMState_WF4_FailToSave_NoCard
__vt__Q33ebi9CardError30FSMState_WF4_FailToSave_NoCard:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError30FSMState_WF4_FailToSave_NoCardFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError30FSMState_WF4_FailToSave_NoCardFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError40FSMState_WF3_FailToCreateNewFile_IOError
__vt__Q33ebi9CardError40FSMState_WF3_FailToCreateNewFile_IOError:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError40FSMState_WF3_FailToCreateNewFile_IOErrorFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError40FSMState_WF3_FailToCreateNewFile_IOErrorFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError39FSMState_WF2_FailToCreateNewFile_NoCard
__vt__Q33ebi9CardError39FSMState_WF2_FailToCreateNewFile_NoCard:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError39FSMState_WF2_FailToCreateNewFile_NoCardFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError39FSMState_WF2_FailToCreateNewFile_NoCardFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError33FSMState_WF1_FailToFormat_IOError
__vt__Q33ebi9CardError33FSMState_WF1_FailToFormat_IOError:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError33FSMState_WF1_FailToFormat_IOErrorFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError33FSMState_WF1_FailToFormat_IOErrorFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError32FSMState_WF0_FailToFormat_NoCard
__vt__Q33ebi9CardError32FSMState_WF0_FailToFormat_NoCard:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError32FSMState_WF0_FailToFormat_NoCardFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError32FSMState_WF0_FailToFormat_NoCardFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError26FSMState_W10_SerialNoError
__vt__Q33ebi9CardError26FSMState_W10_SerialNoError:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError26FSMState_W10_SerialNoErrorFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError26FSMState_W10_SerialNoErrorFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError32FSMState_W09_FinishCreateNewFile
__vt__Q33ebi9CardError32FSMState_W09_FinishCreateNewFile:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError32FSMState_W09_FinishCreateNewFileFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError32FSMState_W09_FinishCreateNewFileFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError25FSMState_W08_FinishFormat
__vt__Q33ebi9CardError25FSMState_W08_FinishFormat:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError25FSMState_W08_FinishFormatFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError25FSMState_W08_FinishFormatFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError26FSMState_W07_NoFileForSave
__vt__Q33ebi9CardError26FSMState_W07_NoFileForSave:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError26FSMState_W07_NoFileForSaveFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError26FSMState_W07_NoFileForSaveFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError26FSMState_W06_CardNotUsable
__vt__Q33ebi9CardError26FSMState_W06_CardNotUsable:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError26FSMState_W06_CardNotUsableFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError26FSMState_W06_CardNotUsableFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError26FSMState_W05_InitCardOnIPL
__vt__Q33ebi9CardError26FSMState_W05_InitCardOnIPL:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError26FSMState_W05_InitCardOnIPLFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError26FSMState_W05_InitCardOnIPLFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError25FSMState_W04_OverCapacity
__vt__Q33ebi9CardError25FSMState_W04_OverCapacity:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError25FSMState_W04_OverCapacityFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError25FSMState_W04_OverCapacityFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError24FSMState_W03_WrongSector
__vt__Q33ebi9CardError24FSMState_W03_WrongSector:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError24FSMState_W03_WrongSectorFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError24FSMState_W03_WrongSectorFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError24FSMState_W02_WrongDevice
__vt__Q33ebi9CardError24FSMState_W02_WrongDevice:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError24FSMState_W02_WrongDeviceFPQ33ebi9CardError4TMgr
.4byte
do_transit__Q33ebi9CardError24FSMState_W02_WrongDeviceFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError20FSMState_W01_IOError
__vt__Q33ebi9CardError20FSMState_W01_IOError:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte
do_exec__Q33ebi9CardError16FSMState_WarningFPQ33ebi9CardError4TMgr .4byte
do_open__Q33ebi9CardError20FSMState_W01_IOErrorFPQ33ebi9CardError4TMgr .4byte
do_transit__Q33ebi9CardError20FSMState_W01_IOErrorFPQ33ebi9CardError4TMgr
.global __vt__Q33ebi9CardError19FSMState_W00_NoCard
__vt__Q33ebi9CardError19FSMState_W00_NoCard:
.4byte 0
.4byte 0
.4byte
init__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte exec__Q33ebi9CardError8FSMStateFPQ33ebi9CardError4TMgr
.4byte
"cleanup__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"resume__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"restart__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgr"
.4byte
"transit__Q24Game31FSMState<Q33ebi9CardError4TMgr>FPQ33ebi9CardError4TMgriPQ24Game8StateArg"
.4byte
do_init__Q33ebi9CardError15FSMState_NoCardFPQ33ebi9CardError4TMgrPQ24Game8StateArg
.4byte do_exec__Q33ebi9CardError15FSMState_NoCardFPQ33ebi9CardError4TMgr
.4byte
do_open__Q33ebi9CardError19FSMState_W00_NoCardFPQ33ebi9CardError4TMgr .4byte
do_transit__Q33ebi9CardError19FSMState_W00_NoCardFPQ33ebi9CardError4TMgr
.4byte
do_transitOnCard__Q33ebi9CardError19FSMState_W00_NoCardFPQ33ebi9CardError4TMgr
.4byte 0
*/
namespace ebi {
/*
* --INFO--
* Address: 803E2520
* Size: 00004C
*/
void CardError::FSMState_W00_NoCard::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2548
mr r3, r4
li r4, 1
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E255C
lbl_803E2548:
cmpwi r0, 1
bne lbl_803E255C
mr r3, r4
li r4, 0x14
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E255C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E256C
* Size: 000058
*/
void CardError::FSMState_W00_NoCard::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E25A0
lwz r12, 0(r3)
li r5, 0x17
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E25B4
lbl_803E25A0:
cmpwi r0, 1
bne lbl_803E25B4
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E25B4:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E25C4
* Size: 00004C
*/
void CardError::FSMState_W00_NoCard::do_transitOnCard(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E25EC
mr r3, r4
li r4, 2
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
b lbl_803E2600
lbl_803E25EC:
cmpwi r0, 1
bne lbl_803E2600
mr r3, r4
li r4, 4
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E2600:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2610
* Size: 000054
*/
void CardError::FSMState_W01_IOError::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2640
mr r3, r4
li r4, 2
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E2654
lbl_803E2640:
cmpwi r0, 1
bne lbl_803E2654
mr r3, r4
li r4, 0x15
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E2654:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2664
* Size: 000058
*/
void CardError::FSMState_W01_IOError::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2698
lwz r12, 0(r3)
li r5, 0x17
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E26AC
lbl_803E2698:
cmpwi r0, 1
bne lbl_803E26AC
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E26AC:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E26BC
* Size: 000054
*/
void CardError::FSMState_W02_WrongDevice::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E26EC
mr r3, r4
li r4, 3
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E2700
lbl_803E26EC:
cmpwi r0, 1
bne lbl_803E2700
mr r3, r4
li r4, 0x16
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E2700:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2710
* Size: 000058
*/
void CardError::FSMState_W02_WrongDevice::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2744
lwz r12, 0(r3)
li r5, 0x17
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E2758
lbl_803E2744:
cmpwi r0, 1
bne lbl_803E2758
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E2758:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2768
* Size: 000054
*/
void CardError::FSMState_W03_WrongSector::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2798
mr r3, r4
li r4, 4
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E27AC
lbl_803E2798:
cmpwi r0, 1
bne lbl_803E27AC
mr r3, r4
li r4, 0x17
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E27AC:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E27BC
* Size: 000058
*/
void CardError::FSMState_W03_WrongSector::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E27F0
lwz r12, 0(r3)
li r5, 0x17
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E2804
lbl_803E27F0:
cmpwi r0, 1
bne lbl_803E2804
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E2804:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2814
* Size: 000054
*/
void CardError::FSMState_W04_OverCapacity::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2844
mr r3, r4
li r4, 6
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E2858
lbl_803E2844:
cmpwi r0, 1
bne lbl_803E2858
mr r3, r4
li r4, 0x19
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E2858:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2868
* Size: 000064
*/
void CardError::FSMState_W04_OverCapacity::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E289C
lwz r12, 0(r3)
li r5, 7
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E28BC
lbl_803E289C:
cmpwi r0, 1
bne lbl_803E28BC
lwz r12, 0(r3)
li r5, 7
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
lbl_803E28BC:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E28CC
* Size: 000054
*/
void CardError::FSMState_W05_InitCardOnIPL::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E28FC
mr r3, r4
li r4, 7
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E2910
lbl_803E28FC:
cmpwi r0, 1
bne lbl_803E2910
mr r3, r4
li r4, 0x1a
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E2910:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2920
* Size: 000064
*/
void CardError::FSMState_W05_InitCardOnIPL::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2954
lwz r12, 0(r3)
li r5, 0x14
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E2974
lbl_803E2954:
cmpwi r0, 1
bne lbl_803E2974
lwz r12, 0(r3)
li r5, 0x14
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
lbl_803E2974:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2984
* Size: 000054
*/
void CardError::FSMState_W06_CardNotUsable::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E29B4
mr r3, r4
li r4, 0xc
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E29C8
lbl_803E29B4:
cmpwi r0, 1
bne lbl_803E29C8
mr r3, r4
li r4, 0x1f
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E29C8:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E29D8
* Size: 000058
*/
void CardError::FSMState_W06_CardNotUsable::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2A0C
lwz r12, 0(r3)
li r5, 0x17
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E2A20
lbl_803E2A0C:
cmpwi r0, 1
bne lbl_803E2A20
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E2A20:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2A30
* Size: 000054
*/
void CardError::FSMState_W07_NoFileForSave::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2A60
mr r3, r4
li r4, 0x10
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E2A74
lbl_803E2A60:
cmpwi r0, 1
bne lbl_803E2A74
mr r3, r4
li r4, 0x23
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E2A74:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2A84
* Size: 000058
*/
void CardError::FSMState_W07_NoFileForSave::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2AB8
lwz r12, 0(r3)
li r5, 0x17
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E2ACC
lbl_803E2AB8:
cmpwi r0, 1
bne lbl_803E2ACC
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E2ACC:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2ADC
* Size: 000054
*/
void CardError::FSMState_W08_FinishFormat::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2B0C
mr r3, r4
li r4, 9
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E2B20
lbl_803E2B0C:
cmpwi r0, 1
bne lbl_803E2B20
mr r3, r4
li r4, 0x1c
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E2B20:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2B30
* Size: 00004C
*/
void CardError::FSMState_W08_FinishFormat::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2B58
mr r3, r4
li r4, 2
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
b lbl_803E2B6C
lbl_803E2B58:
cmpwi r0, 1
bne lbl_803E2B6C
mr r3, r4
li r4, 4
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E2B6C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2B7C
* Size: 000054
*/
void CardError::FSMState_W09_FinishCreateNewFile::do_open((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0x1
stb r0, 0x12(r3)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x30
mr r3, r4
li r4, 0x13
bl -0x202AC
b .loc_0x44
.loc_0x30:
cmpwi r0, 0x1
bne- .loc_0x44
mr r3, r4
li r4, 0x26
bl -0x202C4
.loc_0x44:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2BD0
* Size: 00004C
*/
void CardError::FSMState_W09_FinishCreateNewFile::do_transit((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x2
bl -0xF7E8
b .loc_0x3C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x3C
mr r3, r4
li r4, 0x4
bl -0xF800
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2C1C
* Size: 000064
*/
void CardError::FSMState_W10_SerialNoError::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2C5C
lis r3, lbl_80497118@ha
lis r5, lbl_8049712C@ha
addi r3, r3, lbl_80497118@l
li r4, 0xec
addi r5, r5, lbl_8049712C@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
b lbl_803E2C70
lbl_803E2C5C:
cmpwi r0, 1
bne lbl_803E2C70
mr r3, r4
li r4, 0x27
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E2C70:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2C80
* Size: 00005C
*/
void CardError::FSMState_W10_SerialNoError::do_transit(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2CB8
lis r3, lbl_80497118@ha
lis r5, lbl_8049712C@ha
addi r3, r3, lbl_80497118@l
li r4, 0xf5
addi r5, r5, lbl_8049712C@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
b lbl_803E2CCC
lbl_803E2CB8:
cmpwi r0, 1
bne lbl_803E2CCC
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E2CCC:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2CDC
* Size: 000054
*/
void CardError::FSMState_WF0_FailToFormat_NoCard::do_open((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0
stb r0, 0x12(r3)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x30
mr r3, r4
li r4, 0x8
bl -0x2040C
b .loc_0x44
.loc_0x30:
cmpwi r0, 0x1
bne- .loc_0x44
mr r3, r4
li r4, 0x1B
bl -0x20424
.loc_0x44:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2D30
* Size: 00004C
*/
void CardError::FSMState_WF0_FailToFormat_NoCard::do_transit((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x2
bl -0xF948
b .loc_0x3C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x3C
mr r3, r4
li r4, 0x4
bl -0xF960
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2D7C
* Size: 000054
*/
void CardError::FSMState_WF1_FailToFormat_IOError::do_open((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0x1
stb r0, 0x12(r3)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x30
mr r3, r4
li r4, 0x8
bl -0x204AC
b .loc_0x44
.loc_0x30:
cmpwi r0, 0x1
bne- .loc_0x44
mr r3, r4
li r4, 0x1B
bl -0x204C4
.loc_0x44:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2DD0
* Size: 00004C
*/
void CardError::FSMState_WF1_FailToFormat_IOError::do_transit((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x2
bl -0xF9E8
b .loc_0x3C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x3C
mr r3, r4
li r4, 0x4
bl -0xFA00
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2E1C
* Size: 000054
*/
void CardError::FSMState_WF2_FailToCreateNewFile_NoCard::do_open((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0
stb r0, 0x12(r3)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x30
mr r3, r4
li r4, 0x11
bl -0x2054C
b .loc_0x44
.loc_0x30:
cmpwi r0, 0x1
bne- .loc_0x44
mr r3, r4
li r4, 0x25
bl -0x20564
.loc_0x44:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2E70
* Size: 00004C
*/
void CardError::FSMState_WF2_FailToCreateNewFile_NoCard::do_transit((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x2
bl -0xFA88
b .loc_0x3C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x3C
mr r3, r4
li r4, 0x4
bl -0xFAA0
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2EBC
* Size: 000054
*/
void CardError::FSMState_WF3_FailToCreateNewFile_IOError::do_open((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0x1
stb r0, 0x12(r3)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x30
mr r3, r4
li r4, 0x11
bl -0x205EC
b .loc_0x44
.loc_0x30:
cmpwi r0, 0x1
bne- .loc_0x44
mr r3, r4
li r4, 0x25
bl -0x20604
.loc_0x44:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2F10
* Size: 00004C
*/
void CardError::FSMState_WF3_FailToCreateNewFile_IOError::do_transit((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x2
bl -0xFB28
b .loc_0x3C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x3C
mr r3, r4
li r4, 0x4
bl -0xFB40
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2F5C
* Size: 000064
*/
void CardError::FSMState_WF4_FailToSave_NoCard::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E2F9C
lis r3, lbl_80497118@ha
lis r5, lbl_8049712C@ha
addi r3, r3, lbl_80497118@l
li r4, 0x156
addi r5, r5, lbl_8049712C@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
b lbl_803E2FB0
lbl_803E2F9C:
cmpwi r0, 1
bne lbl_803E2FB0
mr r3, r4
li r4, 0x2b
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E2FB0:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E2FC0
* Size: 00004C
*/
void CardError::FSMState_WF4_FailToSave_NoCard::do_transit((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x2
bl -0xFBD8
b .loc_0x3C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x3C
mr r3, r4
li r4, 0x4
bl -0xFBF0
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E300C
* Size: 000064
*/
void CardError::FSMState_WF5_FailToSave_IOError::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x12(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E304C
lis r3, lbl_80497118@ha
lis r5, lbl_8049712C@ha
addi r3, r3, lbl_80497118@l
li r4, 0x16b
addi r5, r5, lbl_8049712C@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
b lbl_803E3060
lbl_803E304C:
cmpwi r0, 1
bne lbl_803E3060
mr r3, r4
li r4, 0x2b
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E3060:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3070
* Size: 00004C
*/
void CardError::FSMState_WF5_FailToSave_IOError::do_transit((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x2
bl -0xFC88
b .loc_0x3C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x3C
mr r3, r4
li r4, 0x4
bl -0xFCA0
.loc_0x3C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E30BC
* Size: 000054
*/
void CardError::FSMState_Q00_DataBrokenAndDoYouFormat::do_open((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0x1
stb r0, 0x10(r3)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x30
mr r3, r4
li r4, 0x5
bl -0x207EC
b .loc_0x44
.loc_0x30:
cmpwi r0, 0x1
bne- .loc_0x44
mr r3, r4
li r4, 0x18
bl -0x20804
.loc_0x44:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3110
* Size: 000064
*/
void CardError::FSMState_Q00_DataBrokenAndDoYouFormat::do_transitYes((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x34
lwz r12, 0x0(r3)
li r5, 0x15
li r6, 0
lwz r12, 0x1C(r12)
mtctr r12
bctrl
b .loc_0x54
.loc_0x34:
cmpwi r0, 0x1
bne- .loc_0x54
lwz r12, 0x0(r3)
li r5, 0x15
li r6, 0
lwz r12, 0x1C(r12)
mtctr r12
bctrl
.loc_0x54:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3174
* Size: 000064
*/
void CardError::FSMState_Q00_DataBrokenAndDoYouFormat::do_transitNo((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x34
lwz r12, 0x0(r3)
li r5, 0x8
li r6, 0
lwz r12, 0x1C(r12)
mtctr r12
bctrl
b .loc_0x54
.loc_0x34:
cmpwi r0, 0x1
bne- .loc_0x54
lwz r12, 0x0(r3)
li r5, 0x8
li r6, 0
lwz r12, 0x1C(r12)
mtctr r12
bctrl
.loc_0x54:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E31D8
* Size: 000054
*/
void CardError::FSMState_Q01_DoYouOpenIPL::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x10(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E3208
mr r3, r4
li r4, 0xd
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E321C
lbl_803E3208:
cmpwi r0, 1
bne lbl_803E321C
mr r3, r4
li r4, 0x21
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E321C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E322C
* Size: 000058
*/
void CardError::FSMState_Q01_DoYouOpenIPL::do_transitYes(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E3254
lwz r3, sys@sda21(r13)
li r4, 1
bl resetOn__6SystemFb
b lbl_803E3274
lbl_803E3254:
cmpwi r0, 1
bne lbl_803E3274
lwz r12, 0(r3)
li r5, 0x18
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
lbl_803E3274:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3284
* Size: 000058
*/
void CardError::FSMState_Q01_DoYouOpenIPL::do_transitNo(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E32B8
lwz r12, 0(r3)
li r5, 0x17
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E32CC
lbl_803E32B8:
cmpwi r0, 1
bne lbl_803E32CC
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E32CC:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E32DC
* Size: 000054
*/
void CardError::FSMState_Q02_DoYouFormat::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x10(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E330C
mr r3, r4
li r4, 0xb
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E3320
lbl_803E330C:
cmpwi r0, 1
bne lbl_803E3320
mr r3, r4
li r4, 0x1e
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E3320:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3330
* Size: 000064
*/
void CardError::FSMState_Q02_DoYouFormat::do_transitYes(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E3364
lwz r12, 0(r3)
li r5, 0x19
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E3384
lbl_803E3364:
cmpwi r0, 1
bne lbl_803E3384
lwz r12, 0(r3)
li r5, 0x19
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
lbl_803E3384:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3394
* Size: 000064
*/
void CardError::FSMState_Q02_DoYouFormat::do_transitNo(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E33C8
lwz r12, 0(r3)
li r5, 8
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
b lbl_803E33E8
lbl_803E33C8:
cmpwi r0, 1
bne lbl_803E33E8
lwz r12, 0(r3)
li r5, 8
li r6, 0
lwz r12, 0x1c(r12)
mtctr r12
bctrl
lbl_803E33E8:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E33F8
* Size: 000054
*/
void CardError::FSMState_Q03_DoYouCreateNewFile::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 1
stb r0, 0x10(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E3428
mr r3, r4
li r4, 0xf
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E343C
lbl_803E3428:
cmpwi r0, 1
bne lbl_803E343C
mr r3, r4
li r4, 0x22
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E343C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E344C
* Size: 000064
*/
void CardError::FSMState_Q03_DoYouCreateNewFile::do_transitYes((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x34
lwz r12, 0x0(r3)
li r5, 0x1A
li r6, 0
lwz r12, 0x1C(r12)
mtctr r12
bctrl
b .loc_0x54
.loc_0x34:
cmpwi r0, 0x1
bne- .loc_0x54
lwz r12, 0x0(r3)
li r5, 0x1A
li r6, 0
lwz r12, 0x1C(r12)
mtctr r12
bctrl
.loc_0x54:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E34B0
* Size: 000064
*/
void CardError::FSMState_Q03_DoYouCreateNewFile::do_transitNo((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x34
lwz r12, 0x0(r3)
li r5, 0x9
li r6, 0
lwz r12, 0x1C(r12)
mtctr r12
bctrl
b .loc_0x54
.loc_0x34:
cmpwi r0, 0x1
bne- .loc_0x54
lwz r12, 0x0(r3)
li r5, 0x9
li r6, 0
lwz r12, 0x1C(r12)
mtctr r12
bctrl
.loc_0x54:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3514
* Size: 000064
*/
void CardError::FSMState_Q04_DoYouStartGameWithoutSave::do_open((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0
stb r0, 0x10(r3)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x30
mr r3, r4
li r4, 0xE
bl -0x20C44
b .loc_0x54
.loc_0x30:
cmpwi r0, 0x1
bne- .loc_0x54
lis r3, 0x8049
lis r5, 0x8049
addi r3, r3, 0x7118
li r4, 0x1FD
addi r5, r5, 0x712C
crclr 6, 0x6
bl -0x3B8F24
.loc_0x54:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3578
* Size: 00005C
*/
void CardError::FSMState_Q04_DoYouStartGameWithoutSave::do_transitYes((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x1
bl -0x10190
b .loc_0x4C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x4C
lis r3, 0x8049
lis r5, 0x8049
addi r3, r3, 0x7118
li r4, 0x206
addi r5, r5, 0x712C
crclr 6, 0x6
bl -0x3B8F80
.loc_0x4C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E35D4
* Size: 00005C
*/
void CardError::FSMState_Q04_DoYouStartGameWithoutSave::do_transitNo((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2A4(r4)
cmpwi r0, 0
bne- .loc_0x28
mr r3, r4
li r4, 0x2
bl -0x101EC
b .loc_0x4C
.loc_0x28:
cmpwi r0, 0x1
bne- .loc_0x4C
lis r3, 0x8049
lis r5, 0x8049
addi r3, r3, 0x7118
li r4, 0x20F
addi r5, r5, 0x712C
crclr 6, 0x6
bl -0x3B8FDC
.loc_0x4C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3630
* Size: 000064
*/
void CardError::FSMState_Q05_GameCantSave::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
li r0, 0
stb r0, 0x10(r3)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E3670
lis r3, lbl_80497118@ha
lis r5, lbl_8049712C@ha
addi r3, r3, lbl_80497118@l
li r4, 0x219
addi r5, r5, lbl_8049712C@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
b lbl_803E3684
lbl_803E3670:
cmpwi r0, 1
bne lbl_803E3684
mr r3, r4
li r4, 0x20
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E3684:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3694
* Size: 00005C
*/
void CardError::FSMState_Q05_GameCantSave::do_transitYes(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E36CC
lis r3, lbl_80497118@ha
lis r5, lbl_8049712C@ha
addi r3, r3, lbl_80497118@l
li r4, 0x222
addi r5, r5, lbl_8049712C@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
b lbl_803E36E0
lbl_803E36CC:
cmpwi r0, 1
bne lbl_803E36E0
lwz r3, sys@sda21(r13)
li r4, 1
bl resetOn__6SystemFb
lbl_803E36E0:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E36F0
* Size: 00005C
*/
void CardError::FSMState_Q05_GameCantSave::do_transitNo(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E3728
lis r3, lbl_80497118@ha
lis r5, lbl_8049712C@ha
addi r3, r3, lbl_80497118@l
li r4, 0x22b
addi r5, r5, lbl_8049712C@l
crclr 6
bl panic_f__12JUTExceptionFPCciPCce
b lbl_803E373C
lbl_803E3728:
cmpwi r0, 1
bne lbl_803E373C
mr r3, r4
li r4, 3
bl goEnd___Q33ebi9CardError4TMgrFQ43ebi9CardError4TMgr7enumEnd
lbl_803E373C:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E374C
* Size: 000028
*/
void CardError::FSMState_WN0_NowFormat::do_cardRequest(void)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r3, sys@sda21(r13)
lwz r3, 0x5c(r3)
bl format__Q34Game10MemoryCard3MgrFv
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3774
* Size: 00004C
*/
void CardError::FSMState_WN0_NowFormat::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E379C
mr r3, r4
li r4, 0xa
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E37B0
lbl_803E379C:
cmpwi r0, 1
bne lbl_803E37B0
mr r3, r4
li r4, 0x1d
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E37B0:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E37C0
* Size: 000034
*/
void CardError::FSMState_WN0_NowFormat::do_transitCardReady((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
li r5, 0xA
li r6, 0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x1C(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E37F4
* Size: 000034
*/
void CardError::FSMState_WN0_NowFormat::do_transitCardNoCard((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
li r5, 0xD
li r6, 0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x1C(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3828
* Size: 000034
*/
void CardError::FSMState_WN0_NowFormat::do_transitCardIOError((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
li r5, 0xE
li r6, 0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x1C(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E385C
* Size: 00004C
*/
void CardError::FSMState_WN1_NowCreateNewFile::do_open(ebi::CardError::TMgr*)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r0, 0x2a4(r4)
cmpwi r0, 0
bne lbl_803E3884
mr r3, r4
li r4, 0x12
bl open__Q33ebi6Screen11TMemoryCardFl
b lbl_803E3898
lbl_803E3884:
cmpwi r0, 1
bne lbl_803E3898
mr r3, r4
li r4, 0x24
bl open__Q33ebi6Screen11TMemoryCardFl
lbl_803E3898:
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E38A8
* Size: 000028
*/
void CardError::FSMState_WN1_NowCreateNewFile::do_cardRequest(void)
{
/*
stwu r1, -0x10(r1)
mflr r0
stw r0, 0x14(r1)
lwz r3, sys@sda21(r13)
lwz r3, 0x5c(r3)
bl createNewFile__Q34Game10MemoryCard3MgrFv
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E38D0
* Size: 000034
*/
void CardError::FSMState_WN1_NowCreateNewFile::do_transitCardReady((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
li r5, 0xB
li r6, 0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x1C(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3904
* Size: 000034
*/
void CardError::FSMState_WN1_NowCreateNewFile::do_transitCardNoCard((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
li r5, 0xF
li r6, 0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x1C(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
/*
* --INFO--
* Address: 803E3938
* Size: 000034
*/
void CardError::FSMState_WN1_NowCreateNewFile::do_transitCardIOError((ebi::CardError::TMgr*))
{
/*
.loc_0x0:
stwu r1, -0x10(r1)
mflr r0
li r5, 0x10
li r6, 0
stw r0, 0x14(r1)
lwz r12, 0x0(r3)
lwz r12, 0x1C(r12)
mtctr r12
bctrl
lwz r0, 0x14(r1)
mtlr r0
addi r1, r1, 0x10
blr
*/
}
} // namespace ebi
| 24.256017 | 97 | 0.672845 | projectPiki |
e942f0a147ac55f005dd5ff7d2c9306a4e155173 | 1,514 | cpp | C++ | stacks_queues/queue_using_ll.cpp | ramchandra94/datastructures_in_cpp | 28274ff4f0d9736cfe690ef002b90b9ebbfaf2f7 | [
"MIT"
] | null | null | null | stacks_queues/queue_using_ll.cpp | ramchandra94/datastructures_in_cpp | 28274ff4f0d9736cfe690ef002b90b9ebbfaf2f7 | [
"MIT"
] | null | null | null | stacks_queues/queue_using_ll.cpp | ramchandra94/datastructures_in_cpp | 28274ff4f0d9736cfe690ef002b90b9ebbfaf2f7 | [
"MIT"
] | null | null | null | /************************************************************
Following is the structure of the node class
class Node {
public :
int data;
Node *next;
Node(int data) {
this->data = data;
next = NULL;
}
};
**************************************************************/
class Queue {
// Define the data members
Node *head;
Node *tail;
int size;
public:
Queue() {
// Implement the Constructor
head = NULL;
tail = NULL;
size = 0;
}
/*----------------- Public Functions of Stack -----------------*/
int getSize() {
// Implement the getSize() function
return size;
}
bool isEmpty() {
// Implement the isEmpty() function
return size == 0;
}
void enqueue(int data) {
// Implement the enqueue() function
Node * newNode = new Node(data);
if(head == NULL){
head = newNode;
tail = newNode;
}else{
tail -> next = newNode;
tail = tail -> next;
}
size++;
}
int dequeue() {
// Implement the dequeue() function
if(head == NULL){
return -1;
}
Node *temp = head;
head = head -> next;
size--;
int temp1 = temp -> data;
delete temp;
return temp1;
}
int front() {
// Implement the front() function
if(head == NULL){
return -1;
}
return head -> data;
}
}; | 19.921053 | 66 | 0.423382 | ramchandra94 |
e943e557728193cb6a24d56e908d51244119978e | 9,622 | cpp | C++ | vm/instruments/profiler.cpp | samleb/rubinius | 38eec1983b9b6739d7a552081e208aa433b99483 | [
"BSD-3-Clause"
] | 1 | 2016-05-09T10:45:38.000Z | 2016-05-09T10:45:38.000Z | vm/instruments/profiler.cpp | samleb/rubinius | 38eec1983b9b6739d7a552081e208aa433b99483 | [
"BSD-3-Clause"
] | null | null | null | vm/instruments/profiler.cpp | samleb/rubinius | 38eec1983b9b6739d7a552081e208aa433b99483 | [
"BSD-3-Clause"
] | null | null | null | #include "instruments/profiler.hpp"
#include "vm/object_utils.hpp"
#include "builtin/array.hpp"
#include "builtin/class.hpp"
#include "builtin/compiledmethod.hpp"
#include "builtin/integer.hpp"
#include "builtin/lookuptable.hpp"
#include "builtin/module.hpp"
#include "builtin/string.hpp"
#include "builtin/symbol.hpp"
#include "detection.hpp"
#include "arguments.hpp"
#include "dispatch.hpp"
#include "instruments/timing.hpp"
#include <time.h>
#include <iostream>
#include <vector>
#include <algorithm>
namespace rubinius {
namespace profiler {
bool Key::operator==(const Key& other) const {
return meth_ == other.meth_ &&
container_ == other.container_ &&
kind_ == other.kind_;
}
size_t Key::hash() const {
return (size_t)meth_ ^ (size_t)container_;
}
void Invocation::start() {
start_time_ = get_current_time();
}
void Invocation::stop() {
leaf_->add_total_time(get_current_time() - start_time_);
}
Method::~Method() {
for(Leaves::iterator i = leaves_.begin();
i != leaves_.end();
i++) {
delete i->second;
}
}
static uint64_t in_nanoseconds(uint64_t time) {
#ifdef USE_MACH_TIME
static mach_timebase_info_data_t timebase = {0, 0};
if(timebase.denom == 0) {
mach_timebase_info(&timebase);
}
return time * timebase.numer / timebase.denom;
#else
return time;
#endif
}
String* Method::name(STATE) {
const char *module = "";
const char *method_name = method()->c_str(state);
if(Symbol* klass = try_as<Symbol>(container())) {
module = klass->c_str(state);
}
String* name = String::create(state, module);
switch(kind()) {
case kNormal:
name->append(state, "#");
name->append(state, method_name);
break;
case kSingleton:
name->append(state, ".");
name->append(state, method_name);
break;
case kBlock:
name->append(state, "#");
name->append(state, method_name);
name->append(state, " {}");
break;
}
return name;
}
uint64_t Method::total_time_in_ns() {
return in_nanoseconds(total_time_);
}
uint64_t Leaf::total_time_in_ns() {
return in_nanoseconds(total_time_);
}
Leaf* Method::find_leaf(Method* callee) {
Leaves::iterator i = leaves_.find(callee);
if(i != leaves_.end()) {
return i->second;
}
Leaf* leaf = new Leaf(callee);
leaves_[callee] = leaf;
return leaf;
}
void Leaf::add_total_time(uint64_t diff) {
total_time_ += diff;
method_->add_total_time(diff);
}
Profiler::Profiler(STATE)
: state_(state)
{
top_ = new Method(0, 0, false);
current_ = top_;
}
Profiler::~Profiler() {
for(MethodMap::iterator i = methods_.begin();
i != methods_.end();
i++) {
delete i->second;
}
delete top_;
}
Symbol* Profiler::module_name(Module* module) {
if(IncludedModule* im = try_as<IncludedModule>(module)) {
return im->module()->name();
} else {
return module->name();
}
}
void Profiler::enter_block(Symbol* name, Module* module, CompiledMethod* cm) {
record_method(cm, name, module_name(module), kBlock);
}
void Profiler::enter_method(Dispatch& msg, Arguments& args) {
enter_method(msg, args, reinterpret_cast<CompiledMethod*>(Qnil));
}
void Profiler::enter_method(Dispatch &msg, Arguments& args, CompiledMethod* cm) {
if(MetaClass* mc = try_as<MetaClass>(msg.module)) {
Object* attached = mc->attached_instance();
if(Module* mod = try_as<Module>(attached)) {
record_method(cm, msg.name, mod->name(), kSingleton);
} else {
Symbol* name = args.recv()->to_s(state_)->to_sym(state_);
record_method(cm, msg.name, name, kSingleton);
}
} else {
record_method(cm, msg.name, module_name(msg.module), kNormal);
}
}
Method* Profiler::record_method(CompiledMethod* cm, Symbol* name,
Object* container, Kind kind) {
Key key(name, container, kind);
Method* method = find_key(key);
if(!method) {
method = new Method(methods_.size(), name, container, kind);
methods_[key] = method;
}
Leaf* leaf = current_->find_leaf(method);
current_ = method;
method->called();
if(!method->file() && !cm->nil_p()) {
method->set_position(cm->file(), cm->start_line(state_));
}
Invocation invoke(leaf);
invoke.start();
running_.push(invoke);
return method;
}
void Profiler::leave() {
// Depending on when we started profiling, there could be calls
// above the first time we entered a method, so ignore these.
if(running_.empty()) return;
Invocation& invoke = running_.top();
invoke.stop();
running_.pop();
if(running_.empty()) {
current_ = top_;
} else {
current_ = running_.top().leaf()->method();
}
}
size_t Profiler::number_of_entries() {
return methods_.size();
}
size_t Profiler::depth() {
return running_.size();
}
Method* Profiler::find_key(Key& key) {
return methods_[key];
}
// internal helper method
static Array* update_method(STATE, LookupTable* profile, Method* meth) {
LookupTable* methods = as<LookupTable>(profile->fetch(
state, state->symbol("methods")));
Symbol* total_sym = state->symbol("total");
Symbol* called_sym = state->symbol("called");
Symbol* leaves_sym = state->symbol("leaves");
LookupTable* method;
Fixnum* method_id = Fixnum::from(meth->id());
if((method = try_as<LookupTable>(methods->fetch(state, method_id)))) {
uint64_t total = as<Integer>(method->fetch(state, total_sym))->to_ulong_long();
method->store(state, total_sym,
Integer::from(state, total + meth->total_time_in_ns()));
size_t called = as<Fixnum>(method->fetch(state, called_sym))->to_native();
method->store(state, called_sym, Fixnum::from(called + meth->called_times()));
return as<Array>(method->fetch(state, leaves_sym));
} else {
method = LookupTable::create(state);
methods->store(state, method_id, method);
method->store(state, state->symbol("name"), meth->name(state));
method->store(state, total_sym, Integer::from(state, meth->total_time_in_ns()));
method->store(state, called_sym, Fixnum::from(meth->called_times()));
if(meth->file()) {
const char *file;
if(meth->file()->nil_p()) {
file = "unknown file";
} else {
file = meth->file()->c_str(state);
}
method->store(state, state->symbol("file"), String::create(state, file));
method->store(state, state->symbol("line"), Fixnum::from(meth->line()));
}
Array* leaves = Array::create(state, meth->number_of_leaves());
method->store(state, leaves_sym, leaves);
return leaves;
}
}
void Profiler::results(LookupTable* profile) {
std::vector<Method*> all_methods(0);
for(MethodMap::iterator i = methods_.begin();
i != methods_.end();
i++) {
all_methods.push_back(i->second);
}
for(std::vector<Method*>::iterator i = all_methods.begin();
i != all_methods.end();
i++) {
Method* meth = *i;
Array* leaves = update_method(state_, profile, meth);
size_t idx = 0;
for(Leaves::iterator li = meth->leaves_begin();
li != meth->leaves_end();
li++) {
Leaf* leaf = li->second;
Array* l = Array::create(state_, 2);
leaves->set(state_, idx++, l);
l->set(state_, 0, Fixnum::from(leaf->method()->id()));
l->set(state_, 1, Integer::from(state_, leaf->total_time_in_ns()));
}
}
}
ProfilerCollection::ProfilerCollection(STATE)
: profile_(state, (LookupTable*)Qnil)
{
LookupTable* profile = LookupTable::create(state);
LookupTable* methods = LookupTable::create(state);
profile->store(state, state->symbol("methods"), methods);
profile->store(state, state->symbol("method"),
String::create(state, TIMING_METHOD));
profile_.set(profile);
}
ProfilerCollection::~ProfilerCollection() {
for(ProfilerMap::iterator iter = profilers_.begin();
iter != profilers_.end();
iter++) {
iter->first->remove_profiler();
delete iter->second;
}
}
void ProfilerCollection::add_profiler(VM* vm, Profiler* profiler) {
profilers_[vm] = profiler;
}
void ProfilerCollection::remove_profiler(VM* vm, Profiler* profiler) {
ProfilerMap::iterator iter = profilers_.find(vm);
if(iter != profilers_.end()) {
Profiler* profiler = iter->second;
profiler->results(profile_.get());
iter->first->remove_profiler();
delete iter->second;
profilers_.erase(iter);
}
}
LookupTable* ProfilerCollection::results(STATE) {
LookupTable* profile = profile_.get();
for(ProfilerMap::iterator iter = profilers_.begin();
iter != profilers_.end();
iter++) {
iter->second->results(profile);
}
return profile;
}
}
}
| 27.104225 | 88 | 0.585429 | samleb |
e9470c962dfb222d6d049f4ae0f01c8ed0117873 | 1,960 | hpp | C++ | source/backend/cuda/core/BufferConvertor.hpp | zjd1988/mnn_cuda | d487534a2f6ffb0b98e3070a74682348e46ec4d1 | [
"Apache-2.0"
] | 1 | 2020-10-04T04:40:38.000Z | 2020-10-04T04:40:38.000Z | source/backend/cuda/core/BufferConvertor.hpp | zjd1988/mnn_cuda | d487534a2f6ffb0b98e3070a74682348e46ec4d1 | [
"Apache-2.0"
] | null | null | null | source/backend/cuda/core/BufferConvertor.hpp | zjd1988/mnn_cuda | d487534a2f6ffb0b98e3070a74682348e46ec4d1 | [
"Apache-2.0"
] | null | null | null | //
// ImageBufferConvertor.hpp
// MNN
//
// Created by MNN on 2019/01/31.
// Copyright © 2018, Alibaba Group Holding Limited
//
#ifndef BufferConvertor_hpp
#define BufferConvertor_hpp
#include "core/Macro.h"
#include <MNN/Tensor.hpp>
#include "backend/cuda/core/runtime/CUDARuntime.hpp"
#include "backend/cuda/core/CUDARunningUtils.hpp"
#include "backend/cuda/execution/kernel_impl/transpose_impl.cuh"
namespace MNN {
namespace CUDA {
/**
* @brief convert nchw buffer to image.
* @param input input tensor.
* @param output output tensor.
* @param bufferToImageKernel opencl kernel reference.
* @param runtime opencl runtime instance pointer.
* @param needWait whether need wait opencl complete before return or not, default false.
* @return true if success, false otherwise.
*/
bool convertFromNCHWBuffer(const Tensor *input, const Tensor *output, const MNN_DATA_FORMAT dstType,
CUDARuntime *runtime, bool needWait = false);
/**
* @brief convert from nhwc buffer to image.
* @param input input tensor.
* @param output output tensor.
* @param bufferToImageKernel opencl kernel reference.
* @param runtime opencl runtime instance pointer.
* @param needWait whether need wait opencl complete before return or not, default false.
* @return true if success, false otherwise.
*/
bool convertFromNHWCBuffer(const Tensor *input, const Tensor *output, const MNN_DATA_FORMAT dstType,
CUDARuntime *runtime, bool needWait = false);
class BufferConvertor {
public:
explicit BufferConvertor(CUDARuntime *cuda_runtime) : mCudaRuntime(cuda_runtime) {
}
bool convertBuffer(const Tensor *srcBuffer, const MNN_DATA_FORMAT srcType, Tensor *dstBuffer,
const MNN_DATA_FORMAT dstType, bool needWait = false);
private:
CUDARuntime *mCudaRuntime;
};
} // namespace CUDA
} // namespace MNN
#endif /* BufferConvertor_hpp */
| 33.220339 | 100 | 0.715816 | zjd1988 |
e94d1e020929f6c4c5f17fcd54f16ba1cadd18cf | 147 | cpp | C++ | test/CompileVariableTest.cpp | hzx/mutant2 | 5029d4ef59dca55819a98975b47554110913d62e | [
"MIT"
] | 1 | 2016-08-03T13:15:05.000Z | 2016-08-03T13:15:05.000Z | test/CompileVariableTest.cpp | hzx/mutant2 | 5029d4ef59dca55819a98975b47554110913d62e | [
"MIT"
] | null | null | null | test/CompileVariableTest.cpp | hzx/mutant2 | 5029d4ef59dca55819a98975b47554110913d62e | [
"MIT"
] | null | null | null | #include <gmock/gmock.h>
class CompileVariableTest: public ::testing::Test {
public:
};
TEST_F(CompileVariableTest, declaration) {
FAIL();
}
| 12.25 | 51 | 0.714286 | hzx |
e94e5a06f97fe5c203caaf0c930b74c4042a9d3d | 418 | cpp | C++ | 07.connect/connect.cpp | JackeyLea/Wayland_Freshman | e6467ad05642d433bcff252c14507b52e199835f | [
"MIT"
] | 7 | 2022-01-14T14:58:47.000Z | 2022-03-10T07:19:24.000Z | 07.connect/connect.cpp | JackeyLea/Wayland_Freshman | e6467ad05642d433bcff252c14507b52e199835f | [
"MIT"
] | 1 | 2022-01-28T03:14:03.000Z | 2022-01-28T03:14:03.000Z | 07.connect/connect.cpp | JackeyLea/Wayland_Freshman | e6467ad05642d433bcff252c14507b52e199835f | [
"MIT"
] | 2 | 2022-01-01T23:51:54.000Z | 2022-02-02T08:35:07.000Z | /////////////////////
// \author JackeyLea
// \date
// \note 测试能否正常链接wayland server
/////////////////////
#include <wayland-client.h>
#include <iostream>
using namespace std;
int main() {
wl_display *display = wl_display_connect(0);
if (!display) {
std::cout << "Unable to connect to wayland compositor" << std::endl;
return -1;
}
wl_display_disconnect(display);
return 0;
}
| 17.416667 | 76 | 0.57177 | JackeyLea |
e9549399459a47c49e73042e2a7f3a4bbca0f452 | 5,726 | cpp | C++ | code/scripting/api/objs/particle.cpp | trgswe/fs2open.github.com | a159eba0cebca911ad14a118412fddfe5be8e9f8 | [
"Unlicense"
] | null | null | null | code/scripting/api/objs/particle.cpp | trgswe/fs2open.github.com | a159eba0cebca911ad14a118412fddfe5be8e9f8 | [
"Unlicense"
] | null | null | null | code/scripting/api/objs/particle.cpp | trgswe/fs2open.github.com | a159eba0cebca911ad14a118412fddfe5be8e9f8 | [
"Unlicense"
] | null | null | null | //
//
#include "particle.h"
#include "vecmath.h"
#include "object.h"
namespace scripting {
namespace api {
particle_h::particle_h() {
}
particle_h::particle_h(const particle::WeakParticlePtr& part_p) {
this->part = part_p;
}
particle::WeakParticlePtr particle_h::Get() {
return this->part;
}
bool particle_h::isValid() {
return !part.expired();
}
//**********HANDLE: Particle
ADE_OBJ(l_Particle, particle_h, "particle", "Handle to a particle");
ADE_VIRTVAR(Position, l_Particle, "vector", "The current position of the particle (world vector)", "vector", "The current position")
{
particle_h *ph = NULL;
vec3d newVec = vmd_zero_vector;
if (!ade_get_args(L, "o|o", l_Particle.GetPtr(&ph), l_Vector.Get(&newVec)))
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
if (ph == NULL)
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
if (!ph->isValid())
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
if (ADE_SETTING_VAR)
{
ph->Get().lock()->pos = newVec;
}
return ade_set_args(L, "o", l_Vector.Set(ph->Get().lock()->pos));
}
ADE_VIRTVAR(Velocity, l_Particle, "vector", "The current velocity of the particle (world vector)", "vector", "The current velocity")
{
particle_h *ph = NULL;
vec3d newVec = vmd_zero_vector;
if (!ade_get_args(L, "o|o", l_Particle.GetPtr(&ph), l_Vector.Get(&newVec)))
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
if (ph == NULL)
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
if (!ph->isValid())
return ade_set_error(L, "o", l_Vector.Set(vmd_zero_vector));
if (ADE_SETTING_VAR)
{
ph->Get().lock()->velocity = newVec;
}
return ade_set_args(L, "o", l_Vector.Set(ph->Get().lock()->velocity));
}
ADE_VIRTVAR(Age, l_Particle, "number", "The time this particle already lives", "number", "The current age or -1 on error")
{
particle_h *ph = NULL;
float newAge = -1.0f;
if (!ade_get_args(L, "o|f", l_Particle.GetPtr(&ph), &newAge))
return ade_set_error(L, "f", -1.0f);
if (ph == NULL)
return ade_set_error(L, "f", -1.0f);
if (!ph->isValid())
return ade_set_error(L, "f", -1.0f);
if (ADE_SETTING_VAR)
{
if (newAge >= 0)
ph->Get().lock()->age = newAge;
}
return ade_set_args(L, "f", ph->Get().lock()->age);
}
ADE_VIRTVAR(MaximumLife, l_Particle, "number", "The time this particle can live", "number", "The maximal life or -1 on error")
{
particle_h *ph = NULL;
float newLife = -1.0f;
if (!ade_get_args(L, "o|f", l_Particle.GetPtr(&ph), &newLife))
return ade_set_error(L, "f", -1.0f);
if (ph == NULL)
return ade_set_error(L, "f", -1.0f);
if (!ph->isValid())
return ade_set_error(L, "f", -1.0f);
if (ADE_SETTING_VAR)
{
if (newLife >= 0)
ph->Get().lock()->max_life = newLife;
}
return ade_set_args(L, "f", ph->Get().lock()->max_life);
}
ADE_VIRTVAR(Looping, l_Particle, "boolean",
"The looping status of the particle. If a particle loops then it will not be removed when its max_life "
"value has been reached. Instead its animation will be reset to the start. When the particle should "
"finally be removed then set this to false and set MaxLife to 0.",
"boolean", "The looping status")
{
particle_h* ph = nullptr;
bool newloop = false;
if (!ade_get_args(L, "o|b", l_Particle.GetPtr(&ph), &newloop))
return ADE_RETURN_FALSE;
if (ph == nullptr)
return ADE_RETURN_FALSE;
if (!ph->isValid())
return ADE_RETURN_FALSE;
if (ADE_SETTING_VAR) {
ph->Get().lock()->looping = newloop;
}
return ade_set_args(L, "b", ph->Get().lock()->looping);
}
ADE_VIRTVAR(Radius, l_Particle, "number", "The radius of the particle", "number", "The radius or -1 on error")
{
particle_h *ph = NULL;
float newRadius = -1.0f;
if (!ade_get_args(L, "o|f", l_Particle.GetPtr(&ph), &newRadius))
return ade_set_error(L, "f", -1.0f);
if (ph == NULL)
return ade_set_error(L, "f", -1.0f);
if (!ph->isValid())
return ade_set_error(L, "f", -1.0f);
if (ADE_SETTING_VAR)
{
if (newRadius >= 0)
ph->Get().lock()->radius = newRadius;
}
return ade_set_args(L, "f", ph->Get().lock()->radius);
}
ADE_VIRTVAR(TracerLength, l_Particle, "number", "The tracer legth of the particle", "number", "The radius or -1 on error")
{
particle_h *ph = NULL;
float newTracer = -1.0f;
if (!ade_get_args(L, "o|f", l_Particle.GetPtr(&ph), &newTracer))
return ade_set_error(L, "f", -1.0f);
if (ph == NULL)
return ade_set_error(L, "f", -1.0f);
if (!ph->isValid())
return ade_set_error(L, "f", -1.0f);
// tracer_length has been deprecated
return ade_set_args(L, "f", -1.0f);
}
ADE_VIRTVAR(AttachedObject, l_Particle, "object", "The object this particle is attached to. If valid the position will be relative to this object and the velocity will be ignored.", "object", "Attached object or invalid object handle on error")
{
particle_h *ph = NULL;
object_h *newObj = nullptr;
if (!ade_get_args(L, "o|o", l_Particle.GetPtr(&ph), l_Object.GetPtr(&newObj)))
return ade_set_error(L, "o", l_Object.Set(object_h()));
if (ph == NULL)
return ade_set_error(L, "o", l_Object.Set(object_h()));
if (!ph->isValid())
return ade_set_error(L, "o", l_Object.Set(object_h()));
if (ADE_SETTING_VAR)
{
if (newObj != nullptr && newObj->IsValid())
ph->Get().lock()->attached_objnum = newObj->objp->signature;
}
return ade_set_object_with_breed(L, ph->Get().lock()->attached_objnum);
}
ADE_FUNC(isValid, l_Particle, NULL, "Detects whether this handle is valid", "boolean", "true if valid false if not")
{
particle_h *ph = NULL;
if (!ade_get_args(L, "o", l_Particle.GetPtr(&ph)))
return ADE_RETURN_FALSE;
if (ph == NULL)
return ADE_RETURN_FALSE;
return ade_set_args(L, "b", ph->isValid());
}
}
}
| 26.757009 | 244 | 0.66591 | trgswe |
e95541392cebc174ee7327107474cd9537ad9f6c | 29,193 | cpp | C++ | src/evm/src/instructions.cpp | Rayshard/ede-pl | 73298e21128ec4f5941c374bf7ebcd7f636e1c59 | [
"MIT"
] | 2 | 2021-10-17T07:10:00.000Z | 2021-10-17T09:38:57.000Z | src/evm/src/instructions.cpp | Rayshard/ede-pl | 73298e21128ec4f5941c374bf7ebcd7f636e1c59 | [
"MIT"
] | null | null | null | src/evm/src/instructions.cpp | Rayshard/ede-pl | 73298e21128ec4f5941c374bf7ebcd7f636e1c59 | [
"MIT"
] | null | null | null | #include "instructions.h"
#include <iostream>
#include "thread.h"
#include "vm.h"
namespace Instructions
{
namespace Error
{
std::runtime_error CompilationNotImplemented(const vm_byte* _instr) { return std::runtime_error("Instruction compilation not implemented: " + ToString(_instr)); }
}
void Execute(const NOOP* _instr, Thread* _thread) { return; }
void Execute(const CONVERT* _instr, Thread* _thread)
{
auto value = _thread->PopStack();
switch (_instr->from)
{
case DataType::I8: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_i8)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_i8)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_i8)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_i8)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_i8)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_i8)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_i8)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_i8)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_i8)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_i8)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::UI8: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_ui8)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_ui8)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_ui8)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_ui8)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_ui8)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_ui8)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_ui8)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_ui8)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_ui8)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_ui8)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::I16: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_i16)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_i16)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_i16)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_i16)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_i16)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_i16)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_i16)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_i16)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_i16)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_i16)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::UI16: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_ui16)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_ui16)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_ui16)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_ui16)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_ui16)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_ui16)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_ui16)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_ui16)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_ui16)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_ui16)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::I32: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_i32)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_i32)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_i32)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_i32)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_i32)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_i32)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_i32)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_i32)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_i32)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_i32)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::UI32: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_ui32)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_ui32)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_ui32)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_ui32)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_ui32)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_ui32)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_ui32)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_ui32)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_ui32)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_ui32)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::I64: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_i64)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_i64)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_i64)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_i64)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_i64)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_i64)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_i64)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_i64)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_i64)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_i64)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::UI64: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_ui64)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_ui64)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_ui64)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_ui64)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_ui64)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_ui64)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_ui64)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_ui64)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_ui64)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_ui64)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::F32: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_f32)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_f32)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_f32)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_f32)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_f32)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_f32)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_f32)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_f32)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_f32)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_f32)); break;
default: assert(false && "Case not handled");
}
} break;
case DataType::F64: {
switch (_instr->to)
{
case DataType::I8: _thread->PushStack(vm_i8(value.as_f64)); break;
case DataType::UI8: _thread->PushStack(vm_ui8(value.as_f64)); break;
case DataType::I16: _thread->PushStack(vm_i16(value.as_f64)); break;
case DataType::UI16: _thread->PushStack(vm_ui16(value.as_f64)); break;
case DataType::I32: _thread->PushStack(vm_i32(value.as_f64)); break;
case DataType::UI32: _thread->PushStack(vm_ui32(value.as_f64)); break;
case DataType::I64: _thread->PushStack(vm_i64(value.as_f64)); break;
case DataType::UI64: _thread->PushStack(vm_ui64(value.as_f64)); break;
case DataType::F32: _thread->PushStack(vm_f32(value.as_f64)); break;
case DataType::F64: _thread->PushStack(vm_f64(value.as_f64)); break;
default: assert(false && "Case not handled");
}
} break;
default: assert(false && "Case not handled");
}
}
void Execute(const SYSCALL* _instr, Thread* _thread)
{
if ((vm_byte)_instr->code >= (vm_byte)SysCallCode::_COUNT)
throw VMError::UNKNOWN_SYSCALL_CODE((vm_byte)_instr->code);
switch (_instr->code)
{
case SysCallCode::EXIT: { _thread->GetVM()->Quit(_thread->PopStack().as_i64); } break;
case SysCallCode::PRINTC: { _thread->GetVM()->GetStdOut() << _thread->PopStack().as_byte; } break;
case SysCallCode::MALLOC: { _thread->PushStack(_thread->GetVM()->GetHeap().Alloc(_thread->PopStack().as_ui64)); } break;
case SysCallCode::FREE: { _thread->GetVM()->GetHeap().Free(_thread->PopStack().as_ptr); } break;
default: assert(false && "Case not handled");
}
}
void Execute(const ADD* _instr, Thread* _thread)
{
auto left = _thread->PopStack(), right = _thread->PopStack();
switch (_instr->type)
{
case DataType::I8: _thread->PushStack(Word(vm_i8(left.as_i8 + right.as_i8))); break;
case DataType::UI8: _thread->PushStack(Word(vm_ui8(left.as_ui8 + right.as_ui8))); break;
case DataType::I16: _thread->PushStack(Word(vm_i16(left.as_i16 + right.as_i16))); break;
case DataType::UI16: _thread->PushStack(Word(vm_ui16(left.as_ui16 + right.as_ui16))); break;
case DataType::I32: _thread->PushStack(Word(left.as_i32 + right.as_i32)); break;
case DataType::UI32: _thread->PushStack(Word(left.as_ui32 + right.as_ui32)); break;
case DataType::I64: _thread->PushStack(Word(left.as_i64 + right.as_i64)); break;
case DataType::UI64: _thread->PushStack(Word(left.as_ui64 + right.as_ui64)); break;
case DataType::F32: _thread->PushStack(Word(left.as_f32 + right.as_f32)); break;
case DataType::F64: _thread->PushStack(Word(left.as_f64 + right.as_f64)); break;
default: assert(false && "Case not handled");
}
}
void Execute(const SUB* _instr, Thread* _thread)
{
auto left = _thread->PopStack(), right = _thread->PopStack();
switch (_instr->type)
{
case DataType::I8: _thread->PushStack(Word(vm_i8(left.as_i8 - right.as_i8))); break;
case DataType::UI8: _thread->PushStack(Word(vm_ui8(left.as_ui8 - right.as_ui8))); break;
case DataType::I16: _thread->PushStack(Word(vm_i16(left.as_i16 - right.as_i16))); break;
case DataType::UI16: _thread->PushStack(Word(vm_ui16(left.as_ui16 - right.as_ui16))); break;
case DataType::I32: _thread->PushStack(Word(left.as_i32 - right.as_i32)); break;
case DataType::UI32: _thread->PushStack(Word(left.as_ui32 - right.as_ui32)); break;
case DataType::I64: _thread->PushStack(Word(left.as_i64 - right.as_i64)); break;
case DataType::UI64: _thread->PushStack(Word(left.as_ui64 - right.as_ui64)); break;
case DataType::F32: _thread->PushStack(Word(left.as_f32 - right.as_f32)); break;
case DataType::F64: _thread->PushStack(Word(left.as_f64 - right.as_f64)); break;
default: assert(false && "Case not handled");
}
}
void Execute(const MUL* _instr, Thread* _thread)
{
auto left = _thread->PopStack(), right = _thread->PopStack();
switch (_instr->type)
{
case DataType::I8: _thread->PushStack(Word(vm_i8(left.as_i8 * right.as_i8))); break;
case DataType::UI8: _thread->PushStack(Word(vm_ui8(left.as_ui8 * right.as_ui8))); break;
case DataType::I16: _thread->PushStack(Word(vm_i16(left.as_i16 * right.as_i16))); break;
case DataType::UI16: _thread->PushStack(Word(vm_ui16(left.as_ui16 * right.as_ui16))); break;
case DataType::I32: _thread->PushStack(Word(left.as_i32 * right.as_i32)); break;
case DataType::UI32: _thread->PushStack(Word(left.as_ui32 * right.as_ui32)); break;
case DataType::I64: _thread->PushStack(Word(left.as_i64 * right.as_i64)); break;
case DataType::UI64: _thread->PushStack(Word(left.as_ui64 * right.as_ui64)); break;
case DataType::F32: _thread->PushStack(Word(left.as_f32 * right.as_f32)); break;
case DataType::F64: _thread->PushStack(Word(left.as_f64 * right.as_f64)); break;
default: assert(false && "Case not handled");
}
}
void Execute(const DIV* _instr, Thread* _thread)
{
auto left = _thread->PopStack(), right = _thread->PopStack();
switch (_instr->type)
{
case DataType::I8: {
if (right.as_i8 == vm_i8(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(vm_i8(left.as_i8 / right.as_i8)));
} break;
case DataType::UI8: {
if (right.as_ui8 == vm_ui8(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(vm_ui8(left.as_ui8 / right.as_ui8)));
} break;
case DataType::I16: {
if (right.as_i16 == vm_i16(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(vm_i16(left.as_i16 / right.as_i16)));
} break;
case DataType::UI16: {
if (right.as_ui16 == vm_ui16(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(vm_ui16(left.as_ui16 / right.as_ui16)));
} break;
case DataType::I32: {
if (right.as_i32 == vm_i32(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(left.as_i32 / right.as_i32));
} break;
case DataType::UI32: {
if (right.as_ui32 == vm_ui32(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(left.as_ui32 / right.as_ui32));
} break;
case DataType::I64: {
if (right.as_i64 == vm_i64(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(left.as_i64 / right.as_i64));
} break;
case DataType::UI64: {
if (right.as_ui64 == vm_ui64(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(left.as_ui64 / right.as_ui64));
} break;
case DataType::F32: {
if (right.as_f32 == vm_f32(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(left.as_f32 / right.as_f32));
} break;
case DataType::F64: {
if (right.as_f64 == vm_f64(0))
throw VMError::DIV_BY_ZERO();
_thread->PushStack(Word(left.as_f64 / right.as_f64));
} break;
default: assert(false && "Case not handled");
}
}
void Execute(const EQ* _instr, Thread* _thread)
{
auto left = _thread->PopStack(), right = _thread->PopStack();
switch (_instr->type)
{
case DataType::I8: _thread->PushStack(Word(left.as_i8 == right.as_i8)); break;
case DataType::UI8: _thread->PushStack(Word(left.as_ui8 == right.as_ui8)); break;
case DataType::I16: _thread->PushStack(Word(left.as_i16 == right.as_i16)); break;
case DataType::UI16: _thread->PushStack(Word(left.as_ui16 == right.as_ui16)); break;
case DataType::I32: _thread->PushStack(Word(left.as_i32 == right.as_i32)); break;
case DataType::UI32: _thread->PushStack(Word(left.as_ui32 == right.as_ui32)); break;
case DataType::I64: _thread->PushStack(Word(left.as_i64 == right.as_i64)); break;
case DataType::UI64: _thread->PushStack(Word(left.as_ui64 == right.as_ui64)); break;
case DataType::F32: _thread->PushStack(Word(left.as_f32 == right.as_f32)); break;
case DataType::F64: _thread->PushStack(Word(left.as_f64 == right.as_f64)); break;
default: assert(false && "Case not handled");
}
}
void Execute(const NEQ* _instr, Thread* _thread)
{
auto left = _thread->PopStack(), right = _thread->PopStack();
switch (_instr->type)
{
case DataType::I8: _thread->PushStack(Word(left.as_i8 != right.as_i8)); break;
case DataType::UI8: _thread->PushStack(Word(left.as_ui8 != right.as_ui8)); break;
case DataType::I16: _thread->PushStack(Word(left.as_i16 != right.as_i16)); break;
case DataType::UI16: _thread->PushStack(Word(left.as_ui16 != right.as_ui16)); break;
case DataType::I32: _thread->PushStack(Word(left.as_i32 != right.as_i32)); break;
case DataType::UI32: _thread->PushStack(Word(left.as_ui32 != right.as_ui32)); break;
case DataType::I64: _thread->PushStack(Word(left.as_i64 != right.as_i64)); break;
case DataType::UI64: _thread->PushStack(Word(left.as_ui64 != right.as_ui64)); break;
case DataType::F32: _thread->PushStack(Word(left.as_f32 != right.as_f32)); break;
case DataType::F64: _thread->PushStack(Word(left.as_f64 != right.as_f64)); break;
default: assert(false && "Case not handled");
}
}
void Execute(const JUMP* _instr, Thread* _thread) { _thread->instrPtr = _instr->target - _instr->GetSize(); }
void Execute(const JUMPNZ* _instr, Thread* _thread)
{
if (!_thread->PopStack().AsBool())
return;
_thread->instrPtr = _instr->target - _instr->GetSize();
}
void Execute(const JUMPZ* _instr, Thread* _thread)
{
if (_thread->PopStack().AsBool())
return;
_thread->instrPtr = _instr->target - _instr->GetSize();
}
void Execute(const CALL* _instr, Thread* _thread)
{
_thread->PushStack((vm_byte*)(_thread->instrPtr + _instr->GetSize())); //Push return value
_thread->PushFrame(); //Push current frame pointer and set the frame pointer for new frame
_thread->OffsetSP(_instr->storage); //Allocate space of stack for function local storage
_thread->instrPtr = _instr->target - _instr->GetSize(); //Jump to target
}
void Execute(const RET* _instr, Thread* _thread)
{
_thread->PopFrame(); //Clear current frame and restore previous frame pointer
_thread->instrPtr = _thread->PopStack().as_ptr - _instr->GetSize(); //Jump to instruction after most recent call
}
void Execute(const RETV* _instr, Thread* _thread)
{
Word retValue = _thread->PopStack(); //Pop off return value
_thread->PopFrame(); //Clear current frame and restore previous frame pointer
_thread->instrPtr = _thread->PopStack().as_ptr - _instr->GetSize(); //Jump to instruction after most recent call
_thread->PushStack(retValue); //Push return value
}
void Execute(const PUSH* _instr, Thread* _thread) { _thread->PushStack(_instr->value); }
void Execute(const POP* _instr, Thread* _thread) { _thread->PopStack(); }
void Execute(const LLOAD* _instr, Thread* _thread) { _thread->PushStack(_thread->ReadStack<Word>(_thread->GetFP() + _instr->idx * WORD_SIZE)); }
void Execute(const LSTORE* _instr, Thread* _thread) { _thread->WriteStack(_thread->GetFP() + _instr->idx * WORD_SIZE, _thread->PopStack()); }
void Execute(const PLOAD* _instr, Thread* _thread) { _thread->PushStack(_thread->ReadStack<Word>(_thread->GetFP() - WORD_SIZE * 2 - (_instr->idx + 1) * WORD_SIZE)); }
void Execute(const PSTORE* _instr, Thread* _thread) { _thread->WriteStack(_thread->GetFP() - WORD_SIZE * 2 - (_instr->idx + 1) * WORD_SIZE, _thread->PopStack()); }
void Execute(const SLOAD* _instr, Thread* _thread) { _thread->PushStack(_thread->ReadStack<Word>(_thread->GetSP() + _instr->offset)); }
void Execute(const SSTORE* _instr, Thread* _thread)
{
auto value = _thread->PopStack();
_thread->WriteStack(_thread->GetSP() + _instr->offset, value);
}
void Execute(const MLOAD* _instr, Thread* _thread)
{
vm_byte* addr = _thread->PopStack().as_ptr + _instr->offset;
if (!_thread->GetVM()->GetHeap().IsAddressRange(addr, addr + WORD_SIZE - 1))
throw VMError::INVALID_MEM_ACCESS(addr, addr + WORD_SIZE - 1);
_thread->PushStack(*(Word*)addr);
}
void Execute(const MSTORE* _instr, Thread* _thread)
{
vm_byte* addr = _thread->PopStack().as_ptr + _instr->offset;
Word value = _thread->PopStack();
if (!_thread->GetVM()->GetHeap().IsAddressRange(addr, addr + WORD_SIZE - 1))
throw VMError::INVALID_MEM_ACCESS(addr, addr + WORD_SIZE - 1);
*(Word*)addr = value;
}
void Execute(const vm_byte* _instr, Thread* _thread)
{
switch ((OpCode)*_instr)
{
case OpCode::NOOP: Execute(NOOP::From(_instr), _thread); break;
case OpCode::PUSH: Execute(PUSH::From(_instr), _thread); break;
case OpCode::POP: Execute(POP::From(_instr), _thread); break;
case OpCode::ADD: Execute(ADD::From(_instr), _thread); break;
case OpCode::SUB: Execute(SUB::From(_instr), _thread); break;
case OpCode::MUL: Execute(MUL::From(_instr), _thread); break;
case OpCode::DIV: Execute(DIV::From(_instr), _thread); break;
case OpCode::EQ: Execute(EQ::From(_instr), _thread); break;
case OpCode::NEQ: Execute(NEQ::From(_instr), _thread); break;
case OpCode::JUMP: Execute(JUMP::From(_instr), _thread); break;
case OpCode::JUMPZ: Execute(JUMPZ::From(_instr), _thread); break;
case OpCode::JUMPNZ: Execute(JUMPNZ::From(_instr), _thread); break;
case OpCode::SYSCALL: Execute(SYSCALL::From(_instr), _thread); break;
case OpCode::SLOAD: Execute(SLOAD::From(_instr), _thread); break;
case OpCode::SSTORE: Execute(SSTORE::From(_instr), _thread); break;
case OpCode::LLOAD: Execute(LLOAD::From(_instr), _thread); break;
case OpCode::LSTORE: Execute(LSTORE::From(_instr), _thread); break;
case OpCode::PLOAD: Execute(PLOAD::From(_instr), _thread); break;
case OpCode::PSTORE: Execute(PSTORE::From(_instr), _thread); break;
case OpCode::MLOAD: Execute(MLOAD::From(_instr), _thread); break;
case OpCode::MSTORE: Execute(MSTORE::From(_instr), _thread); break;
case OpCode::CONVERT: Execute(CONVERT::From(_instr), _thread); break;
case OpCode::CALL: Execute(CALL::From(_instr), _thread); break;
case OpCode::RET: Execute(RET::From(_instr), _thread); break;
case OpCode::RETV: Execute(RETV::From(_instr), _thread); break;
default: assert(false && "Case not handled");
}
}
std::string ToString(DataType _dt)
{
switch (_dt)
{
case DataType::I8: return "I8";
case DataType::UI8: return "UI8";
case DataType::I16: return "I16";
case DataType::UI16: return "UI16";
case DataType::I32: return "I32";
case DataType::UI32: return "UI32";
case DataType::I64: return "I64";
case DataType::UI64: return "UI64";
case DataType::F32: return "F32";
case DataType::F64: return "F64";
default: assert(false && "Case not handled");
}
return "";
}
std::string ToString(const vm_byte* _instr)
{
switch ((OpCode)*_instr)
{
case OpCode::NOOP: return "NOOP";
case OpCode::POP: return "POP";
case OpCode::RET: return "RET";
case OpCode::RETV: return "RETV";
case OpCode::CONVERT: return "CONVERT " + ToString(CONVERT::From(_instr)->from) + " " + ToString(CONVERT::From(_instr)->to);
case OpCode::ADD: return "ADD " + ToString(ADD::From(_instr)->type);
case OpCode::SUB: return "SUB " + ToString(SUB::From(_instr)->type);
case OpCode::MUL: return "MUL " + ToString(MUL::From(_instr)->type);
case OpCode::DIV: return "DIV " + ToString(DIV::From(_instr)->type);
case OpCode::EQ: return "EQ " + ToString(EQ::From(_instr)->type);
case OpCode::NEQ: return "NEQ " + ToString(NEQ::From(_instr)->type);
case OpCode::PUSH: return "PUSH " + Hex(PUSH::From(_instr)->value);
case OpCode::JUMP: return "JUMP " + Hex(JUMP::From(_instr)->target);
case OpCode::JUMPNZ: return "JUMPNZ " + Hex(JUMPNZ::From(_instr)->target);
case OpCode::JUMPZ: return "JUMPZ " + Hex(JUMPZ::From(_instr)->target);
case OpCode::CALL: return "CALL " + Hex(CALL::From(_instr)->target) + " " + std::to_string(CALL::From(_instr)->storage);
case OpCode::SYSCALL:
{
switch (SYSCALL::From(_instr)->code)
{
case SysCallCode::EXIT: return "SYSCALL EXIT";
case SysCallCode::PRINTC: return "SYSCALL PRINTC";
case SysCallCode::MALLOC: return "SYSCALL MALLOC";
case SysCallCode::FREE: return "SYSCALL FREE";
default: assert(false && "Case not handled");
}
} break;
case OpCode::SLOAD: return "SLOAD " + std::to_string(SLOAD::From(_instr)->offset);
case OpCode::SSTORE: return "SSTORE " + std::to_string(SSTORE::From(_instr)->offset);
case OpCode::LLOAD: return "LLOAD " + std::to_string(LLOAD::From(_instr)->idx);
case OpCode::LSTORE: return "LSTORE " + std::to_string(LSTORE::From(_instr)->idx);
case OpCode::PLOAD: return "PLOAD " + std::to_string(PLOAD::From(_instr)->idx);
case OpCode::PSTORE: return "PSTORE " + std::to_string(PSTORE::From(_instr)->idx);
case OpCode::MLOAD: return "MLOAD " + std::to_string(MLOAD::From(_instr)->offset);
case OpCode::MSTORE: return "MSTORE " + std::to_string(MSTORE::From(_instr)->offset);
default: assert(false && "Case not handled");
}
return "";
}
void ToNASM(const vm_byte* _instr, std::ostream& _stream, const std::string& _indent)
{
_stream << _indent << ToString(_instr) << "\n";
switch ((OpCode)*_instr)
{
case OpCode::PUSH:
{
_stream << _indent << "mov rax, " << Hex(PUSH::From(_instr)->value) << "\n";
_stream << _indent << "push rax";
} break;
case OpCode::NOOP: { _stream << _indent << "mov rax, rax"; } break;
case OpCode::SYSCALL:
{
switch (SYSCALL::From(_instr)->code)
{
case SysCallCode::EXIT:
{
_stream << _indent << "pop rdi\n";
_stream << _indent << "mov rax, 0x02000001\n";
_stream << _indent << "syscall";
} break;
default: throw Error::CompilationNotImplemented(_instr);
}
} break;
case OpCode::POP: { _stream << _indent << "pop rax"; } break;
default:
throw Error::CompilationNotImplemented(_instr);
}
}
} | 50.858885 | 170 | 0.609153 | Rayshard |
e959cabacfd844292fb49a13e989bebb56ff73ab | 2,536 | hpp | C++ | irohad/simulator/impl/simulator.hpp | laSinteZ/iroha | 78f152a85ee2b3b86db7b705831938e96a186c36 | [
"Apache-2.0"
] | 1 | 2017-01-15T08:47:16.000Z | 2017-01-15T08:47:16.000Z | irohad/simulator/impl/simulator.hpp | laSinteZ/iroha | 78f152a85ee2b3b86db7b705831938e96a186c36 | [
"Apache-2.0"
] | 1 | 2017-11-08T02:34:24.000Z | 2017-11-08T02:34:24.000Z | irohad/simulator/impl/simulator.hpp | laSinteZ/iroha | 78f152a85ee2b3b86db7b705831938e96a186c36 | [
"Apache-2.0"
] | null | null | null | /**
* Copyright Soramitsu Co., Ltd. 2017 All Rights Reserved.
* http://soramitsu.co.jp
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef IROHA_SIMULATOR_HPP
#define IROHA_SIMULATOR_HPP
#include <nonstd/optional.hpp>
#include "ametsuchi/block_query.hpp"
#include "ametsuchi/temporary_factory.hpp"
#include "model/model_crypto_provider.hpp"
#include "network/ordering_gate.hpp"
#include "simulator/block_creator.hpp"
#include "simulator/verified_proposal_creator.hpp"
#include "validation/stateful_validator.hpp"
#include "logger/logger.hpp"
namespace iroha {
namespace simulator {
class Simulator : public VerifiedProposalCreator, public BlockCreator {
public:
Simulator(
std::shared_ptr<network::OrderingGate> ordering_gate,
std::shared_ptr<validation::StatefulValidator> statefulValidator,
std::shared_ptr<ametsuchi::TemporaryFactory> factory,
std::shared_ptr<ametsuchi::BlockQuery> blockQuery,
std::shared_ptr<model::ModelCryptoProvider> crypto_provider);
Simulator(const Simulator&) = delete;
Simulator& operator=(const Simulator&) = delete;
void process_proposal(model::Proposal proposal) override;
rxcpp::observable<model::Proposal> on_verified_proposal() override;
void process_verified_proposal(model::Proposal proposal) override;
rxcpp::observable<model::Block> on_block() override;
private:
// internal
rxcpp::subjects::subject<model::Proposal> notifier_;
rxcpp::subjects::subject<model::Block> block_notifier_;
std::shared_ptr<validation::StatefulValidator> validator_;
std::shared_ptr<ametsuchi::TemporaryFactory> ametsuchi_factory_;
std::shared_ptr<ametsuchi::BlockQuery> block_queries_;
std::shared_ptr<model::ModelCryptoProvider> crypto_provider_;
logger::Logger log_;
// last block
nonstd::optional<model::Block> last_block;
};
} // namespace simulator
} // namespace iroha
#endif // IROHA_SIMULATOR_HPP
| 34.27027 | 75 | 0.733438 | laSinteZ |
e95fe8742377c9e199a0879f3de49ca9187d874a | 4,657 | hpp | C++ | SRA/LIB/SHELL/LIB/hls/NAL/src/hss.hpp | cloudFPGA/cFDK | 9f52e5073391bd436284b285c58907d7ba35f955 | [
"Apache-2.0"
] | 2 | 2022-01-03T21:03:43.000Z | 2022-01-22T21:36:04.000Z | SRA/LIB/SHELL/LIB/hls/NAL/src/hss.hpp | cloudFPGA/cFDK | 9f52e5073391bd436284b285c58907d7ba35f955 | [
"Apache-2.0"
] | null | null | null | SRA/LIB/SHELL/LIB/hls/NAL/src/hss.hpp | cloudFPGA/cFDK | 9f52e5073391bd436284b285c58907d7ba35f955 | [
"Apache-2.0"
] | 1 | 2022-01-28T08:37:03.000Z | 2022-01-28T08:37:03.000Z | /*******************************************************************************
* Copyright 2016 -- 2021 IBM Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
/*****************************************************************************
* @file : hss.hpp
* @brief : The Housekeeping Sub System (HSS) of the NAL core.
*
* System: : cloudFPGA
* Component : Shell, Network Abstraction Layer (NAL)
* Language : Vivado HLS
*
* \ingroup NAL
* \addtogroup NAL
* \{
*****************************************************************************/
#ifndef _NAL_HSS_H_
#define _NAL_HSS_H_
#include <stdio.h>
#include <iostream>
#include <fstream>
#include <string>
#include <math.h>
#include <hls_stream.h>
#include "ap_int.h"
#include <stdint.h>
#include "nal.hpp"
using namespace hls;
void axi4liteProcessing(
ap_uint<32> ctrlLink[MAX_MRT_SIZE + NUMBER_CONFIG_WORDS + NUMBER_STATUS_WORDS],
//stream<NalConfigUpdate> &sToTcpAgency, //(currently not used)
stream<NalConfigUpdate> &sToPortLogic,
stream<NalConfigUpdate> &sToUdpRx,
stream<NalConfigUpdate> &sToTcpRx,
stream<NalConfigUpdate> &sToStatusProc,
stream<NalMrtUpdate> &sMrtUpdate,
//ap_uint<32> localMRT[MAX_MRT_SIZE],
stream<uint32_t> &mrt_version_update_0,
stream<uint32_t> &mrt_version_update_1,
stream<NalStatusUpdate> &sStatusUpdate
);
void pMrtAgency(
//const ap_uint<32> localMRT[MAX_MRT_SIZE],
stream<NalMrtUpdate> &sMrtUpdate,
stream<NodeId> &sGetIpReq_UdpTx,
stream<Ip4Addr> &sGetIpRep_UdpTx,
stream<NodeId> &sGetIpReq_TcpTx,
stream<Ip4Addr> &sGetIpRep_TcpTx,
stream<Ip4Addr> &sGetNidReq_UdpRx,
stream<NodeId> &sGetNidRep_UdpRx,
stream<Ip4Addr> &sGetNidReq_TcpRx,
stream<NodeId> &sGetNidRep_TcpRx//,
//stream<Ip4Addr> &sGetNidReq_TcpTx,
//stream<NodeId> &sGetNidRep_TcpTx
);
void pPortLogic(
ap_uint<1> *layer_4_enabled,
ap_uint<1> *layer_7_enabled,
ap_uint<1> *role_decoupled,
ap_uint<1> *piNTS_ready,
ap_uint<16> *piMMIO_FmcLsnPort,
ap_uint<32> *pi_udp_rx_ports,
ap_uint<32> *pi_tcp_rx_ports,
stream<NalConfigUpdate> &sConfigUpdate,
stream<UdpPort> &sUdpPortsToOpen,
stream<UdpPort> &sUdpPortsToClose,
stream<TcpPort> &sTcpPortsToOpen,
stream<bool> &sUdpPortsOpenFeedback,
stream<bool> &sTcpPortsOpenFeedback,
stream<bool> &sMarkToDel_unpriv,
stream<NalPortUpdate> &sPortUpdate,
stream<bool> &sStartTclCls
);
void pCacheInvalDetection(
ap_uint<1> *layer_4_enabled,
ap_uint<1> *layer_7_enabled,
ap_uint<1> *role_decoupled,
ap_uint<1> *piNTS_ready,
stream<uint32_t> &mrt_version_update,
stream<bool> &inval_del_sig,
stream<bool> &cache_inval_0,
stream<bool> &cache_inval_1,
stream<bool> &cache_inval_2, //MUST be connected to TCP
stream<bool> &cache_inval_3 //MUST be connected to TCP
);
void pTcpAgency(
stream<SessionId> &sGetTripleFromSid_Req,
stream<NalTriple> &sGetTripleFromSid_Rep,
stream<NalTriple> &sGetSidFromTriple_Req,
stream<SessionId> &sGetSidFromTriple_Rep,
stream<NalNewTableEntry> &sAddNewTriple_TcpRrh,
stream<NalNewTableEntry> &sAddNewTriple_TcpCon,
stream<SessionId> &sDeleteEntryBySid,
stream<bool> &inval_del_sig,
stream<SessionId> &sMarkAsPriv,
stream<bool> &sMarkToDel_unpriv,
stream<bool> &sGetNextDelRow_Req,
stream<SessionId> &sGetNextDelRow_Rep
);
#endif
/*! \} */
| 35.549618 | 85 | 0.579987 | cloudFPGA |
e9605dde96f17d5d1f28fae32ccb8114647a6658 | 2,958 | hpp | C++ | src/cpu/x64/jit_uni_quantization_injector.hpp | IvanNovoselov/oneDNN | aa47fcd2a03ee5caac119b6417bc66abe3154aab | [
"Apache-2.0"
] | null | null | null | src/cpu/x64/jit_uni_quantization_injector.hpp | IvanNovoselov/oneDNN | aa47fcd2a03ee5caac119b6417bc66abe3154aab | [
"Apache-2.0"
] | null | null | null | src/cpu/x64/jit_uni_quantization_injector.hpp | IvanNovoselov/oneDNN | aa47fcd2a03ee5caac119b6417bc66abe3154aab | [
"Apache-2.0"
] | 1 | 2021-03-10T17:25:36.000Z | 2021-03-10T17:25:36.000Z | /*******************************************************************************
* Copyright 2019-2020 Intel Corporation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*******************************************************************************/
#ifndef CPU_X64_JIT_UNI_QUANTIZATION_INJECTOR_HPP
#define CPU_X64_JIT_UNI_QUANTIZATION_INJECTOR_HPP
#include <assert.h>
#include "common/c_types_map.hpp"
#include "common/primitive_attr.hpp"
#include "common/type_helpers.hpp"
#include "common/utils.hpp"
#include "cpu/x64/jit_generator.hpp"
namespace dnnl {
namespace impl {
namespace cpu {
namespace x64 {
template <cpu_isa_t isa, typename Vmm = typename cpu_isa_traits<isa>::Vmm>
struct jit_uni_quantization_injector_f32 {
jit_uni_quantization_injector_f32(jit_generator* host, dnnl_post_ops::entry_t post_op,
Vmm vmm_d_weights, Vmm vmm_d_bias, Xbyak::Reg64 reg_d_weights, Xbyak::Reg64 reg_d_bias)
: h(host), post_op_(post_op), vmm_d_weights_(vmm_d_weights), vmm_d_bias_(vmm_d_bias), reg_d_weights_(reg_d_weights), reg_d_bias_(reg_d_bias) {
assert(post_op.is_quantization());
assert(utils::one_of(post_op.quantization.alg, alg_kind::quantization_quantize, alg_kind::quantization_quantize_dequantize));
do_dequantization = post_op_.quantization.alg == alg_kind::quantization_quantize_dequantize;
xmm_d_weights_ = Xbyak::Xmm(vmm_d_weights.getIdx());
xmm_d_bias_ = Xbyak::Xmm(vmm_d_bias.getIdx());
}
void init_crop_ptrs(const Xbyak::Operand& ch_off);
void init_input_scale_shift_ptrs(const Xbyak::Operand& ch_off);
void init_output_scale_shift_ptrs(const Xbyak::Operand& ch_off);
void compute_crop(int start_idx, int end_idx, int offset, bool is_scalar = false, bool is_broadcast = false);
void compute_input_scale_shift(int start_idx, int end_idx, int offset, bool do_rounding, bool is_scalar = false, bool is_broadcast = false);
void compute_output_scale_shift(int start_idx, int end_idx, int offset, bool is_scalar = false, bool is_broadcast = false);
private:
jit_generator* h;
size_t vlen = cpu_isa_traits<isa>::vlen;
dnnl_post_ops::entry_t post_op_;
Vmm vmm_d_weights_;
Vmm vmm_d_bias_;
Xbyak::Xmm xmm_d_weights_;
Xbyak::Xmm xmm_d_bias_;
Xbyak::Reg64 reg_d_weights_;
Xbyak::Reg64 reg_d_bias_;
bool do_dequantization;
};
} // namespace x64
} // namespace cpu
} // namespace impl
} // namespace dnnl
#endif
| 36.975 | 150 | 0.7167 | IvanNovoselov |