blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
264
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
85
| license_type
stringclasses 2
values | repo_name
stringlengths 5
140
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 905
values | visit_date
timestamp[us]date 2015-08-09 11:21:18
2023-09-06 10:45:07
| revision_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-17 19:19:19
| committer_date
timestamp[us]date 1997-09-14 05:04:47
2023-09-06 06:22:19
| github_id
int64 3.89k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-07 00:51:45
2023-09-14 21:58:39
⌀ | gha_created_at
timestamp[us]date 2008-03-27 23:40:48
2023-08-21 23:17:38
⌀ | gha_language
stringclasses 141
values | src_encoding
stringclasses 34
values | language
stringclasses 1
value | is_vendor
bool 1
class | is_generated
bool 2
classes | length_bytes
int64 3
10.4M
| extension
stringclasses 115
values | content
stringlengths 3
10.4M
| authors
sequencelengths 1
1
| author_id
stringlengths 0
158
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
a9051f4b904cfd79f42868f92c804039679c4f23 | 299648a8c633728662d0b7651cd98afdc28db902 | /src/thirdparty/cefbinary_72/libcef_dll/cpptoc/v8interceptor_cpptoc.h | 57b1f027689b8829ea2d8310acb144de3fd148b5 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown"
] | permissive | aardvarkxr/aardvark | 2978277b34c2c3894d6aafc4c590f3bda50f4d43 | 300d0d5e9b872ed839fae932c56eff566967d24b | refs/heads/master | 2023-01-12T18:42:10.705028 | 2021-08-18T04:09:02 | 2021-08-18T04:09:02 | 182,431,653 | 183 | 25 | BSD-3-Clause | 2023-01-07T12:42:14 | 2019-04-20T16:55:30 | TypeScript | UTF-8 | C++ | false | false | 1,306 | h | // Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
//
// ---------------------------------------------------------------------------
//
// This file was generated by the CEF translator tool. If making changes by
// hand only do so within the body of existing method and function
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=3765c5f9b184d9b83b48c7a70db46fa8e5b946b0$
//
#ifndef CEF_LIBCEF_DLL_CPPTOC_V8INTERCEPTOR_CPPTOC_H_
#define CEF_LIBCEF_DLL_CPPTOC_V8INTERCEPTOR_CPPTOC_H_
#pragma once
#if !defined(WRAPPING_CEF_SHARED)
#error This file can be included wrapper-side only
#endif
#include "include/capi/cef_v8_capi.h"
#include "include/cef_v8.h"
#include "libcef_dll/cpptoc/cpptoc_ref_counted.h"
// Wrap a C++ class with a C structure.
// This class may be instantiated and accessed wrapper-side only.
class CefV8InterceptorCppToC
: public CefCppToCRefCounted<CefV8InterceptorCppToC,
CefV8Interceptor,
cef_v8interceptor_t> {
public:
CefV8InterceptorCppToC();
};
#endif // CEF_LIBCEF_DLL_CPPTOC_V8INTERCEPTOR_CPPTOC_H_
| [
"[email protected]"
] | |
40b748e0e18e6638f91e14e49e42f2ba9087de4f | ae00f29b79b8ac012a76c03b40b6f1c3b4d398bf | /src/lib/builders/java.hpp | f18f2b80f3058370d424567aad7d5c217f65af7b | [
"Apache-2.0"
] | permissive | bacsorg/system | 3f5860870d8375538c8c9e05510a3f0338a50a06 | 22149ecfaac913b820dbda52933bf8ea9fecd723 | refs/heads/master | 2021-01-09T06:58:52.004573 | 2018-03-06T18:20:06 | 2018-03-06T18:20:06 | 17,411,767 | 0 | 1 | null | 2017-09-27T10:45:19 | 2014-03-04T18:11:35 | C++ | UTF-8 | C++ | false | false | 1,404 | hpp | #pragma once
#include "interpretable.hpp"
#include <memory>
namespace bacs {
namespace system {
namespace builders {
class java : public interpretable {
public:
explicit java(const std::vector<std::string> &arguments,
bool parse_name = true);
executable_ptr build(const ContainerPointer &container,
const unistd::access::Id &owner_id,
const bacs::process::Source &source,
const bacs::process::ResourceLimits &resource_limits,
bacs::process::BuildResult &result) override;
protected:
name_type name(const bacs::process::Source &source);
ProcessPointer create_process(const ProcessGroupPointer &process_group,
const name_type &name) override;
executable_ptr create_executable(const ContainerPointer &container,
bunsan::tempfile &&tmpdir,
const name_type &name) override;
private:
std::unique_ptr<java> m_java;
std::string m_class = "Main";
std::string m_lang;
std::vector<std::string> m_flags;
};
class java_executable : public interpretable_executable {
public:
using interpretable_executable::interpretable_executable;
protected:
std::vector<std::string> arguments() const override;
};
} // namespace builders
} // namespace system
} // namespace bacs
| [
"[email protected]"
] | |
3620d847ed0f850f9426e36e5cabf5755a5e7ff9 | 86bb1666e703b6be9896166d1b192a20f4a1009c | /source/game/Viewport.h | d677bed13bdf433b8fdc51578f169582a2cbfb64 | [] | no_license | aggronerd/Mystery-Game | 39f366e9b78b7558f5f9b462a45f499060c87d7f | dfd8220e03d552dc4e0b0f969e8be03cf67ba048 | refs/heads/master | 2021-01-10T21:15:15.318110 | 2010-08-22T09:16:08 | 2010-08-22T09:16:08 | 2,344,888 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,270 | h | /**
* @file Viewport.h
*
* Created on: 31 Mar 2010
*
* @author Gregory Doran <www.gregorydoran.co.uk>
*/
#ifndef VIEWPORT_H_
#define VIEWPORT_H_
#include <ClanLib/core.h>
#define VIEWPOINT_Y_SCALE 0.5
#define VIEWPOINT_ZOOM 45.254834 // 64 pixel width of tile. sqrt((64*64)/2)
#define VIEWPOINT_SCROLL_DISTANCE_PER_SEC 10
#define VIEWPOINT_SCROLL_BORDER_WIDTH 40
class Scene;
/**
* A Viewport is used to translate what is in the world and determine
* what and what not to render on the player's screen.
*/
class Viewport
{
public:
Viewport(Scene*);
virtual ~Viewport();
CL_Point get_screen_position(const CL_Pointd&);
CL_Pointd get_world_position(CL_Point);
bool get_is_visible(const CL_Pointd&);
void center_on_world(const CL_Pointd&);
void update(unsigned int);
void set_scroll_w(bool);
void set_scroll_e(bool);
void set_scroll_s(bool);
void set_scroll_n(bool);
void set_enable_scrolling(bool);
protected:
Scene* scene;
/**
* The origin of the viewport in the world system.
*/
CL_Pointd origin;
/**
* The center of the screen in screen co-ordinates system.
*/
CL_Point screen_center;
bool enable_scrolling;
bool scroll_w;
bool scroll_e;
bool scroll_s;
bool scroll_n;
};
#endif /* VIEWPORT_H_ */
| [
"[email protected]"
] | |
bcd96c3e2ec75b67ca8d1cb84483c3ea4dc0af30 | dea7c6fe0eb9d4561db6a3927c1f7d4bd7f46357 | /c5/5章2题/522/522.cpp | 6ced2cd0c33138a2d0747bdc35241346e1b58ad0 | [] | no_license | 20191844319/G41 | 716d9b0ab826b5d7aeca44d99a6c2efb77958f3f | 76dddf15bc2f89c1392fcdaaab984112cdabf007 | refs/heads/master | 2020-08-22T17:33:19.837080 | 2019-12-21T09:08:26 | 2019-12-21T09:08:26 | 216,448,661 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 369 | cpp | // 522.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include<math.h>
int main(int argc, char* argv[])
{
int sign=1,count=0;
double pi=0.0,n=1.0,term=1.0;
while(fabs(term)>=1e-8)
{
pi=pi+term;
n=n+2;
sign=-sign;
term=sign/n;
count++;
}
pi=pi*4;
printf("pi=%10.8f\n",pi);
printf("count=%d\n",count);
return 0;
}
| [
"[email protected]"
] | |
fc318a2e679fba1b7db35dfa8dd200b9c8410eaf | 08d24b3c61c7ae29c7e876897428c1f131530272 | /c/sv_graph/sv_graph_component.cpp | dc3230c8a8e6bae8fe90eead09d85d08d34fe589 | [] | no_license | ryanlayer/sv_graph | d1aff70133f6ec6f7c0f80fdaebde1b1abe1f714 | f542796d1381c9af697aa0a58efdc09f4df50c18 | refs/heads/master | 2020-06-08T01:03:43.640579 | 2011-02-08T19:51:18 | 2011-02-08T19:51:18 | 1,343,342 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,733 | cpp | #include <vector>
using namespace std;
#include "sv_graph_component.h"
#include "sv_graph_node.h"
sv_graph_component::
sv_graph_component()
{
nodes = new vector<sv_graph_node*>();
min_node = NULL;
max_node = NULL;
}
/*
* This is the NM node in the pair, to get the offset you must get the pair of
* the node
*/
sv_graph_node*
sv_graph_component::
get_min_node()
{
return min_node;
}
/*
* This is the NM node in the pair, to get the offset you must get the pair of
* the node
*/
sv_graph_node*
sv_graph_component::
get_max_node()
{
return max_node;
}
/*
* We are assuming that the NM node is being added, not the U node
*/
void
sv_graph_component::
add(sv_graph_node *n)
{
nodes->push_back(n);
if (min_node == NULL) {
min_node = n;
max_node = n;
return;
}
sv_graph_node *n_p = n->get_pair();
if (n_p != NULL) {
sv_graph_node *min_p = min_node->get_pair();
sv_graph_node *max_p = max_node->get_pair();
if ( n_p->get_offset() < min_p->get_offset() )
min_node = n;
if ( n_p->get_offset() > max_p->get_offset() )
max_node = n;
}
}
int
sv_graph_component::
size()
{
return nodes->size();
}
vector<sv_graph_node*>*
sv_graph_component::
get_nodes()
{
return nodes;
}
bool
sv_graph_component::
operator<(sv_graph_component &other)
{
//return a.get_weight() < b.get_weight();
return min_node < other.get_min_node();
}
bool
sv_graph_component::
compare_sv_graph_components(sv_graph_component *first,
sv_graph_component *second)
{
return first->get_min_node()->get_pair()->get_offset() <
second->get_min_node()->get_pair()->get_offset();
}
void
sv_graph_component::
set_contig(string s) {
contig = s;
}
string
sv_graph_component::
get_contig() {
return contig;
}
| [
"[email protected]"
] | |
ecccbcf43fe5c946d7af93256a04190ed7d8a83f | 6bad8eef09c877c3b2527ea97ace51b002042cca | /lib/opt.cpp | b7a60e5388870e5b110a00c6b6d55d2d3c323da0 | [] | no_license | hotelsolution/hm | b2398f6c079dd3de2b2d16623cb22546bbc578bc | ba6bf7d45d7258d12a7813f6a3a2afc55b99aee6 | refs/heads/master | 2021-01-16T00:04:05.184133 | 2012-11-03T03:14:45 | 2012-11-03T03:14:45 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 508 | cpp | #include "opt.hpp"
int opt_check_for(const std::string opt,int argc , const char * argv[])
{
for(int i =0;i < argc ; i++){
if(opt == argv[i])
{
return i;
}
}
return -1;
}
void opt_remove(int &argc,const char * argv[], int index)
{
for(int i = index ; i < (argc-1) ; i++)
argv[i] = argv[i+1];
argv[argc-1] = NULL;
argc --;
}
void opt_remove(int & argc,const char * argv[], const std::string opt)
{
int index = opt_check_for(opt,argc,argv);
if(index >=0)
opt_remove(argc,argv,index);
} | [
"[email protected]"
] | |
c1da105f63a0d6f436b4a0dadc98a7c03a2e3012 | 9b5e5c6f1f35352b17624de9cca17ca368a1649d | /src/BftProtocolState.cpp | f083017201f98e09579085223cae5a2959814c52 | [] | no_license | etremel/pddm | 40aaeec0bb744de2e107f1d5e18790414ae0f5cc | 98c3e326bdbcb4630dbf20a84484ea08adb42400 | refs/heads/master | 2021-05-01T07:57:58.268926 | 2017-11-07T23:17:15 | 2017-11-07T23:17:15 | 59,692,040 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 8,029 | cpp | /*
* BftProtocolState.cpp
*
* Created on: May 24, 2016
* Author: edward
*/
#include <memory>
#include <vector>
#include <cstring>
#include <algorithm>
#include <spdlog/spdlog.h>
#include "BftProtocolState.h"
#include "MeterClient.h"
#include "FixedPoint_t.h"
#include "CrusaderAgreementState.h"
#include "messaging/StringBody.h"
#include "messaging/QueryRequest.h"
#include "messaging/OverlayTransportMessage.h"
#include "messaging/SignatureResponse.h"
#include "messaging/ValueContribution.h"
using namespace pddm::messaging;
namespace pddm {
void BftProtocolState::start_query_impl(const QueryRequest& query_request,
const std::vector<FixedPoint_t>& contributed_data) {
protocol_phase = BftProtocolPhase::SETUP;
accepted_proxy_values.clear();
agreement_phase_state = std::make_unique<CrusaderAgreementState>(meter_id, num_meters, query_request.query_number, crypto);
//Encrypt my ValueTuple and send it to the utility to be signed
auto encrypted_contribution = crypto.rsa_encrypt(my_contribution, meter_id);
network.send(std::make_shared<messaging::SignatureRequest>(meter_id, encrypted_contribution));
}
void BftProtocolState::handle_signature_response(const std::shared_ptr<SignatureResponse>& message) {
auto signed_contribution = std::make_shared<ValueContribution>(*my_contribution);
//Decrypt the utility's signature and copy it into ValueContribution's signature field
crypto.rsa_decrypt_signature(as_string_pointer(std::static_pointer_cast<SignatureResponse::body_type>(message->body)),
signed_contribution->signature);
logger->debug("Meter {} is finished with Setup", meter_id);
protocol_phase = BftProtocolPhase::SHUFFLE;
encrypted_multicast_to_proxies(signed_contribution);
}
void BftProtocolState::handle_overlay_message_impl(const std::shared_ptr<OverlayTransportMessage>& message) {
auto overlay_message = std::static_pointer_cast<OverlayTransportMessage::body_type>(message->body);
//Dummy messages will have a null payload
if(overlay_message->body != nullptr) {
/* If it's an encrypted onion that needs to be forwarded, the payload will be the next layer.
* If the payload is not an OverlayMessage, it's either a PathOverlayMessage or the last layer
* of the onion. The last layer of the onion will always have destination == meter_id (because
* it was just received here), but a PathOverlayMessage that still needs to be forwarded will
* have its destination already set to the next hop by the superclass handle_overlay_message.
*/
if(auto enclosed_message = std::dynamic_pointer_cast<messaging::OverlayMessage>(overlay_message->body)){
waiting_messages.emplace_back(enclosed_message);
} else if(overlay_message->destination == meter_id){
if(protocol_phase == BftProtocolPhase::SHUFFLE) {
handle_shuffle_phase_message(*overlay_message);
} else if(protocol_phase == BftProtocolPhase::AGREEMENT) {
handle_agreement_phase_message(*overlay_message);
}
} //If destination didn't match, it was already added to waiting_messages
}
if(message->is_final_message && is_in_overlay_phase()) {
end_overlay_round();
}
}
void BftProtocolState::handle_shuffle_phase_message(const messaging::OverlayMessage& message) {
//Drop messages that are received in the wrong phase (i.e. not ValueContributions) or have the wrong round number
if(auto contribution = std::dynamic_pointer_cast<ValueContribution>(message.body)) {
if(contribution->value.query_num == my_contribution->query_num) {
//Verify the owner's signature
if(crypto.rsa_verify(contribution->value, contribution->signature, -1)) {
proxy_values.emplace(contribution);
logger->trace("Meter {} received proxy value: {}", meter_id, *contribution);
}
} else {
logger->warn("Meter {} rejected a proxy value because it had the wrong query number: {}", meter_id, *contribution);
}
} else if(message.body != nullptr) {
logger->warn("Meter {} rejected a message because it was not a ValueContribution: {}", meter_id, message);
}
}
void BftProtocolState::handle_agreement_phase_message(const messaging::OverlayMessage& message) {
agreement_phase_state->handle_message(message);
}
void BftProtocolState::send_aggregate_if_done() {
if(aggregation_phase_state->done_receiving_from_children()) {
aggregation_phase_state->compute_and_send_aggregate(accepted_proxy_values);
protocol_phase = BftProtocolPhase::IDLE;
logger->debug("Meter {} is finished with Aggregate", meter_id);
SIM_DEBUG(util::debug_state().num_finished_aggregate++;);
SIM_DEBUG(util::print_aggregate_status(logger, num_meters););
}
}
void BftProtocolState::end_overlay_round_impl() {
//Determine if the Shuffle phase has ended
if(protocol_phase == BftProtocolPhase::SHUFFLE
&& overlay_round >= 2 * FAILURES_TOLERATED + log2n * log2n + 1) {
logger->debug("Meter {} is finished with Shuffle", meter_id);
//Sign each received value and multicast it to the other proxies
for(const auto& proxy_value : proxy_values) {
//Create a SignedValue object to hold this value, and add this node's signature to it
auto signed_value = std::make_shared<messaging::SignedValue>();
signed_value->value = proxy_value;
signed_value->signatures[meter_id].fill(0);
crypto.rsa_sign(*proxy_value, signed_value->signatures[meter_id]);
std::vector<int> other_proxies(proxy_value->value.proxies.size()-1);
std::remove_copy(proxy_value->value.proxies.begin(),
proxy_value->value.proxies.end(), other_proxies.begin(), meter_id);
//Find paths that start at the next round - we send before receive, so we've already sent messages for the current round
auto proxy_paths = util::find_paths(meter_id, other_proxies, num_meters, overlay_round+1);
for(const auto& proxy_path : proxy_paths) {
//Encrypt with the destination's public key, but don't make an onion
outgoing_messages.emplace_back(crypto.rsa_encrypt(std::make_shared<messaging::PathOverlayMessage>(
get_current_query_num(), proxy_path, signed_value), proxy_path.back()));
}
}
agreement_start_round = overlay_round;
protocol_phase = BftProtocolPhase::AGREEMENT;
SIM_DEBUG(util::debug_state().num_finished_shuffle++;);
SIM_DEBUG(util::print_shuffle_status(logger, num_meters););
}
//Detect finishing phase 2 of Agreement
else if(protocol_phase == BftProtocolPhase::AGREEMENT
&& overlay_round >= agreement_start_round + 4 * FAILURES_TOLERATED + 2 * log2n * log2n + 2
&& agreement_phase_state->is_phase1_finished()) {
logger->debug("Meter {} finished phase 2 of Agreement", meter_id);
accepted_proxy_values = agreement_phase_state->finish_phase_2();
SIM_DEBUG(util::debug_state().num_finished_agreement++;);
SIM_DEBUG(util::print_agreement_status(logger, meter_id, num_meters););
//Start the Aggregate phase
protocol_phase = BftProtocolPhase::AGGREGATE;
start_aggregate_phase();
}
//Detect finishing phase 1 of Agreement
else if(protocol_phase == BftProtocolPhase::AGREEMENT
&& overlay_round >= agreement_start_round + 2 * FAILURES_TOLERATED + log2n * log2n + 1
&& !agreement_phase_state->is_phase1_finished()) {
logger->debug("Meter {} finished phase 1 of Agreement", meter_id);
auto accept_messages = agreement_phase_state->finish_phase_1(overlay_round);
outgoing_messages.insert(outgoing_messages.end(), accept_messages.begin(), accept_messages.end());
}
}
} /* namespace pddm */
| [
"[email protected]"
] | |
001e6ef5fdfd18da91249a6484feca080f8ac167 | aa71205fd8b1ca031fc9d56e58a16bf9dcdbd1d0 | /src/component/GUIComponent.h | 92673b6330eee5d059461f86570352c2950f1d0c | [
"LicenseRef-scancode-public-domain",
"Unlicense"
] | permissive | xiangwencheng1994/L | df461b015758aee7bf18ddf1ac5834f72efabccb | dbdaf3dbd2a257c87ebdda529ab9e741d3cca9c7 | refs/heads/master | 2020-08-02T12:12:45.912896 | 2019-09-01T14:49:07 | 2019-09-24T20:29:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,015 | h | #pragma once
#include "Component.h"
#include "../rendering/Material.h"
#include "../engine/Resource.h"
namespace L {
class GUIComponent : public Component {
L_COMPONENT(GUIComponent)
L_COMPONENT_HAS_GUI(GUIComponent)
protected:
Camera* _camera;
Material _material;
Vector2i _offset = 0;
Vector2f _viewport_anchor = 0.f;
Vector2f _anchor = 0.f;
Vector2f _scale = 1.f;
public:
virtual void update_components() override;
virtual Map<Symbol, Var> pack() const override;
virtual void unpack(const Map<Symbol, Var>&) override;
static void script_registration();
void gui(const Camera&);
inline Material* material() { return &_material; }
inline void offset(const Vector2i& offset) { _offset = offset; }
inline void viewport_anchor(const Vector2f& viewport_anchor) { _viewport_anchor = viewport_anchor; }
inline void anchor(const Vector2f& anchor) { _anchor = anchor; }
inline void scale(const Vector2f& scale) { _scale = scale; }
};
}
| [
"[email protected]"
] | |
1136b6186b3a5223de28e3501a099d7a2f1fb474 | 585a67412139ab94d1258624da34dfd0b896086e | /chapter03/ModernCPPTest/ModernCPPTest/main.cpp | 19c4b7f8a5ffaa425f2a557d0ba7511d28d5cfe5 | [] | no_license | kyoungchinseo/oFGuideBook | 1c402d3ca3be02bc1cef51e2fd9aecba487b1243 | 6ec1084c8ab11f87980c61e2c58a8703911d59b2 | refs/heads/master | 2020-03-28T17:42:01.407611 | 2018-09-27T14:29:19 | 2018-09-27T14:29:19 | 148,426,089 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,486 | cpp | #include <iostream>
#include <vector>
#include <map>
#include <string>
using namespace std;
int main(int argc, const char * argv[]) {
// vector<int> vec;
//
// vec.assign(5, 10);
// for(int i=0;i<5;i++) {
// vec.push_back(50);
// }
//
// for(int i=0;i<vec.size();i++) {
// cout << vec[i] << " ";
// }
// cout << endl;
//
// vec[3] = 300;
// vec[5] = 500;
// vec[7] = 700;
//
// vector<int>::iterator it;
// for(it = vec.begin();it < vec.end(); it++) {
// cout << *(it) << " ";
// }
// cout << endl;
//
// it = vec.begin();
// vec.insert(it+3,1234);
// it = vec.begin();
// vec.insert(it+7,4321);
//
// for(auto item: vec) {
// cout << item << " ";
// }
// cout << endl;
map<string,int> player;
player.insert(make_pair("soccer",11));
player.insert(make_pair("baseball", 9));
player.insert(make_pair("volleyball", 6));
player["football"] = 11;
player["basketball"] = 5;
player["handball"] = 7;
cout << "before:" << endl;
map<string,int>::iterator mt;
for(mt=player.begin(); mt != player.end(); mt++) {
cout << "key : " << mt->first << "," << "value : " << mt->second << endl;
}
player.erase("football");
mt = player.find("volleyball");
player.erase(mt);
cout << "after: " << endl;
for(auto it : player) {
cout << "key : " << it.first << "," << "value : " << it.second << endl;
}
return 0;
}
| [
"[email protected]"
] | |
0f4c1cd93a3477a9bedccc085fb7a3ae88a4a8c3 | 7c1a3e08fe53e662bdab1699df289b0d0538b491 | /training/deplibuv.hpp | 3a4f8c748e6832b003e94218c49507621c2bfb0b | [
"ISC"
] | permissive | Globik/kore-mediasoup | 1cc54c5320550b2f38828b426b3e6f69776d9451 | 343186112316c9f201cd97181cc807881db3bd86 | refs/heads/master | 2021-04-12T09:40:21.239635 | 2019-06-10T17:53:45 | 2019-06-10T17:53:45 | 126,602,145 | 13 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 939 | hpp | #ifndef LIBUV_HPP
#define LIBUV_HPP
#include <uv.h>
#include "uv_callback.h"
#include <iostream>
#include <functional>
#include <string>
//void*pt2obj;
void * on_sum2(uv_callback_t *callback,void*data);
extern uv_callback_t cb_sum2;
class deplibuv
{
public:
static void classinit();
static void classdestroy();
static void printversion();
static void runloop();
static uv_loop_t* getloop();
static uint64_t gettime();
int hello(const std::string& s);
/*{
std::cout << "hello " << s << '\n';
}
*/
/*
static void * on_sum2(uv_callback_t *callback,void*data){
std::printf("ODER?? %s\n", (char*)data);
//int a=9;
return data;
}
*/
void display(char*text);//{std::cout << text << std::endl;};
static void wrapper_to_call_display(char*text);
private:
static uv_loop_t*loop;
};
inline uv_loop_t* deplibuv::getloop(){
return deplibuv::loop;
}
inline uint64_t deplibuv::gettime(){
return uv_now(deplibuv::loop);
}
#endif | [
"[email protected]"
] | |
f75cd0c4e89c68c30a66601f4d09250f51bb7a77 | 178bc3daf9f3644ffa5fdd9275863a6b8ef4511f | /Code/Common/common/AppBase.cpp | 9bbbdc643b6f5b37ba824347099c26e848cda253 | [] | no_license | wanliyun/Aurora | 746cac407208074f4bf82cac0a9646a24130d6b2 | 3c9c46b836e97f9a0f9d1b5d4304cbaa60587441 | refs/heads/master | 2021-01-20T16:24:25.575827 | 2017-02-22T10:22:00 | 2017-02-22T10:22:00 | 82,776,032 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 4,299 | cpp |
#include "pch.h"
#include "AppBase.h"
#include "Debug.h"
#include "Utils.h"
#include "NetworkConn.h"
#include <FileSystem.h>
#include "AppConfigBase.h"
#include <ctime>
#ifdef WIN32
#include "shlwapi.h"
#pragma comment(lib, "shlwapi.lib")
#endif
namespace Aurora
{
AppBase::AppBase( AppConfigBase & appConfig )
:m_appConfig(appConfig)
,m_pEventBase(0)
,m_nCurrentTick(0)
,m_nShutdownTicks(-1)
,m_pEvTickTimer(0)
{
}
bool AppBase::Init( float fTickTime)
{
::srand(unsigned(time(0)));
InitRootDir();
if(!FileSystem::get_mutable_instance().Init("./Paths.xml"))
{
Log_ErrorF("Load Paths.xml");
return false;
}
m_tickDelta.tv_sec = uint32(fTickTime);
m_tickDelta.tv_usec = uint32( (fTickTime - float(m_tickDelta.tv_sec)) * 1000 * 1000);
m_pEventBase = event_base_new();
if(!m_pEventBase)
{
Log_ErrorF("event_base_new() FAILED");
return false;
}
if(!m_appConfig.Init())
{
Log_ErrorF("m_appConfig.Init() FAILED");
return false;
}
m_pEvTickTimer = evtimer_new(m_pEventBase,AppBase::on_tick,this);
if(!m_pEvTickTimer)
{
Log_ErrorF("evtimer_new() FAILED");
return false;
}
return this->OnInit();
}
void AppBase::Run()
{
MY_ASSERT(m_pEventBase);
PreRun();
//添加Tick事件;
AddTickEv();
//主循环,知道程序结束;
event_base_dispatch(m_pEventBase);
PostRun();
}
void AppBase::Fini()
{
this->OnFini();
std::map<SOCKET,NetworkConn * > tmp;
tmp.swap(m_mapConns);
for(std::map<SOCKET,NetworkConn * >::iterator iter = tmp.begin();iter != tmp.end();++iter)
{
SAFE_DELETE(iter->second);
}
if(m_pEvTickTimer)
{
evtimer_del(m_pEvTickTimer);
m_pEvTickTimer = 0;
}
if(m_pEventBase)
{
event_base_free(m_pEventBase);
m_pEventBase = 0;
}
}
void AppBase::AddTickEv()
{
MY_ASSERT(m_pEventBase && m_pEvTickTimer);
evtimer_add(m_pEvTickTimer,&m_tickDelta);
++m_nCurrentTick;
}
void AppBase::on_tick( int sock, short event, void* arg )
{
AppBase * const pThisApp = static_cast<AppBase * >(arg);
MY_ASSERT(pThisApp );
float lastTicktime = 1.0f; //TODO;
//执行任务;
pThisApp->tickConnList(lastTicktime);
//调用回调;
pThisApp->OnTick(lastTicktime);
//退出处理;
if(pThisApp->m_nShutdownTicks >= 0)
{
pThisApp->m_nShutdownTicks -= 1;
if(pThisApp->m_nShutdownTicks == 0)
{
event_base_loopbreak(pThisApp->m_pEventBase);
return; //函数返回;
}
}
//重新添加Tick事件;
pThisApp->AddTickEv();
}
void AppBase::InitRootDir()
{
#ifdef WIN32
WCHAR szExeFileName[_MAX_PATH];
GetModuleFileNameW( GetModuleHandle(NULL), szExeFileName, sizeof(szExeFileName));
PathRemoveFileSpecW(szExeFileName);
SetCurrentDirectoryW( szExeFileName );
#endif
}
NetworkConn * AppBase::DoConnect( const SocketAddress & addr )
{
Socket sock;
if(!sock.create())
return false;
if(!sock.connect(addr))
return false;
SOCKET sock_ = sock.getSOCKET();
sock.Detach();
return newNetworkConn(sock_,addr);
}
NetworkConn * AppBase::newNetworkConn( SOCKET sock ,const SocketAddress & addr, bool isSecondary /*= false*/)
{
MY_ASSERT(m_mapConns.find(sock) == m_mapConns.end());
NetworkConn * pNewConn = new NetworkConn(*this,isSecondary);
if(!pNewConn->Attach(sock,addr))
{
Log_ErrorF("pNewConn->Attach(%d,%s) FAILED",sock,addr.ToString());
SAFE_DELETE(pNewConn);
return 0;
}
m_mapConns.insert(std::make_pair(sock,pNewConn));
return pNewConn;
}
void AppBase::tickConnList( float fDeltaTime )
{
std::vector<SOCKET> vDelSockets;
for(std::map<SOCKET,NetworkConn * >::iterator iter = m_mapConns.begin();iter != m_mapConns.end();++iter)
{
NetworkConn * pConn = iter->second;
MY_ASSERT(pConn);
if( !pConn->Tick(fDeltaTime))
{
vDelSockets.push_back(iter->first);
continue;
}
}
for(std::vector<SOCKET>::const_iterator iter = vDelSockets.begin();iter != vDelSockets.end();++iter)
{
const SOCKET sock = *iter;
MY_ASSERT(m_mapConns.find(sock) != m_mapConns.end());
SAFE_DELETE(m_mapConns[sock]);
m_mapConns.erase(sock);
}
}
}
| [
"[email protected]"
] | |
920f004ebad35ff84dd61ff0df3ddaf91fc76f67 | 01a877ae8af020fc480501808600fe8f737acae6 | /Image Segmentation using Euler Graphs/eulerwalk.cpp | 08dc77cd758399bc9df99965aca282c0738dd0ea | [] | no_license | SnehaDL/Sneha-Projects | 8abdddedd8181b8156b32509c6bffee675c680b5 | 2642bff5657332c9c0a5f9422385494f8ee9e6f1 | refs/heads/master | 2016-09-12T19:59:29.698985 | 2016-04-21T16:37:48 | 2016-04-21T16:37:48 | 56,786,295 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 686 | cpp | #include <iostream>
#include <list>
using namespace std;
int graph[100][100];
int n, x, y, steps;
list<int> path;
void walk(int pos){
for(int i = 0; i < n; i++){
if(graph[pos][i] > 0){
graph[pos][i] --;
graph[i][pos] --;
walk(i);
break;
}
}
path.push_back(pos+1);
}
int main(){
cin >> n;
for(int i = 0; i < n; i++){
cin >> x >> y;
graph[x-1][y-1] ++; //we are using zero index
}
walk(0);
while(!path.empty()){
cout << path.back() << ' ';
path.pop_back();
}
}
| [
"[email protected]"
] | |
946701ab84fe3ad960a0f37be2fe1f81f5ec0d0d | 8b22cfbd4b2528b053d2db343a2ae184a0b5cdca | /Classes_con_Bug/EnemyPatrolState.h | d7283f21aa432cbf5ec02cadf9f9edb033a5eb1c | [] | no_license | darioslave1/Cyber_Hackman | b6bdbf1b9b78c76f478843afe79a5369771b9cb6 | 5a4d60c5ed91221d2e0b72974ffb7c91912a55a2 | refs/heads/master | 2020-05-18T11:35:05.908278 | 2013-10-12T15:49:17 | 2013-10-12T15:49:17 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 729 | h | #include "State.h"
class Enemy;
//------------------------------------------------------------------------
//
// Name: EnemyPatrolState.h
//
// Desc: Singleton Class to PatrolState
//
// Author: Dario Schiavone
//
// The enemy follow a random path
//------------------------------------------------------------------------
class EnemyPatrolState : public IState<Enemy>
{
private:
EnemyPatrolState(){}
public:
//this is a singleton
static EnemyPatrolState* Instance();
//this will execute when the state is entered
void Enter(Enemy* ptrEnemy);
//this is the states normal update function
void Execute(Enemy* ptrEnemy);
//this will execute when the state is exited
virtual void Exit(Enemy* ptrEnemy);
}; | [
"[email protected]"
] | |
87c1ab1a784c5e4598d1b04a13911115f18889df | efdfe2b2477167766321e1e2152b23e31f4650c4 | /contest795/B.cpp | 4cb467ef4408266ac2623ff1ed7cd429682a1e64 | [] | no_license | chongin12/Problem_Solving | 612c7783156db89e9248720bc870f58556f01d01 | c23b25778e32ed4ab21d23b3a4439eefcae486b4 | refs/heads/master | 2023-09-02T20:55:08.413597 | 2023-09-01T05:15:30 | 2023-09-01T05:15:30 | 182,390,474 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,135 | cpp | #include <bits/stdc++.h>
using namespace std;
using ll=long long int;
const ll MOD=1000000007;
int N, Q;
ll arr[1001];
vector<int> G[1001];
vector<ll> res;
int Visit[1001];
void init(){
res.clear();
for(int i=0; i<1001; ++i){
Visit[i]=0;
}
}
void f(){
ll t=arr[res[0]];
for(int i=1; i<res.size(); ++i){
ll jari=10;
t=t*10;
t%=MOD;
while(arr[res[i]]/jari!=0) {
jari*=10;
t=t*10;
t%=MOD;
}
t=t+arr[res[i]];
t%=MOD;
}
cout << t << '\n';
}
void dfs(int x, int toFind){
res.push_back(x);
if(x==toFind) {
f();
return;
}
Visit[x]=1;
for(auto nxt:G[x]){
if(!Visit[nxt]){
dfs(nxt, toFind);
}
}
res.pop_back();
}
int main(){
ios::sync_with_stdio(0); cin.tie(0);
cin>>N>>Q;
for(int i=1; i<=N; ++i){
cin>>arr[i];
}
for(int i=0; i<N-1; ++i){
int u,v; cin>>u>>v;
G[u].push_back(v);
G[v].push_back(u);
}
while(Q--){
int x,y; cin>>x>>y;
init();
dfs(x,y);
}
} | [
"[email protected]"
] | |
ceec151e1d064b6efdcfbe1b37aa3b5e06c8a88f | 3d3be59222796e8bbedc160c1f1595b245bde002 | /OpenGl6/OpenGL/OpenGL/dirLight.h | 373cd952dac0d5c32b6fa0ca136d0321058c8b17 | [
"MIT"
] | permissive | coconutjim/hseb4-compgraph | 77fc8a04345f32e840f5bd19bebdeef7cd0f20c0 | 2d4d883873b3589d7dceeef3597eda185c368ef2 | refs/heads/master | 2022-07-22T03:29:37.325022 | 2022-07-14T19:34:28 | 2022-07-14T19:34:28 | 234,436,864 | 1 | 0 | null | null | null | null | WINDOWS-1251 | C++ | false | false | 1,112 | h | /*
Осипов Лев Игоревич
Проект 17. OpenGL6
Visual Studio 2013
20.03.2016
Сделано:
1) добавлены 4 Дедпула (и реализованы тени к ним)
2) добавлена возможность включения/отключения направленного источника света (клавиша Е)
3) добавлены 3 новых точечных источника света
4) реалзиовано включение/выключение точечных источников - клавиши 1, 2 и 3 соответственно
5) код закомментирован
*/
#pragma once
#include "shaders.h"
// Support class for adding directional lights to scene.
class CDirectionalLight
{
public:
glm::vec3 vColor; // Color of directional light
glm::vec3 vDirection; // and its direction
float fAmbient;
int bOn;
int iSkybox;
void SetUniformData(CShaderProgram* spProgram, string sLightVarName);
CDirectionalLight();
CDirectionalLight(glm::vec3 a_vColor, glm::vec3 a_vDirection, int a_bOn, float a_fAmbient, int a_iSkybox);
}; | [
"[email protected]"
] | |
906f9a2d703654910a34aceb70db2bf5e92f0f81 | d99aaae99f6bb8792b02412e264de5b9ca14a7f4 | /example_ex4/prob4-2/main.cpp | c2d21f9fce5dad68d72da4002266db35efdb24aa | [] | no_license | pk-Musan/HelloCpp | 0d85dd585d116aadb62153649c1e87daa767e84b | c5715bb563ab3bc373181e8c637cc1f8185911bb | refs/heads/master | 2020-09-07T20:38:38.564055 | 2019-12-05T08:51:44 | 2019-12-05T08:51:44 | 220,906,763 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 569 | cpp | #include <iostream>
#include <vector>
int main() {
std::vector<int> numbers;
int n;
while(true) {
std::cout << "正の整数を入力:";
std::cin >> n;
if (n == -1 && !numbers.empty()) break;
if (n > 0) numbers.push_back(n);
}
std::cout << std::endl;
int max = numbers[0], min = numbers[0];
for (int n : numbers) {
if (max < n) max = n;
if (min > n) min = n;
}
std::cout << "最大値:" << max << std::endl;
std::cout << "最小値:" << min << std::endl;
return 0;
} | [
"[email protected]"
] | |
2c85a68030b279c3ba1f6dd9bd00caff31af6b45 | f2a425b791d601289862304c50d6173890c2505a | /WheelSpinner/Classes/Wheel_Spinner.cpp | 103fa11b23ff3536fce51dc0c8395df1ea5fb95f | [] | no_license | MichaelZheng45/WheelSpinner | 6bb28bb032bb24ba925696e7f01b1f67276c0027 | 7677862855914339fc0cd22150f3c33dc6c72813 | refs/heads/master | 2023-01-18T20:14:24.352372 | 2020-11-27T01:09:04 | 2020-11-27T01:09:04 | 315,133,660 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,806 | cpp | #include "Wheel_Spinner.h"
Wheel_Spinner::Wheel_Spinner()
{
}
void Wheel_Spinner::Init(Wheel_Slot sectors[], unsigned int slotCount, cocos2d::Sprite* wheelSprite, cocos2d::Sprite* wheelSpriteBorder, float spriteOffset, cocos2d::Vec2 labelOffset)
{
for (int i = 0; i < slotCount; i++)
{
mSectors.push_back(sectors[i]);
}
mSlotCount = slotCount;
mWheelSprite = wheelSprite;
mWheelSpriteBorder = wheelSpriteBorder;
mWheelIsActive = false;
mCurrentDuration = 0;
//calulate angle between each sector
mAngleDiff = 360.0f/(float)mSlotCount;
//starting from the top of the spinner and moving right, need to offset the angle by 90 degrees
//find the angle for the first sector
float initialAngle = 90.0f - mAngleDiff/2.0f;
float toRadians = M_PI / 180;
float sectorNumber = 0;
for (std::vector<Wheel_Slot>::iterator it = mSectors.begin(); it != mSectors.end(); it++)
{
//find the angle on the wheel for the given sector
float targetAngle = initialAngle - mAngleDiff * sectorNumber;
//get direction in vector form
cocos2d::Vec2 direction = cocos2d::Vec2(cos(targetAngle * toRadians), sin(targetAngle * toRadians));
//get final position
cocos2d::Vec2 position = cocos2d::Vec2(wheelSprite->getContentSize().width/2.0f, wheelSprite->getContentSize().height/2.0f) + direction * spriteOffset;
//set position and rotation
it->getRewardSprite()->setPosition(position);
it->getRewardSprite()->setRotation(mAngleDiff / 2.0f + mAngleDiff * sectorNumber);
//create label and set
auto label = cocos2d::Label::createWithTTF(it->getLabelText(), "fonts/Marker Felt.ttf", 40);
it->getRewardSprite()->addChild(label);
label->setPosition(labelOffset);
//set sector sprite as child to the wheel sprite
mWheelSprite->addChild(it->getRewardSprite());
sectorNumber++;
}
//create reward sprite and label
mRewardSprite = cocos2d::Sprite::create();
mRewardLabel = cocos2d::Label::createWithTTF("", "fonts/Marker Felt.ttf", 40);
mRewardLabel->setPosition(labelOffset);
mRewardSprite->setCascadeOpacityEnabled(true);
mRewardSprite->addChild(mRewardLabel);
mWheelSprite->addChild(mRewardSprite);
}
Wheel_Spinner::~Wheel_Spinner()
{
}
void Wheel_Spinner::update(float delta)
{
if (mWheelIsActive)
{
mCurrentDuration +=delta;
if (mCurrentDuration > SPIN_DURATION + SHOW_REWARD_DURATION)
{
mWheelIsActive = false;
}
}
}
int Wheel_Spinner::spinWheel()
{
//generate number
int dropNum = cocos2d::RandomHelper::random_int(0, 100);
//value that compares with the drop number
int dropValue = 0;
int sector = 0;
for (std::vector<Wheel_Slot>::iterator it = mSectors.begin(); it != mSectors.end(); it++)
{
//for every sector, check if it is in the drop threshold
dropValue += it->getDropChance();
if (dropValue >= dropNum)
{
return sector;
}
sector++;
}
//error
return -1;
}
std::tuple<Reward_Type, int> Wheel_Spinner::getReward(int sector)
{
Reward_Type type = mSectors.at(sector).getReward();
int rewardValue = mSectors.at(sector).getRewardValue();
return std::tuple<Reward_Type, int> (type, rewardValue);
}
void Wheel_Spinner::animateWheel(int atSector)
{
mWheelIsActive = true;
mCurrentDuration = 0;
//reset wheel
mWheelSprite->setRotation(0);
//calculate rotation
float targetAngle = -(mAngleDiff / 2.0f + mAngleDiff * atSector);
//do fluid animation
auto rotateBy= cocos2d::RotateBy::create(SPIN_DURATION, targetAngle + SPIN_TIMES * 360);
auto easeInOutBack = cocos2d::EaseBackInOut::create(rotateBy->clone());
mWheelSprite->runAction(easeInOutBack);
//set sprite texture that will pop up after spin finishes sequence
mRewardSprite->setSpriteFrame(mSectors.at(atSector).getRewardSprite()->getSpriteFrame());
mRewardSprite->setOpacity(0);
//get the position at the center of the wheel
cocos2d::Vec2 centerPosition = cocos2d::Vec2(mWheelSprite->getContentSize().width / 2, mWheelSprite->getContentSize().height / 2);
//set label text
mRewardLabel->setString(mSectors.at(atSector).getLabelText());
//set position and rotation
mRewardSprite->setPosition(centerPosition + cocos2d::Vec2(cos((targetAngle + 90) * (M_PI / 180)), sin((targetAngle + 90) * (M_PI / 180))) * 200);
mRewardSprite->setRotation(-targetAngle);
//create actions for the reward to follow
auto spawn = cocos2d::Spawn::createWithTwoActions(cocos2d::FadeTo::create(REWARD_MOVE_IN_TIME, 255)
, cocos2d::MoveTo::create(REWARD_MOVE_IN_TIME, centerPosition));
auto fadeOut = cocos2d::FadeTo::create(REWARD_MOVE_IN_TIME, 0);
auto showDelay = cocos2d::DelayTime::create(SPIN_DURATION);
auto waitDelay = cocos2d::DelayTime::create(SHOW_REWARD_DURATION - REWARD_MOVE_IN_TIME);
auto sequence = cocos2d::Sequence::create(showDelay, spawn, waitDelay, fadeOut, nullptr);
mRewardSprite->runAction(sequence);
} | [
"[email protected]"
] | |
53caf9e58e7a228e53c37546e5f0d600cc1e88a4 | 485173b607c4a38f735c7d51fc4ac57a5f2204e2 | /two-sum-ii-input-array-is-sorted.cpp | 76c59d8ce357b514fedbf9e3e976eb5cfbd6ef97 | [] | no_license | hey-vincent/leetcode | 222be2a0ced8babb05ac5d88746989e85e8ffb0e | a43477b2c560cac7bea4f811caaeeb9fbb03f388 | refs/heads/master | 2021-08-18T10:00:44.826245 | 2020-05-06T07:49:15 | 2020-05-06T07:49:15 | 178,378,568 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 755 | cpp |
#include <iostream>
#include <vector>
using namespace std;
//https://leetcode.com/problems/two-sum-ii-input-array-is-sorted/submissions/
// 给定升序数组numbers 和 一个数target
// 求哪两个数的和是target
// Input: numbers = [2,7,11,15], target = 9
// Output: [1,2]
// Explanation: The sum of 2 and 7 is 9. Therefore index1 = 1, index2 = 2.
vector<int> twoSum(vector<int> &numbers, int target)
{
vector<int> res;
int i = 0, j = numbers.size() - 1;
while (i < j)
{
int nsum = numbers[j] + numbers[i];
if (nsum == target)
{
return vector<int>{i + 1, j + 1};
}
if (nsum > target)
{
j--;
}
else
i++;
}
return res;
} | [
"[email protected]"
] | |
d89207a398c71e0bb2d3fb0fe16907e7c978aaa5 | 2ba48648eefadee113a7c2f5d608cab5209c3a8b | /code/Configurator/CContourMarks.h | 7a75d7387a2604a9e260b58547c2f21664c852eb | [] | no_license | wangdong412/Consen-SIS | 879762175575d0a62f26ec1effeb46c3fd62e3e8 | bca3fac35c961c3558a3438bca55e6d20825da3a | refs/heads/master | 2020-07-11T05:17:18.814104 | 2019-08-27T09:41:41 | 2019-08-27T09:41:41 | 204,450,874 | 1 | 5 | null | null | null | null | GB18030 | C++ | false | false | 2,288 | h | // 从类型库向导中用“添加类”创建的计算机生成的 IDispatch 包装类
#import "C:\Windows\\System32\\TeeChart8.ocx" no_namespace
// CContourMarks 包装类
class CContourMarks : public COleDispatchDriver
{
public:
CContourMarks(){} // 调用 COleDispatchDriver 默认构造函数
CContourMarks(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
CContourMarks(const CContourMarks& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
// 特性
public:
// 操作
public:
// IContourMarks 方法
public:
BOOL get_AntiOverlap()
{
BOOL result;
InvokeHelper(0xc9, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
void put_AntiOverlap(BOOL newValue)
{
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0xc9, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
BOOL get_AtSegments()
{
BOOL result;
InvokeHelper(0xca, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
void put_AtSegments(BOOL newValue)
{
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0xca, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
BOOL get_ColorLevel()
{
BOOL result;
InvokeHelper(0xcb, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
void put_ColorLevel(BOOL newValue)
{
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0xcb, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
long get_Margin()
{
long result;
InvokeHelper(0xcc, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
void put_Margin(long newValue)
{
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0xcc, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
long get_Density()
{
long result;
InvokeHelper(0xcd, DISPATCH_PROPERTYGET, VT_I4, (void*)&result, NULL);
return result;
}
void put_Density(long newValue)
{
static BYTE parms[] = VTS_I4 ;
InvokeHelper(0xcd, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
BOOL get_Visible()
{
BOOL result;
InvokeHelper(0xce, DISPATCH_PROPERTYGET, VT_BOOL, (void*)&result, NULL);
return result;
}
void put_Visible(BOOL newValue)
{
static BYTE parms[] = VTS_BOOL ;
InvokeHelper(0xce, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms, newValue);
}
// IContourMarks 属性
public:
};
| [
"[email protected]"
] | |
00faf0eff0880142f2359330c3d397fe0f935eed | 86e3367acf81c30825670ad6b16056056e60cf48 | /ls/Player/Equip/Overdrive.h | 019ef9e71958f472363312822e5ec96019fc19ec | [
"BSD-3-Clause"
] | permissive | sorcery-p5/Asteraiser | 0bb3e4a2e620f68764ee4e346e99440d1e7818b8 | f27da9e3e262772686245f7e83b800e41c909f0f | refs/heads/master | 2020-03-19T06:25:38.820721 | 2020-02-12T14:15:05 | 2020-02-12T14:15:05 | 136,018,491 | 6 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 2,620 | h | #pragma once
#include "../PlayerTypes.h"
class Effect;
class SpriteFrame;
class Player;
class OverdriveEnergy;
class Spear;
class Ruler;
////////////////////////////////////////////////////////////////////////////////
//
// オーヴァドライヴ
//
////////////////////////////////////////////////////////////////////////////////
class Overdrive
{
public:
Overdrive( void );
~Overdrive();
void Init( Player* pParent, const OVERDRIVE_PARAM* pParam );
void Reset( void );
void Update( void );
void DriveSpear( void );
void DriveRuler( void );
void CancelState( void );
void AllErase( void );
float Regenerate( float Energy );
float OnGetItem( float Energy );
bool IsActive( void ) const { return m_State != STATE_NONE; }
bool IsReady( void ) const { return m_State == STATE_READY; }
bool IsInvincible( void ) const { return m_bInvincible; }
bool IsSpearEnable( void ) const;
bool IsRulerEnable( void ) const;
private:
enum TYPE
{
TYPE_SPEAR,
TYPE_RULER,
};
enum STATE
{
STATE_NONE,
STATE_READY,
STATE_AFTER,
};
typedef std::list< Spear* > SpearList;
typedef std::list< Ruler* > RulerList;
private:
void _UpdateReady( void );
void _UpdateAfter( void );
void _UpdateInvincible( void );
void _UpdateIndicate( void );
void _ExecSpear( void );
void _ExecRuler( void );
void _UpdateSpear( void );
void _UpdateRuler( void );
private:
Player* m_pParent;
const OVERDRIVE_PARAM* m_pParam;
TYPE m_Type;
STATE m_State;
float m_ReadyEnergy;
bool m_bInvincible;
int m_Delay;
OverdriveEnergy* m_pEnergy;
SpearList m_SpearList;
RulerList m_RulerList;
RefPtr<Effect> m_pIndicateEffect;
RefPtr<Effect> m_pSpearLockEffect;
};
////////////////////////////////////////////////////////////////////////////////
//
// オーヴァドライヴエネルギー
//
////////////////////////////////////////////////////////////////////////////////
class OverdriveEnergy
{
public:
OverdriveEnergy( const OVERDRIVE_PARAM* pParam );
void Reset( void );
void Update( void );
void Drive( float Use );
float Regenerate( float Energy );
float OnGetItem( float Energy );
float GetEnergy( void ) const { return m_Energy; }
float GetEnergyRate( void ) const;
float GetEnergySectorRate( void ) const;
int GetEnergySectorNum( void ) const;
bool IsDriveEnable( float Use ) const;
bool IsEnergyFull( void ) const;
private:
const OVERDRIVE_PARAM* m_pParam;
float m_Energy;
}; | [
"[email protected]"
] | |
a63304604489c5cbd724ecbf41c1dbaa0e93e8a1 | 08c37c6a806e355e542df9433bac3406dcdbf2f8 | /Pods/Headers/glm/gtx/color_space_YCoCg.inl | 06d35f1575bcef737f49da68485a06c46f438b4b | [] | no_license | Mark117/MScProject | c93312f499b1cb5e561fd93d4ee100f492cc6890 | 0fb2fb91cb0e00de6245591b389948493ba7e20d | refs/heads/master | 2021-03-12T23:34:00.841927 | 2014-08-27T20:06:32 | 2014-08-27T20:06:32 | 22,956,895 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 42 | inl | ../../../glm/glm/gtx/color_space_YCoCg.inl | [
"[email protected]"
] | |
aca19e0694707c85759bc85dbcda690d13ae6ab7 | a2111a80faf35749d74a533e123d9da9da108214 | /raw/workshop11/seqan-trunk/core/tests/refinement/test_graph_impl_align.h | ae424d26a7f73eb36753940ee6778bf23d5dae82 | [
"MIT",
"BSD-3-Clause"
] | permissive | bkahlert/seqan-research | f2c550d539f511825842a60f6b994c1f0a3934c2 | 21945be863855077eec7cbdb51c3450afcf560a3 | refs/heads/master | 2022-12-24T13:05:48.828734 | 2015-07-01T01:56:22 | 2015-07-01T01:56:22 | 21,610,669 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,071 | h | // ==========================================================================
// SeqAn - The Library for Sequence Analysis
// ==========================================================================
// Copyright (c) 2006-2010, Knut Reinert, FU Berlin
// 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 Knut Reinert or the FU Berlin 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 KNUT REINERT OR THE FU BERLIN 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 <seqan/basic.h>
#ifndef SEQAN_HEADER_TEST_GRAPH_IMPL_ALIGN_H
#define SEQAN_HEADER_TEST_GRAPH_IMPL_ALIGN_H
namespace SEQAN_NAMESPACE_MAIN {
//////////////////////////////////////////////////////////////////////////////
SEQAN_DEFINE_TEST(AlignmentGraphFunctions)
{
//____________________________________________________________________________
// Alignment without edge weights
typedef String<Dna> TString;
typedef StringSet<TString, Dependent<> > TStringSet;
typedef Graph<Alignment<TStringSet, void> > TGraph;
typedef VertexDescriptor<TGraph>::Type TVertexDescriptor;
typedef EdgeDescriptor<TGraph>::Type TEdgeDescriptor;
typedef Id<TStringSet>::Type TId;
TVertexDescriptor nilVertex = getNil<TVertexDescriptor>();
// Difference between Owner and Dependent
typedef StringSet<TString, Owner<> > TOwnerStringSet;
TStringSet str;
TOwnerStringSet ownStr;
TString str0("acaagtaacataaaaaaaaaaaaaaaacccccccccttttttttaaaaa");
TId id0 = assignValueById(str, str0);
appendValue(ownStr, str0);
TString str1("cccaaagggtttttccccccccccccttttttttttaaaaaaagggggggg");
TId id1 = assignValueById(str, str1);
appendValue(ownStr, str1);
TString str2("cacatgtaatcatgggggggggccccccttttaaaaaaaaaaatttt");
TId id2 = assignValueById(str, str2);
appendValue(ownStr, str2);
// Check that the graph makes a dependent StringSet
TGraph alwaysDependStringSet(ownStr);
SEQAN_ASSERT(length(value(stringSet(alwaysDependStringSet),0)) == length(str0));
clear(alwaysDependStringSet);
SEQAN_ASSERT(length(value(ownStr,0)) == length(str0));
assignStringSet(alwaysDependStringSet, ownStr);
SEQAN_ASSERT(length(value(stringSet(alwaysDependStringSet),0)) == length(str0));
clear(ownStr);
SEQAN_ASSERT(empty(ownStr));
TGraph g(str);
SEQAN_ASSERT(getStringSet(g)[0] == str0);
SEQAN_ASSERT(getStringSet(g)[1] == str1);
SEQAN_ASSERT(stringSet(g)[2] == str2);
assignStringSet(g, str);
SEQAN_ASSERT(getStringSet(g)[0] == str0);
SEQAN_ASSERT(getStringSet(g)[1] == str1);
SEQAN_ASSERT(stringSet(g)[2] == str2);
SEQAN_ASSERT(numEdges(g) == 0);
SEQAN_ASSERT(numVertices(g) == 0);
SEQAN_ASSERT(empty(g) == true);
TVertexDescriptor v0 = addVertex(g, id1,0,2);
SEQAN_ASSERT(v0 == 0);
SEQAN_ASSERT(outDegree(g, v0) == 0);
SEQAN_ASSERT(inDegree(g, 0) == 0);
SEQAN_ASSERT(degree(g, 0) == 0);
SEQAN_ASSERT(numVertices(g) == 1);
SEQAN_ASSERT(empty(g) == false);
SEQAN_ASSERT(sequenceId(g, v0) == id1);
SEQAN_ASSERT(label(g, v0) == "cc");
SEQAN_ASSERT(fragmentBegin(g, v0) == 0);
SEQAN_ASSERT(fragmentLength(g, v0) == 2);
SEQAN_ASSERT(findVertex(g, id1, 0) == v0);
SEQAN_ASSERT(findVertex(g, id1, 1) == v0);
SEQAN_ASSERT(findVertex(g, id1, 2) == nilVertex);
TVertexDescriptor v1 = addVertex(g, id2, 0, 5);
TEdgeDescriptor e =addEdge(g,0,1);
SEQAN_ASSERT(_getVertexString(g)[0] == e);
SEQAN_ASSERT(getIdUpperBound(_getVertexIdManager(g)) == 2);
SEQAN_ASSERT(getIdUpperBound(_getEdgeIdManager(g)) == 1);
SEQAN_ASSERT(v1 == 1);
SEQAN_ASSERT(numVertices(g) == 2);
SEQAN_ASSERT(targetVertex(g, e) == 1);
SEQAN_ASSERT(sourceVertex(g, e) == 0);
SEQAN_ASSERT(numEdges(g) == 1);
SEQAN_ASSERT(outDegree(g, v0) == 1);
SEQAN_ASSERT(inDegree(g, 1) == 1);
SEQAN_ASSERT(inDegree(g, 0) == 1);
SEQAN_ASSERT(degree(g, 0) == 1);
SEQAN_ASSERT(findVertex(g, id2, 0) == v1);
SEQAN_ASSERT(findVertex(g, id2, 1) == v1);
SEQAN_ASSERT(findVertex(g, id2, 4) == v1);
SEQAN_ASSERT(findVertex(g, id2, 5) == nilVertex);
// Add more vertices and edges
addVertex(g, id1, 10, 20); //2
SEQAN_ASSERT(findVertex(g, id1, 0) == v0);
SEQAN_ASSERT(findVertex(g, id1, 1) == v0);
SEQAN_ASSERT(findVertex(g, id1, 2) == nilVertex);
SEQAN_ASSERT(findVertex(g, id1, 10) == 2);
SEQAN_ASSERT(findVertex(g, id1, 19) == 2);
SEQAN_ASSERT(findVertex(g, id1, 30) == nilVertex);
TVertexDescriptor v3 = addVertex(g, id2, 5, 2); //3
addVertex(g, id1, 7, 3); //4
addEdge(g,3,4);
TEdgeDescriptor my_edge = addEdge(g,3,1);
addEdge(g,3,0);
SEQAN_ASSERT(v3 == 3);
SEQAN_ASSERT(numVertices(g) == 5);
SEQAN_ASSERT(targetVertex(g, my_edge) == 3);
SEQAN_ASSERT(sourceVertex(g, my_edge) == 1);
SEQAN_ASSERT(numEdges(g) == 4);
SEQAN_ASSERT(outDegree(g, v3) == 3);
SEQAN_ASSERT(inDegree(g, v3) == 3);
SEQAN_ASSERT(degree(g, v3) == 3);
// Remove edges
removeEdge(g,3,1);
removeEdge(g,0,1);
SEQAN_ASSERT(numEdges(g) == 2);
// Remove vertices
addVertex(g, id2, 14, 4); //5
addEdge(g,5,2);
addEdge(g,2,3);
addEdge(g,1,3);
addEdge(g,1,4);
SEQAN_ASSERT(outDegree(g, 3) == 4);
SEQAN_ASSERT(outDegree(g, 4) == 2);
removeVertex(g, v3);
SEQAN_ASSERT(outDegree(g, 4) == 1);
SEQAN_ASSERT(outDegree(g, 0) == 0);
SEQAN_ASSERT(numVertices(g) == 5);
SEQAN_ASSERT(numEdges(g) == 2);
// Clear graph
clearEdges(g);
SEQAN_ASSERT(numVertices(g) == 5);
SEQAN_ASSERT(numEdges(g) == 0);
addEdge(g,2,0);
addEdge(g,4,1);
clearVertices(g);
SEQAN_ASSERT(numVertices(g) == 0);
SEQAN_ASSERT(numEdges(g) == 0);
addVertex(g,id1,0,1);addVertex(g,id1,1,1);addVertex(g,id1,2,1);
addVertex(g,id1,3,1);addVertex(g,id1,4,1);
addEdge(g,2,0);
addEdge(g,4,1);
clear(g);
assignStringSet(g, str);
SEQAN_ASSERT(numVertices(g) == 0);
SEQAN_ASSERT(numEdges(g) == 0);
addVertex(g,id1,0,1);addVertex(g,id1,1,1);addVertex(g,id1,2,1);
addVertex(g,id1,3,1);addVertex(g,id1,4,1);
addEdge(g,2,0);
addEdge(g,4,1);
addEdge(g,4,2);
removeVertex(g,3);
SEQAN_ASSERT(numVertices(g) == 4);
SEQAN_ASSERT(numEdges(g) == 3);
SEQAN_ASSERT(outDegree(g, 4) == 2);
SEQAN_ASSERT(inDegree(g, 4) == 2);
// Transpose
transpose(g);
SEQAN_ASSERT(numVertices(g) == 4);
SEQAN_ASSERT(numEdges(g) == 3);
SEQAN_ASSERT(outDegree(g, 4) == 2);
SEQAN_ASSERT(inDegree(g, 4) == 2);
TGraph g_copy(g);
SEQAN_ASSERT(numVertices(g_copy) == 4);
SEQAN_ASSERT(numEdges(g_copy) == 3);
SEQAN_ASSERT(outDegree(g_copy, 4) == 2);
SEQAN_ASSERT(inDegree(g_copy, 4) == 2);
addVertex(g_copy, id0, 0, 3);
addEdge(g_copy,3,0);
g_copy = g;
SEQAN_ASSERT(numVertices(g_copy) == 4);
SEQAN_ASSERT(numEdges(g_copy) == 3);
SEQAN_ASSERT(outDegree(g_copy, 4) == 2);
SEQAN_ASSERT(inDegree(g_copy, 4) == 2);
//Copies the graph and transposes just the copy
transpose(g,g_copy); // g does not change!
SEQAN_ASSERT(numVertices(g_copy) == 4);
SEQAN_ASSERT(numEdges(g_copy) == 3);
SEQAN_ASSERT(outDegree(g_copy, 4) == 2);
SEQAN_ASSERT(inDegree(g_copy, 4) == 2);
// Adjacency matrix
String<unsigned int> mat;
getAdjacencyMatrix(g, mat);
unsigned int len = (unsigned int) std::sqrt((double) length(mat));
SEQAN_ASSERT(getValue(mat,0*len+2) == 1);
SEQAN_ASSERT(getValue(mat,3*len+2) == 0);
SEQAN_ASSERT(getValue(mat,0*len+2) == getValue(mat,2*len+0));
SEQAN_ASSERT(getValue(mat,1*len+4) == getValue(mat,4*len+1));
SEQAN_ASSERT(getValue(mat,2*len+4) == getValue(mat,4*len+2));
//____________________________________________________________________________
// Alignments with edge weights
typedef Graph<Alignment<TStringSet> > TGraph2;
typedef VertexDescriptor<TGraph2>::Type TVertexDescriptor2;
typedef EdgeDescriptor<TGraph2>::Type TEdgeDescriptor2;
TGraph2 g2(str);
SEQAN_ASSERT(numEdges(g2) == 0);
SEQAN_ASSERT(numVertices(g2) == 0);
SEQAN_ASSERT(empty(g2) == true);
TVertexDescriptor2 v20 = addVertex(g2, id1,0, 2);
TVertexDescriptor2 v21 = addVertex(g2, id2, 0, 5);
SEQAN_ASSERT(v20 == 0);
SEQAN_ASSERT(v21 == 1);
TEdgeDescriptor2 e2 =addEdge(g2,0,1, 100);
SEQAN_ASSERT(getCargo(e2) == 100);
SEQAN_ASSERT(numEdges(g2) == 1);
removeEdge(g2,e2);
SEQAN_ASSERT(numEdges(g2) == 0);
e2 =addEdge(g2,0,1, 1005);
SEQAN_ASSERT(numEdges(g2) == 1);
removeOutEdges(g2,0);
SEQAN_ASSERT(numEdges(g2) == 0);
e2 =addEdge(g2,0,1, 1005);
SEQAN_ASSERT(findEdge(g2, 0, 1) == e2);
SEQAN_ASSERT(numEdges(g2) == 1);
removeInEdges(g2,0);
SEQAN_ASSERT(numEdges(g2) == 0);
// Vertex Iterator
typedef Iterator<TGraph, VertexIterator>::Type TVertexIterator;
TVertexIterator itV(g);
SEQAN_ASSERT(atBegin(itV)==true);
SEQAN_ASSERT(getValue(itV)==0);
SEQAN_ASSERT(value(itV)==0);
SEQAN_ASSERT(getValue(itV)==0);
goNext(itV);
SEQAN_ASSERT(atBegin(itV)==false);
SEQAN_ASSERT(getValue(itV)==1);
++itV;
SEQAN_ASSERT(getValue(itV)==2);
SEQAN_ASSERT(atEnd(itV)==false);
goPrevious(itV);
SEQAN_ASSERT((*itV)==1);
SEQAN_ASSERT(atEnd(itV)==false);
itV--;
SEQAN_ASSERT(getValue(itV)==0);
SEQAN_ASSERT(atBegin(itV)==true);
// OutEdge Iterator
typedef Iterator<TGraph, OutEdgeIterator>::Type TOutEdgeIterator;
TOutEdgeIterator it(g, v0);
SEQAN_ASSERT(sourceVertex(g, getValue(it))==0);
SEQAN_ASSERT(targetVertex(g, getValue(it))==2);
SEQAN_ASSERT(sourceVertex(g, value(it))==0);
SEQAN_ASSERT(targetVertex(g, *it)==2);
SEQAN_ASSERT(atEnd(it)==false);
SEQAN_ASSERT(atBegin(it)==true);
goNext(it);
SEQAN_ASSERT(atEnd(it)==true);
SEQAN_ASSERT(atBegin(it)==false);
goPrevious(it);
SEQAN_ASSERT(sourceVertex(g, getValue(it))==0);
SEQAN_ASSERT(targetVertex(g, getValue(it))==2);
--it;
it--;
SEQAN_ASSERT(atBegin(it)==true);
TOutEdgeIterator it2(g, v0);
TOutEdgeIterator it3;
it3 = it;
SEQAN_ASSERT(it == it2);
SEQAN_ASSERT(it2 == it3);
goEnd(it);
SEQAN_ASSERT(it2 != it);
goEnd(it2);
SEQAN_ASSERT(it2 == it);
goBegin(it2);
SEQAN_ASSERT(it2 != it);
SEQAN_ASSERT(&g == &hostGraph(it));
// EdgeIterator
typedef Iterator<TGraph, EdgeIterator>::Type TEdgeIterator;
TEdgeIterator itEdge(g);
SEQAN_ASSERT(sourceVertex(g, getValue(itEdge))==0);
SEQAN_ASSERT(targetVertex(g, getValue(itEdge))==2);
SEQAN_ASSERT(sourceVertex(g, value(itEdge))==0);
SEQAN_ASSERT(targetVertex(g, *itEdge)==2);
SEQAN_ASSERT(atEnd(itEdge)==false);
SEQAN_ASSERT(atBegin(itEdge)==true);
goNext(itEdge);
SEQAN_ASSERT(sourceVertex(g, value(itEdge))==1);
SEQAN_ASSERT(targetVertex(g, *itEdge)==4);
++itEdge;
--itEdge;
SEQAN_ASSERT(sourceVertex(g, value(itEdge))==1);
SEQAN_ASSERT(targetVertex(g, *itEdge)==4);
goEnd(itEdge);
SEQAN_ASSERT(atEnd(itEdge)==true);
SEQAN_ASSERT(atBegin(itEdge)==false);
goBegin(itEdge);
SEQAN_ASSERT(atEnd(itEdge)==false);
SEQAN_ASSERT(atBegin(itEdge)==true);
// Adjacency Iterator
typedef Iterator<TGraph, AdjacencyIterator>::Type TAdjacencyIterator;
TAdjacencyIterator itAdj(g,2);
SEQAN_ASSERT(getValue(itAdj) == 4);
SEQAN_ASSERT(&hostGraph(itAdj) == &g);
SEQAN_ASSERT(value(itAdj) == 4);
SEQAN_ASSERT(*itAdj == 4);
SEQAN_ASSERT(atEnd(itAdj)==false);
SEQAN_ASSERT(atBegin(itAdj)==true);
goNext(itAdj);
SEQAN_ASSERT(*itAdj == 0);
SEQAN_ASSERT(atEnd(itAdj)==false);
SEQAN_ASSERT(atBegin(itAdj)==false);
++itAdj;
SEQAN_ASSERT(atEnd(itAdj)==true);
SEQAN_ASSERT(atBegin(itAdj)==false);
goPrevious(itAdj);--itAdj;
SEQAN_ASSERT(*itAdj == 4);
goBegin(itAdj);
SEQAN_ASSERT(atBegin(itAdj)==true);
goEnd(itAdj);
SEQAN_ASSERT(atEnd(itAdj)==true);
// Bfs Iterator
typedef Iterator<TGraph, BfsIterator>::Type TBfsIterator;
TBfsIterator bfsIt(g,2);
SEQAN_ASSERT(atEnd(bfsIt)==false);
SEQAN_ASSERT(atBegin(bfsIt)==true);
++bfsIt;
SEQAN_ASSERT(getValue(bfsIt) == 4);
SEQAN_ASSERT(&hostGraph(bfsIt) == &g);
SEQAN_ASSERT(value(bfsIt) == 4);
SEQAN_ASSERT(*bfsIt == 4);
goNext(bfsIt);
SEQAN_ASSERT(value(bfsIt) == 0);
// Dfs Iterator
typedef Iterator<TGraph, DfsPreorder>::Type TDfsPreorder;
TDfsPreorder dfsIt(g,2);
SEQAN_ASSERT(atEnd(dfsIt)==false);
SEQAN_ASSERT(atBegin(dfsIt)==true);
SEQAN_ASSERT(*dfsIt == 2);
++dfsIt;
SEQAN_ASSERT(getValue(dfsIt) == 0);
SEQAN_ASSERT(&hostGraph(dfsIt) == &g);
SEQAN_ASSERT(value(dfsIt) == 0);
SEQAN_ASSERT(*dfsIt == 0);
goNext(dfsIt);
// Alignments
typedef String<char> TAlignString;
typedef StringSet<TAlignString, Dependent<> > TAlignStringSet;
typedef Graph<Alignment<TAlignStringSet, void> > TAlignmentGraph;
typedef VertexDescriptor<TAlignmentGraph>::Type TVD;
typedef EdgeDescriptor<TAlignmentGraph>::Type TED;
TAlignStringSet al;
TAlignString al0("Garfieldthelastfatcat");
TId i0 = assignValueById(al, al0);
TAlignString al1("Garfieldthefastcat");
TId i1 = assignValueById(al, al1);
TAlignString al2("Garfieldtheveryfastcat");
TId i2 = assignValueById(al, al2);
TAlignString al3("thefatcat");
TId i3 = assignValueById(al, al3);
TAlignmentGraph gAl(al);
TVD vH = addVertex(gAl, i1, 8, 3);
SEQAN_ASSERT(getFirstCoveredPosition(gAl, i3) == 9); // Not found, length of the sequence
SEQAN_ASSERT(getLastCoveredPosition(gAl, i3) == 0); // Not found, length of the sequence
SEQAN_ASSERT(getFirstCoveredPosition(gAl, i1) == 8);
SEQAN_ASSERT(getLastCoveredPosition(gAl, i1) == 11);
TVD vT = addVertex(gAl, i1, 13, 1);TVD vS = addVertex(gAl, i3, 6, 3);
TVD vW = addVertex(gAl, i2, 18, 1);TVD vA = addVertex(gAl, i0, 0, 8);
SEQAN_ASSERT(getFirstCoveredPosition(gAl, i0) == 0);
SEQAN_ASSERT(getLastCoveredPosition(gAl, i0) == 8);
TVD vM = addVertex(gAl, i2, 11, 4);
TVD vK = addVertex(gAl, i2, 0, 8);TVD vC = addVertex(gAl, i0, 11, 4);TVD vD = addVertex(gAl, i0, 15, 2);
TVD vF = addVertex(gAl, i0, 18, 3);TVD vG = addVertex(gAl, i1, 0, 8);addEdge(gAl, vA, vG);
TVD vI = addVertex(gAl, i1, 11, 2);TVD vQ = addVertex(gAl, i3, 3, 2);TVD vB = addVertex(gAl, i0, 8, 3);
TVD vU = addVertex(gAl, i1, 14, 1);TVD vE = addVertex(gAl, i0, 17, 1);TVD vJ = addVertex(gAl, i1, 15, 3);
TVD vL = addVertex(gAl, i2, 8, 3);
addEdge(gAl, vH, vL);
TVD vN = addVertex(gAl, i2, 15, 2);TVD vV = addVertex(gAl, i2, 17, 1);
TVD vO = addVertex(gAl, i2, 19, 3);TVD vP = addVertex(gAl, i3, 0, 3);TVD vR = addVertex(gAl, i3, 5, 1);
addEdge(gAl, vA, vK);addEdge(gAl, vG, vK);addEdge(gAl, vB, vH);addEdge(gAl, vB, vL);
addEdge(gAl, vB, vP);addEdge(gAl, vH, vP);addEdge(gAl, vL, vP);addEdge(gAl, vC, vM);
addEdge(gAl, vD, vI);addEdge(gAl, vD, vQ);addEdge(gAl, vD, vN);addEdge(gAl, vI, vQ);
addEdge(gAl, vI, vN);addEdge(gAl, vQ, vN);addEdge(gAl, vT, vV);addEdge(gAl, vE, vU);
addEdge(gAl, vE, vW);addEdge(gAl, vE, vR);addEdge(gAl, vU, vW);addEdge(gAl, vU, vR);
addEdge(gAl, vW, vR);addEdge(gAl, vF, vJ);addEdge(gAl, vF, vO);addEdge(gAl, vF, vS);
addEdge(gAl, vJ, vO);addEdge(gAl, vJ, vS);addEdge(gAl, vO, vS);
SEQAN_ASSERT(getFirstCoveredPosition(gAl, i3) == 0);
SEQAN_ASSERT(getLastCoveredPosition(gAl, i3) == 9);
// Output of the alignment graph
std::cout << gAl << std::endl;
StringSet<String<char> > seqs;
appendValue(seqs, "seq1");
appendValue(seqs, "seq2");
appendValue(seqs, "seq3");
appendValue(seqs, "seq4");
write(std::cout,gAl,seqs,FastaFormat());
write(std::cout,gAl,seqs,MsfFormat());
write(std::cout,gAl,seqs,CgVizFormat());
}
//////////////////////////////////////////////////////////////////////////////
SEQAN_DEFINE_TEST(HeaviestCommonSubsequence)
{
typedef String<AminoAcid> TString;
typedef StringSet<TString, Dependent<> > TStringSet;
typedef Graph<Alignment<TStringSet, int> > TGraph;
typedef VertexDescriptor<TGraph>::Type TVertexDescriptor;
TString s1 = "aaa";
TString s2 = "aa";
TStringSet strSet;
assignValueById(strSet, s1);
assignValueById(strSet, s2);
TGraph g(strSet);
addVertex(g, 0, 0, 1);
addVertex(g, 0, 1, 1);
addVertex(g, 0, 2, 1);
addVertex(g, 1, 0, 1);
addVertex(g, 1, 1, 1);
addEdge(g, 0, 3, 10); addEdge(g, 0, 4, 15);
addEdge(g, 1, 3, 10); addEdge(g, 1, 4, 10);
addEdge(g, 2, 3, 15); addEdge(g, 2, 4, 10);
String<String<TVertexDescriptor> > str1;
String<String<TVertexDescriptor> > str2;
String<String<TVertexDescriptor> > align;
String<TVertexDescriptor> tmp;
clear(tmp); appendValue(tmp, 0); appendValue(str1, tmp);
clear(tmp); appendValue(tmp, 1); appendValue(str1, tmp);
clear(tmp); appendValue(tmp, 2); appendValue(str1, tmp);
clear(tmp); appendValue(tmp, 3); appendValue(str2, tmp);
clear(tmp); appendValue(tmp, 4); appendValue(str2, tmp);
SEQAN_ASSERT(heaviestCommonSubsequence(g, str1, str2, align) == 20);
s1 = "aaaaa";
s2 = "aaa";
clear(strSet);
assignValueById(strSet, s1);
assignValueById(strSet, s2);
assignStringSet(g, strSet);
addVertex(g, 0, 0, 2);
addVertex(g, 0, 2, 1);
addVertex(g, 0, 3, 2);
addVertex(g, 1, 0, 1);
addVertex(g, 1, 1, 2);
addEdge(g, 0, 4, 10); addEdge(g, 1, 3, 20);
clear(align);
clear(str1);
clear(str2);
clear(tmp); appendValue(tmp, 0); appendValue(str1, tmp);
clear(tmp); appendValue(tmp, 1); appendValue(str1, tmp);
clear(tmp); appendValue(tmp, 2); appendValue(str1, tmp);
clear(tmp); appendValue(tmp, 3); appendValue(str2, tmp);
clear(tmp); appendValue(tmp, 4); appendValue(str2, tmp);
heaviestCommonSubsequence(g, str1, str2, align);
}
//////////////////////////////////////////////////////////////////////////////
SEQAN_DEFINE_TEST(OutEdgeIteratorAlignment)
{
//____________________________________________________________________________
// Graph AlignmentOutEdgeIterator
typedef String<Dna> TString;
typedef StringSet<TString, Dependent<> > TStringSet;
typedef Graph<Alignment<TStringSet> > TGraph;
typedef VertexDescriptor<TGraph>::Type TVertexDescriptor;
typedef EdgeDescriptor<TGraph>::Type TEdgeDescriptor;
TString str1 = "aa";
TString str2 = "ac";
TStringSet strSet;
appendValue(strSet, str1);
appendValue(strSet, str2);
TGraph g(strSet);
TVertexDescriptor v0 = addVertex(g,0,0,1);
addVertex(g,0,1,1);
addVertex(g,1,0,1);
addEdge(g,0,2,10);
addVertex(g,1,1,1);
typedef Iterator<TGraph, OutEdgeIterator>::Type TOutEdgeIterator;
TOutEdgeIterator it(g, v0);
SEQAN_ASSERT(sourceVertex(g, getValue(it))==0);
SEQAN_ASSERT(targetVertex(g, getValue(it))==2);
SEQAN_ASSERT(sourceVertex(g, value(it))==0);
SEQAN_ASSERT(targetVertex(g, *it)==2);
SEQAN_ASSERT(atEnd(it)==false);
SEQAN_ASSERT(atBegin(it)==true);
// Slow
SEQAN_ASSERT(sourceVertex(g, getValue(it))==0);
SEQAN_ASSERT(targetVertex(g, getValue(it))==2);
// Fast
SEQAN_ASSERT(sourceVertex(it)==0);
SEQAN_ASSERT(targetVertex(it)==2);
SEQAN_ASSERT(atEnd(it)==false);
SEQAN_ASSERT(atBegin(it)==true);
++it;
SEQAN_ASSERT(atEnd(it)==true);
SEQAN_ASSERT(atBegin(it)==false);
goPrevious(it);
SEQAN_ASSERT(sourceVertex(g, getValue(it))==0);
SEQAN_ASSERT(targetVertex(g, getValue(it))==2);
goNext(it);
--it;
TOutEdgeIterator it2(g, v0);
TOutEdgeIterator it3;
it3 = it;
SEQAN_ASSERT(it == it2);
SEQAN_ASSERT(it2 == it3);
goEnd(it);
SEQAN_ASSERT(it2 != it);
goEnd(it2);
SEQAN_ASSERT(it2 == it);
goBegin(it2);
SEQAN_ASSERT(it2 != it);
SEQAN_ASSERT(&g == &hostGraph(it));
}
} // namespace SEQAN_NAMESPACE_MAIN
#endif
| [
"[email protected]"
] | |
4e4b6cc9f8efb3ac1a71ad2bc6106ce7ed4f6f50 | ab72eed10fbc3613a13bc3f3f04cf72a91d9c6d2 | /core/src/Foundation/Containers/Set.hpp | 7f810f147bee22b22966668a13cce0a82d4fffc5 | [
"BSD-3-Clause"
] | permissive | sugatmankar/crimild | 94c8007f28bd16d2321aef7b254e2207e36f3d89 | e3efee09489939338df55e8af9a1f9ddc01301f7 | refs/heads/master | 2020-05-07T11:10:42.061705 | 2018-12-12T12:45:04 | 2018-12-12T12:45:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,417 | hpp | /*
* Copyright (c) 2013-2018, Hernan Saez
* 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.
*/
#ifndef CRIMILD_FOUNDATION_CONTAINERS_SET_
#define CRIMILD_FOUNDATION_CONTAINERS_SET_
#include "Array.hpp"
#include "Foundation/Types.hpp"
#include "Foundation/Policies/ThreadingPolicy.hpp"
#include <functional>
#include <iostream>
#include <unordered_set>
namespace crimild {
namespace containers {
/**
\brief A set implementation
\todo Implement index bound checking policy
\todo Implement parallel policy
*/
template<
typename ValueType,
class ThreadingPolicy = policies::SingleThreaded,
class SetImpl = std::unordered_set< ValueType >
>
class Set : public ThreadingPolicy {
private:
using LockImpl = typename ThreadingPolicy::Lock;
public:
using TraverseCallback = std::function< void( ValueType const & ) >;
using ConstTraverseCallback = std::function< void( const ValueType & ) >;
public:
Set( void )
{
}
Set( std::initializer_list< ValueType > l )
: _set( l )
{
}
Set( const Set &other )
: _set( other._set )
{
}
virtual ~Set( void )
{
_set.clear();
}
Set &operator=( const Set &other )
{
LockImpl lock( this );
_set = other._set;
return *this;
}
crimild::Bool operator==( const Set &other ) const
{
LockImpl lock( this );
return _set == other._set;
}
inline crimild::Bool empty( void ) const
{
LockImpl lock( this );
return _set.empty();
}
inline crimild::Size size( void ) const
{
LockImpl lock( this );
return _set.size();
}
inline void clear( void )
{
LockImpl lock( this );
_set.clear();
}
inline bool contains( const ValueType &value ) const
{
LockImpl lock( this );
return _set.count( value ) > 0;
}
void insert( ValueType const &value )
{
LockImpl lock( this );
_set.insert( value );
}
void remove( ValueType const &value )
{
LockImpl lock( this );
_set.erase( value );
}
void each( TraverseCallback const &callback )
{
LockImpl lock( this );
for ( auto &v : _set ) {
callback( v );
}
}
void each( ConstTraverseCallback const &callback ) const
{
LockImpl lock( this );
for ( const auto &v : _set ) {
callback( v );
}
}
private:
SetImpl _set;
};
template< typename VALUE_TYPE >
using ThreadSafeSet = Set< VALUE_TYPE, policies::ObjectLevelLockable >;
}
}
template<
typename VT,
class TP
>
std::ostream& operator<<( std::ostream& os, const crimild::containers::Set< VT, TP > &set )
{
os << "[";
crimild::Bool first = true;
set.each( [ &os, &first ]( const VT &v ) {
os << ( first == 0 ? "" : ", " ) << v;
first = false;
});
os << "]";
return os;
}
#endif
| [
"[email protected]"
] | |
782d26cc3e3e5724a2457fb216c0f8b23ba90bc3 | dec7eace447c54a592b31902d215a1a7d7bdb3a5 | /Tree/102. Binary Tree Level Order Traversal.cpp | 2a7c15cc47cca3d562f79188c1b994a628b10c46 | [] | no_license | robini/LeetCode | e0d09a6e363a5fce344a4b4135d7d52a4e40ed2e | e19205ae2f1f383d87b20a1131808da2a2cb8d11 | refs/heads/master | 2021-01-24T10:49:33.615221 | 2018-05-14T15:46:16 | 2018-05-14T15:46:16 | 123,066,603 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 790 | cpp | /**
* Definition for a binary tree node.
* struct TreeNode {
* int val;
* TreeNode *left;
* TreeNode *right;
* TreeNode(int x) : val(x), left(NULL), right(NULL) {}
* };
*/
class Solution {
public:
vector<vector<int>> levelOrder(TreeNode* root) {
vector<vector<int>> res;
if (!root)
return res;
vector<int> level;
deque<TreeNode*> dq;
dq.push_back(root);
dq.push_back(NULL);
while (!dq.empty())
{
TreeNode* t = dq.front();
dq.pop_front();
if (t == NULL)
{
res.push_back(level);
level.clear();
if (!dq.empty())
{
dq.push_back(NULL);
}
}
else
{
level.push_back(t->val);
if (t->left != NULL)
dq.push_back(t->left);
if (t->right != NULL)
dq.push_back(t->right);
}
}
return res;
}
}; | [
"[email protected]"
] | |
b754c0a4ce5b288778d608abcd4d1fbd213edd6e | 667441fdca2e9accd1b59eccdb06be592db695ee | /tools/backend_c/backend_c.cpp | 99a6b93d056473d3c3396e4e302f392894268b1e | [
"MIT"
] | permissive | arlosi/mrustc | 6b398cbc551b5c5b3eb21561cfb813b4f4c96b1c | b151c9aaafcf476b85af7d96b50e3e2ac0df646e | refs/heads/master | 2022-10-04T12:20:27.431675 | 2021-06-26T06:50:55 | 2021-06-26T06:50:55 | 222,812,916 | 0 | 0 | MIT | 2019-11-19T23:57:13 | 2019-11-19T23:57:12 | null | UTF-8 | C++ | false | false | 8,766 | cpp | /*
* mrustc - Standalone C backend
*/
#include <string>
#include <iostream>
#include <module_tree.hpp>
#include "codegen.hpp"
#include <algorithm>
struct Opts
{
::std::string infile;
::std::string outfile;
int parse(int argc, const char* argv[]);
void show_help(const char* prog) const;
};
int main(int argc, const char* argv[])
{
Opts opts;
if( int rv = opts.parse(argc, argv) )
return rv;
ModuleTree tree;
// 1. Load the tree
try
{
tree.load_file(opts.infile);
tree.validate();
}
catch(const DebugExceptionTodo& /*e*/)
{
::std::cerr << "Loading: TODO Hit" << ::std::endl;
return 1;
}
catch(const DebugExceptionError& /*e*/)
{
::std::cerr << "Loading: Error encountered" << ::std::endl;
return 1;
}
// 2. Recursively enumerate all types (determining the required emit ordering, and fancy types)
struct TypeEnumeration {
struct Compare {
using is_transparent = void;
static Ordering get_ord(const HIR::TypeRef& t1, const std::pair<const HIR::TypeRef*, unsigned>& t2) {
Ordering o;
o = ord(t1.inner_type, t2.first->inner_type); if(o != OrdEqual) return o;
o = ord( (uintptr_t)t1.ptr.function_type, (uintptr_t)t2.first->ptr.function_type ); if(o != OrdEqual) return o;
for(size_t i = 0; i < std::min( t1.wrappers.size(), t2.first->wrappers.size() - t2.second); i ++)
{
o = ord(t1.wrappers.at(i), t2.first->wrappers.at(t2.second + i)); if(o != OrdEqual) return o;
}
o = ord(t1.wrappers.size(), t2.first->wrappers.size() - t2.second); if(o != OrdEqual) return o;
return OrdEqual;
}
bool operator()(const HIR::TypeRef& t1, const std::pair<const HIR::TypeRef*, unsigned>& t2) const {
Ordering rv;
//TRACE_FUNCTION_R(t1 << ", " << *t2.first << "+" << t2.second, rv);
rv = get_ord(t1, t2);
return rv == OrdLess;
}
bool operator()(const std::pair<const HIR::TypeRef*, unsigned>& t1, const HIR::TypeRef& t2) const {
Ordering rv;
//TRACE_FUNCTION_R(*t1.first << "+" <<t1.second << ", " << t2, rv);
rv = get_ord(t2, t1);
return rv == OrdGreater;
}
bool operator()(const HIR::TypeRef& t1, const HIR::TypeRef& t2) {
return t1 < t2;
}
};
std::set<HIR::TypeRef, Compare> types_visited;
std::vector<HIR::TypeRef> types_to_emit;
std::vector<RcString> full_datatypes;
void visit_type(const HIR::TypeRef& t, unsigned depth=0, bool proto_only=false)
{
TRACE_FUNCTION_R(t << " depth=" << depth, "");
auto it = types_visited.find( std::make_pair(&t, depth) );
if( it != types_visited.end() )
{
// Already handled!
LOG_DEBUG("Already done");
return ;
}
// Add a clone to the list
HIR::TypeRef new_ty;
new_ty.inner_type = t.inner_type;
new_ty.ptr.function_type = t.ptr.function_type;
new_ty.wrappers.insert(new_ty.wrappers.begin(), t.wrappers.begin() + depth, t.wrappers.end());
types_visited.insert(new_ty);
// If it's a composite, recurse into it
// Otherwise, shallow recurse?
if(t.wrappers.size() == depth)
{
switch(t.inner_type)
{
case RawType::Unit:
break;
case RawType::Unreachable:
break;
case RawType::U8:
case RawType::I8:
case RawType::U16:
case RawType::I16:
case RawType::U32:
case RawType::I32:
case RawType::U64:
case RawType::I64:
case RawType::U128:
case RawType::I128:
case RawType::F32 :
case RawType::F64 :
case RawType::USize:
case RawType::ISize:
case RawType::Bool:
case RawType::Char:
case RawType::Str :
break;
case RawType::Composite:
if(!proto_only)
{
// Visit all inner types
// Add to deep list
}
break;
case RawType::TraitObject:
if(!proto_only)
{
}
break;
case RawType::Function: {
const auto& fty = *t.ptr.function_type;
// Shallow visit all inner types
for(const auto& ity : fty.args)
visit_type(ity, 0, true);
visit_type(fty.ret, 0, true);
} break;
}
}
else
{
const auto& w = t.wrappers.at(depth);
switch(w.type)
{
case TypeWrapper::Ty::Array:
this->visit_type(t, depth+1, proto_only);
break;
case TypeWrapper::Ty::Slice:
this->visit_type(t, depth+1, true);
break;
case TypeWrapper::Ty::Pointer:
case TypeWrapper::Ty::Borrow:
this->visit_type(t, depth+1, true);
break;
}
}
types_to_emit.push_back(std::move(new_ty));
}
} type_enum;
tree.iterate_statics([&](RcString name, const Static& s) {
type_enum.visit_type(s.ty);
});
tree.iterate_functions([&](RcString name, const Function& f) {
type_enum.visit_type(f.ret_ty);
for(auto& t : f.args)
type_enum.visit_type(t);
});
// 3. Emit C code
Codegen_C codegen(opts.outfile.c_str());
// - Emit types
// - Emit function/static prototypes
tree.iterate_statics([&](RcString name, const Static& s) {
codegen.emit_static_proto(name, s);
});
tree.iterate_functions([&](RcString name, const Function& f) {
codegen.emit_function_proto(name, f);
});
// - Emit statics
tree.iterate_statics([&](RcString name, const Static& s) {
codegen.emit_static(name, s);
});
// - Emit functions
tree.iterate_functions([&](RcString name, const Function& f) {
codegen.emit_function(name, tree, f);
});
return 0;
}
int Opts::parse(int argc, const char* argv[])
{
bool all_free = false;
for(int argidx = 1; argidx < argc; argidx ++)
{
const char* arg = argv[argidx];
if( arg[0] != '-' || all_free )
{
// Free arguments
// - First is the input file
if( this->infile == "" )
{
this->infile = arg;
}
else
{
::std::cerr << "Unexpected option -" << arg << ::std::endl;
return 1;
}
}
else if( arg[1] != '-' )
{
// Short arguments
if( arg[2] != '\0' ) {
// Error?
::std::cerr << "Unexpected option " << arg << ::std::endl;
return 1;
}
switch(arg[1])
{
case 'h':
this->show_help(argv[0]);
exit(0);
default:
::std::cerr << "Unexpected option -" << arg[1] << ::std::endl;
return 1;
}
}
else if( arg[2] != '\0' )
{
// Long
if( ::std::strcmp(arg, "--help") == 0 ) {
this->show_help(argv[0]);
exit(0);
}
//else if( ::std::strcmp(arg, "--target") == 0 ) {
//}
else {
::std::cerr << "Unexpected option " << arg << ::std::endl;
return 1;
}
}
else
{
all_free = true;
}
}
if( this->infile == "" )
{
this->show_help(argv[0]);
return 1;
}
if( this->outfile == "" )
{
this->outfile = "a.c";
}
return 0;
}
void Opts::show_help(const char* prog) const
{
::std::cout << "USAGE: " << prog << " <infile> <... args>" << ::std::endl;
}
| [
"[email protected]"
] | |
b791fb74b24f4b218c1f2678bc86f1e711f20c6e | c9c0f7b8f2c3a34a57b3fc81fb99829a532e7541 | /sum_of_medians.cpp | 327d8f60e3d8f3cf5b9c54c38124f9bf0fcbddeb | [
"MIT"
] | permissive | De-Fau-Lt/Solutions | 54d3da28ebc8c13048634b504f72d27961ba119d | 2539f815ab5c77769b3e3cc00fe0e7a7ec940ad5 | refs/heads/main | 2023-02-16T15:55:55.929750 | 2021-01-18T13:23:25 | 2021-01-18T13:23:25 | 305,923,415 | 0 | 0 | MIT | 2020-10-21T06:44:52 | 2020-10-21T06:00:31 | C++ | UTF-8 | C++ | false | false | 415 | cpp | #include <bits/stdc++.h>
#define ll long long
using namespace std;
int main()
{
int t;
cin >> t;
while(t--)
{
int n,k;
cin >> n >> k;
int arr[n*k];
for(auto &x:arr)
cin >> x;
int m=n/2;
int i=0;
int j=n*k-1;
int c=0;
int c2=k;
ll sum=0;
while(c2!=0)
{
if(c==m)
{
sum+=arr[j];
c=0;
c2--;
}
else c++;
j--;
}
cout << sum << "\n";
}
return 0;
}
| [
"[email protected]"
] | |
00c24e009b8fb24f4fc60e0d67e444b252eaedce | 7e02b6f30de86953e38509a06205d83fdb6550e8 | /CppCommandBasedForReal/src/main/include/Constants.hpp | 3ebfd309b08d851839df83add62896c13f0f773f | [] | no_license | pak-plau/CppNewbieBot | f9d28119c99efdee25cd87e7226da338472abab0 | 4d083cdf14c263a128735800ba3133b11a735fcd | refs/heads/master | 2022-12-18T20:05:48.491834 | 2020-09-10T22:37:29 | 2020-09-10T22:37:29 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,324 | hpp | /*----------------------------------------------------------------------------*/
/* Copyright (c) 2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/*----------------------------------------------------------------------------*/
#pragma once
/**
* The Constants header provides a convenient place for teams to hold robot-wide
* numerical or boolean constants. This should not be used for any other
* purpose.
*
* It is generally a good idea to place constants into subsystem- or
* command-specific namespaces within this header, which can then be used where
* they are needed.
*/
namespace stuy::Constants {
namespace Drivetrain {
constexpr int LEFT_TOP_PORT = 7;
constexpr int LEFT_BOT_PORT = 6;
constexpr int RIGHT_TOP_PORT = 4;
constexpr int RIGHT_BOT_PORT = 3;
}
namespace Intake {
constexpr int MOTOR_PORT = -1;
constexpr int SOLENOID_PORT_A = -1;
constexpr int SOLENOID_PORT_B = -1;
constexpr int SENSOR_PORT = -1;
constexpr double INTAKE_MOTOR_SPEED = -1;
}
} | [
"[email protected]"
] | |
56a1eb7d8d2168842da7cdcddf6a035284fde267 | 3e5aac2f8338e65c51ea312c1190fe674ce8f9f7 | /Engine/Source/Runtime/Core/Public/Misc/EngineVersion.h | 60e422b2eff2caa73bbf8d3376c2d68a57b95e05 | [] | no_license | blueness9527/SolidAngle | b48fa9562776f24fc9f165b53048ff6982d9570b | c1c329cd8f0dcd97387ea962f4f00c0b67ccffdf | refs/heads/master | 2021-04-09T13:22:03.333409 | 2017-07-25T02:34:39 | 2017-07-25T02:34:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,621 | h | // Copyright 1998-2017 Epic Games, Inc. All Rights Reserved.
#pragma once
#include "CoreTypes.h"
#include "Misc/EngineVersionBase.h"
#include "Containers/SolidAngleString.h"
/** Utility functions. */
class CORE_API FEngineVersion : public FEngineVersionBase
{
public:
/** Empty constructor. Initializes the version to 0.0.0-0. */
FEngineVersion();
/** Constructs a version from the given components. */
FEngineVersion(uint16 InMajor, uint16 InMinor, uint16 InPatch, uint32 InChangelist, const YString &InBranch);
/** Sets the version to the given values. */
void Set(uint16 InMajor, uint16 InMinor, uint16 InPatch, uint32 InChangelist, const YString &InBranch);
/** Clears the object. */
void Empty();
/** Checks compatibility with another version object. */
bool IsCompatibleWith(const FEngineVersionBase &Other) const;
/** Generates a version string */
YString ToString(EVersionComponent LastComponent = EVersionComponent::Branch) const;
/** Parses a version object from a string. Returns true on success. */
static bool Parse(const YString &Text, FEngineVersion &OutVersion);
/** Gets the current engine version */
static const FEngineVersion& Current();
/** Gets the earliest version which this engine maintains strict API and package compatibility with */
static const FEngineVersion& CompatibleWith();
/** Overrides the current changelist in the verison */
static bool OverrideCurrentVersionChangelist(int32 NewChangelist, int32 NewCompatibleChangelist);
/** Serialization function */
friend CORE_API void operator<<(class YArchive &Ar, FEngineVersion &Version);
/** Returns the branch name corresponding to this version. */
const YString GetBranch() const
{
return Branch.Replace(TEXT("+"), TEXT("/"));
}
private:
/** Branch name. */
YString Branch;
/** Global instance of the current engine version. */
static FEngineVersion CurrentVersion;
/** Earliest version which this engine maintains strict API and package compatibility with */
static FEngineVersion CompatibleWithVersion;
};
/** Version used for networking; the P4 changelist number. */
DEPRECATED(4.13, "Please use FNetworkVersion::GetNetworkCompatibleChangelist intead.")
CORE_API extern int32 GEngineNetVersion;
/** Earliest engine build that is network compatible with this one. */
DEPRECATED(4.13, "GEngineMinNetVersion is no longer a valid property.")
CORE_API extern const int32 GEngineMinNetVersion;
/** Base protocol version to negotiate in network play. */
DEPRECATED(4.13, "GEngineNegotiationVersion is no longer a valid property.")
CORE_API extern const int32 GEngineNegotiationVersion;
| [
"[email protected]"
] | |
ef303a957a0ee67ec7e15c4dabf6270ae7f394ef | 8eb23131229632fcf450310b0f79b2f6aed5c428 | /include/storage_types.hpp | cf2a7b1c846c769bc5abf674a631440d5f2bae87 | [] | no_license | wojciechzyla/production_line_simulation | 02500aa0b99fc92a32e9be75bff6bf6e651d1697 | b25b87facae7ae501feeeb572d85830415b278e0 | refs/heads/main | 2023-03-18T17:35:13.813241 | 2021-03-07T15:27:51 | 2021-03-07T15:27:51 | 344,579,865 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,653 | hpp | //
// Created by Wojciech Żyła on 20/12/2020.
//
#ifndef NET_SIMULATION_STORAGE_TYPES_HPP
#define NET_SIMULATION_STORAGE_TYPES_HPP
#include <list>
#include "types.hpp"
#include "package.hpp"
#include <iostream>
enum class PackageQueueType {
LIFO, FIFO
};
class IPackageStockpile{
public:
using const_iterator = std::list<Package>::const_iterator;
virtual void push(Package&&) = 0;
virtual int size() = 0;
virtual bool empty() = 0;
virtual const_iterator begin() const = 0;
virtual const_iterator end() const = 0;
virtual const_iterator cbegin() const = 0;
virtual const_iterator cend() const = 0;
virtual ~IPackageStockpile() {};
};
class IPackageQueue : public IPackageStockpile{
public:
virtual Package pop() = 0;
virtual PackageQueueType get_queue_type() = 0;
virtual ~IPackageQueue() {};
};
class PackageQueue : public IPackageQueue{
public:
PackageQueue(PackageQueueType type): queue_type_(type){}
const_iterator begin() const override {return products_.cbegin();}
const_iterator end() const override {return products_.cend();}
const_iterator cbegin() const override {return products_.cbegin();}
const_iterator cend() const override {return products_.cend();}
bool empty() override {return products_.empty();}
int size() override {return products_.size();}
void push(Package&& item) override {products_.emplace_back(std::move(item));}
Package pop() override;
PackageQueueType get_queue_type() override {return queue_type_;}
private:
std::list<Package> products_;
PackageQueueType queue_type_;
};
#endif //NET_SIMULATION_STORAGE_TYPES_HPP
| [
"[email protected]"
] | |
8c21504ea03c7f327945de96cb74e9348b6a9d28 | 600df3590cce1fe49b9a96e9ca5b5242884a2a70 | /buildtools/third_party/libc++/trunk/test/std/experimental/utilities/tuple/tuple.apply/constexpr_types.pass.cpp | 2d700486f26bdf612b5a676b00919c857d4f20d3 | [
"MIT",
"NCSA",
"BSD-3-Clause"
] | permissive | metux/chromium-suckless | efd087ba4f4070a6caac5bfbfb0f7a4e2f3c438a | 72a05af97787001756bae2511b7985e61498c965 | refs/heads/orig | 2022-12-04T23:53:58.681218 | 2017-04-30T10:59:06 | 2017-04-30T23:35:58 | 89,884,931 | 5 | 3 | BSD-3-Clause | 2022-11-23T20:52:53 | 2017-05-01T00:09:08 | null | UTF-8 | C++ | false | false | 2,715 | cpp | //===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// UNSUPPORTED: c++98, c++03, c++11
// TODO(ericwf)
// constexpr support temporarily reverted due to bug:
// https://llvm.org/bugs/show_bug.cgi?id=23141
// XFAIL: *
// <experimental/tuple>
// template <class F, class T> constexpr decltype(auto) apply(F &&, T &&)
// Testing constexpr evaluation
#include <experimental/tuple>
#include <utility>
#include <cassert>
constexpr int f_int_0() { return 1; }
constexpr int f_int_1(int x) { return x; }
constexpr int f_int_2(int x, int y) { return (x + y); }
struct A_int_0
{
constexpr A_int_0() {}
constexpr int operator()() const { return 1; }
};
struct A_int_1
{
constexpr A_int_1() {}
constexpr int operator()(int x) const { return x; }
};
struct A_int_2
{
constexpr A_int_2() {}
constexpr int operator()(int x, int y) const { return (x + y); }
};
namespace ex = std::experimental;
template <class Tuple>
void test_0()
{
// function
{
constexpr Tuple t{};
static_assert(1 == ex::apply(f_int_0, t), "");
}
// function pointer
{
constexpr Tuple t{};
constexpr auto fp = &f_int_0;
static_assert(1 == ex::apply(fp, t), "");
}
// functor
{
constexpr Tuple t{};
constexpr A_int_0 a;
static_assert(1 == ex::apply(a, t), "");
}
}
template <class Tuple>
void test_1()
{
// function
{
constexpr Tuple t{1};
static_assert(1 == ex::apply(f_int_1, t), "");
}
// function pointer
{
constexpr Tuple t{2};
constexpr int (*fp)(int) = f_int_1;
static_assert(2 == ex::apply(fp, t), "");
}
// functor
{
constexpr Tuple t{3};
constexpr A_int_1 fn;
static_assert(3 == ex::apply(fn, t), "");
}
}
template <class Tuple>
void test_2()
{
// function
{
constexpr Tuple t{1, 2};
static_assert(3 == ex::apply(f_int_2, t), "");
}
// function pointer
{
constexpr Tuple t{2, 3};
constexpr auto fp = &f_int_2;
static_assert(5 == ex::apply(fp, t), "");
}
// functor
{
constexpr Tuple t{3, 4};
constexpr A_int_2 a;
static_assert(7 == ex::apply(a, t), "");
}
}
int main()
{
test_0<std::tuple<>>();
test_1<std::tuple<int>>();
test_2<std::tuple<int, int>>();
test_2<std::pair<int, int>>();
}
| [
"[email protected]"
] | |
3e763e90b145ba0e7fa225d817ff057737d18e69 | bd2b65083fe739b272f6a773dbae8f467ce0b121 | /leecode/56MergeIntervals.cpp | 6549ff22b6490d2489c74a4e6dc288b3b898c8be | [] | no_license | Edward-surpass/brushCode | b80a00230d1f882336c8454bd4d4695c048c8f38 | bcd394d39387f918b201d2207162449e4153079a | refs/heads/master | 2016-09-14T13:51:02.901187 | 2016-05-07T09:56:12 | 2016-05-07T09:56:12 | 58,260,107 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,290 | cpp | /*********************************************************************************
* File Name : 56MergeIntervals.cpp
* Created By : edward
* Creation Date : [2015-07-28 20:38]
* Last Modified : [2015-07-28 21:09]
* Description : Given a collection of intervals, merge all overlapping intervals.
For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].
**********************************************************************************/
#include <vector>
#include <queue>
//Definition for an interval.
using namespace std;
struct Interval {
int start;
int end;
Interval() : start(0), end(0) {}
Interval(int s, int e) : start(s), end(e) {}
};
class Solution {
public:
vector<Interval> merge(vector<Interval>& intervals) {
priority_queue<int> IntSta,IntEnd;
vector<Interval> res;
size_t i;
int maxnum,minnum,lefttop,righttop;
for (i = 0; i < intervals.size(); ++i) {
IntSta.push(intervals[i].start);
IntEnd.push(intervals[i].end);
}
while(!IntSta.empty() && !IntEnd.empty())
{
righttop = IntEnd.top();
IntEnd.pop();
minnum = IntSta.top();
if(!IntEnd.empty())
maxnum = IntEnd.top();
else
{
lefttop = minnum;
res.push_back({lefttop,righttop});
return res;
}
while(minnum<=maxnum)
{
IntEnd.pop();
IntSta.pop();
minnum = IntSta.top();
if(!IntEnd.empty())
{
maxnum = IntEnd.top();
}
else
{
lefttop=minnum;
res.push_back({lefttop,righttop});
return res;
}
}
lefttop = minnum;
IntSta.pop();
res.push_back({lefttop,righttop});
}
return res;
}
};
| [
"[email protected]"
] | |
bffcf3847e636e33e6accaad4236bdbf197bc6d7 | e6ebd85661454fa9b1ab0fc93a54956a7510e08a | /Server2.cpp | 1512463407a8f8946cfb889a58c18e0591dc0ebd | [] | no_license | rrsegnini/Progra-DOS-Datos | a9ce1131d5fb6262decb157524fcf99e66aad825 | 5a4d5a4ef912c1115685ff575f0441fcb569e88c | refs/heads/master | 2021-01-20T09:06:43.201290 | 2017-05-18T11:26:15 | 2017-05-18T11:26:15 | 90,220,533 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,823 | cpp | #include <iostream>
#include <winsock2.h>
#pragma comment(lib,"ws2_32.lib")
#include <iostream>
#include <winsock2.h>
using namespace std;
int main()
{
WSADATA WSAData;
SOCKET server, client;
SOCKET Socket=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
SOCKADDR_IN serverAddr, clientAddr;
WSAStartup(MAKEWORD(2,0), &WSAData);
server = socket(AF_INET, SOCK_STREAM, 0);
serverAddr.sin_addr.s_addr = INADDR_ANY;
serverAddr.sin_family = AF_INET;
serverAddr.sin_port = htons(1986);
bind(server, (SOCKADDR *)&serverAddr, sizeof(serverAddr));
listen(server, 0);
cout << "Listening for incoming connections..." << endl;
//while (true){
char buffer[1024];
int clientAddrSize = sizeof(clientAddr);
if((client = accept(server, (SOCKADDR *)&clientAddr, &clientAddrSize)) != INVALID_SOCKET)
{
cout << "Client connected!" << endl;
recv(client, buffer, sizeof(buffer), 0);
// Main loop
for(;;)
{
char *szMessage="Welcome to the server!\r\n";
send(Socket,szMessage,strlen(szMessage),0);
int nError=WSAGetLastError();
Sleep(1000);
}
WSACleanup();
system("PAUSE");
return 0;
closesocket(client);
cout << "Client disconnected." << endl;
}
}
int main()
{
WSADATA WsaDat;
if(WSAStartup(MAKEWORD(2,2),&WsaDat)!=0)
{
std::cout<<"WSA Initialization failed!\r\n";
WSACleanup();
system("PAUSE");
return 0;
}
SOCKET Socket=socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
if(Socket==INVALID_SOCKET)
{
std::cout<<"Socket creation failed.\r\n";
WSACleanup();
system("PAUSE");
return 0;
}
SOCKADDR_IN serverInf;
serverInf.sin_family=AF_INET;
serverInf.sin_addr.s_addr=INADDR_ANY;
serverInf.sin_port=htons(1986);
if(bind(Socket,(SOCKADDR*)(&serverInf),sizeof(serverInf))==SOCKET_ERROR)
{
std::cout<<"Unable to bind socket!\r\n";
WSACleanup();
system("PAUSE");
return 0;
}
listen(Socket,1);
SOCKET TempSock=SOCKET_ERROR;
while(TempSock==SOCKET_ERROR)
{
std::cout<<"Waiting for incoming connections...\r\n";
TempSock=accept(Socket,NULL,NULL);
}
// If iMode!=0, non-blocking mode is enabled.
u_long iMode=1;
ioctlsocket(Socket,FIONBIO,&iMode);
Socket=TempSock;
std::cout<<"Client connected!\r\n\r\n";
// Main loop
for(;;)
{
char *szMessage="Welcome to the server!\r\n";
send(Socket,szMessage,strlen(szMessage),0);
int nError=WSAGetLastError();
if(nError!=WSAEWOULDBLOCK&&nError!=0)
{
std::cout<<"Winsock error code: "<<nError<<"\r\n";
std::cout<<"Client disconnected!\r\n";
// Shutdown our socket
shutdown(Socket,SD_SEND);
// Close our socket entirely
closesocket(Socket);
break;
}
Sleep(100);
}
WSACleanup();
system("PAUSE");
return 0;
}
| [
"[email protected]"
] | |
718a9877ab18e5981ce140db8fb32b82981d33bf | 22feaa7671e53e875b1ab72c6763c2660516ab1d | /SourceCodes/Ecs/Components/component_define.h | 2ce0f605438d8c36e314a1e92529e0429364a2cc | [] | no_license | KodFreedom/KeepFortissimo | cadbfa258cb5dd58a038fb4dd81046087b3f6e54 | e108c805c098d322c946b02b91743b4a9967b825 | refs/heads/master | 2021-06-04T05:04:08.314906 | 2020-04-10T10:33:58 | 2020-04-10T10:33:58 | 140,445,976 | 0 | 0 | null | 2020-04-09T01:53:00 | 2018-07-10T14:39:14 | C | UTF-8 | C++ | false | false | 1,469 | h | //--------------------------------------------------------------------------------
// define of component
// コンポーネントの定義
// 组件的定义
//
// Autor : 徐 文杰(Wenjie Xu)
// Github : kodfreedom
// Email : [email protected]
//--------------------------------------------------------------------------------
#pragma once
#include <stdint.h>
#include "../Utilities/type_name.h"
//
// TODO : 生成を自動化する
//
namespace KeepFortissimo
{
//--------------------------------------------------------------------------------
// enum / 列挙型
//--------------------------------------------------------------------------------
//enum class ComponentId : uint32_t
//{
// kComponent = 0,
// kTransform,
// kMax
//};
//--------------------------------------------------------------------------------
// 前方宣言
//--------------------------------------------------------------------------------
class Component;
class Transform;
class Renderer;
// component generatorを作る
// function<void*()>[kMax] ConstructMap;
// ConstructMap[kTransform] = []() { return new Transform(); };
}
//--------------------------------------------------------------------------------
// define
//--------------------------------------------------------------------------------
ENABLE_TYPENAME(Component);
ENABLE_TYPENAME(Transform);
ENABLE_TYPENAME(Renderer); | [
"[email protected]"
] | |
3a1cd2dd626443f0f0a08ebca47939d14bb5f0ef | c6ecad18dd41ea69c22baf78dfeb95cf9ba547d0 | /src/boost_1_42_0/libs/thread/example/xtime.cpp | 3fc75a4a283ff1c5bee16a930544fbe41a8ee55a | [
"BSL-1.0"
] | permissive | neuschaefer/qnap-gpl | b1418d504ebe17d7a31a504d315edac309430fcf | 7bb76f6cfe7abef08777451a75924f667cca335b | refs/heads/master | 2022-08-16T17:47:37.015870 | 2020-05-24T18:56:05 | 2020-05-24T18:56:05 | 266,605,194 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 449 | cpp | // Copyright (C) 2001-2003
// William E. Kempf
//
// 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 <boost/thread/thread.hpp>
#include <boost/thread/xtime.hpp>
int main(int argc, char* argv[])
{
boost::xtime xt;
boost::xtime_get(&xt, boost::TIME_xUTC);
xt.sec += 1;
boost::thread::sleep(xt); // Sleep for 1 second
}
| [
"[email protected]"
] | |
e90ec0a98b0421b9c187e3c21368c2a13e533e07 | a4e146a6982a856e26282453bc5688c6ac2c9ac8 | /ComplexEigenvalue/Source.cpp | 8c500ce62e69de575587a9756932ee774aa95449 | [] | no_license | RyotaMajima/ComplexEigenvalue | 5cbcd7686eedd0bb25547d5c424c9c00939e1270 | 457d8a34f83882a9e02ddd32ad0db5035e494a78 | refs/heads/master | 2021-01-10T16:15:51.439186 | 2015-12-09T07:49:48 | 2015-12-09T07:49:48 | 47,173,219 | 0 | 0 | null | null | null | null | SHIFT_JIS | C++ | false | false | 10,541 | cpp | /*
複素エネルギー固有値の探索
-> 実部と虚部をパラメータにして3次元プロット
*/
#define _USE_MATH_DEFINES
#define _CRT_SECURE_NO_WARNINGS
#pragma comment(lib, "libfftw3-3.lib")
#include<iostream>
#include<iomanip>
#include<fstream>
#include<cstdio>
#include<cmath>
#include<vector>
#include<utility>
#include<string>
#include<algorithm>
#include<functional>
#include<complex>
#include<chrono>
#include<fftw3.h>
using namespace std;
using namespace std::chrono;
using Complex = complex<double>;
using vC = vector<Complex>;
using vvC = vector<vC>;
using vvvC = vector<vvC>;
inline fftw_complex* fftwcast(Complex* f){ return reinterpret_cast<fftw_complex*>(f); }
const double X_BEGIN = -5.0, X_END = 25.0; //系の両端
const double L = X_END - X_BEGIN; //空間幅
const int N = 256; //空間分割数
const double DELTA_X = L / N;
const double T_END = 10; //終了時刻
const int TN = T_END * 2; //時間分割数
const double dt = T_END / TN; //時間刻み幅
const double S = 0.9; //波束の幅
const double X = -0.5; //初期波束の原点からのずれ
const double X_OPT = 4.0; //光学ポテンシャルをかける位置
const double b = 1.0 / 3.0; //3次ポテンシャルの係数
const double E_BEGIN_real = -1.2, E_END_real = 0.0;
const int EN_real = 100;
const double dE_real = (E_END_real - E_BEGIN_real) / EN_real;
const double E_BEGIN_imag = -0.5, E_END_imag = 0.5;
const int EN_imag = 100;
const double dE_imag = (E_END_imag - E_BEGIN_imag) / EN_imag;
double i2x(int i){
return X_BEGIN + i * DELTA_X;
}
double i2k(int i){
return 2 * M_PI * ((i < N / 2)? i : i - N) / L;
}
double i2E(double begin, int index, double width){
return begin + index * width;
}
double groundState(double x, double X){
return pow(1 / (S*S * M_PI), 1.0 / 4.0) * exp(-(x - X) * (x - X) / (2 * S*S));
}
double firstExcited(double x, double X){
return ((sqrt(2.0) * (x - X)) / S) * pow(1 / (S*S * M_PI), 1.0 / 4.0) * exp(-(x - X) * (x - X) / (2 * S*S));
}
double secondExcited(double x, double X){
return sqrt(1 / (3 * S*S*S*S - 2 * S*S + 1)) * pow(1 / (S*S * M_PI), 1.0 / 4.0) * (2 * (x - X) * (x - X) - 1) * exp(-(x - X) * (x - X) / (2 * S*S));
}
//初期化用関数の定義
void init(vC &f){
for (int i = 0; i < N; i++){
f[i] = firstExcited(i2x(i), X);
}
}
//ポテンシャル関数の定義
double V(double x){
return (1.0 / 2.0) * x*x - (b / 3.0) * x*x*x - 1.0 / (6 * b * b);
//return (1.0 / 2.0) * x*x;
}
//光学ポテンシャルの定義
double V_opt(double x){
return x > X_OPT ? x*x : 0.0;
}
//Simpson積分
double simpson(vC &f){
double S_even, S_odd;
S_even = S_odd = 0.0;
for (int i = 1; i < (N / 2) - 1; i++){
S_even += norm(f[2 * i]);
}
for (int i = 1; i < N / 2; i++){
S_odd += norm(f[2 * i - 1]);
}
return DELTA_X * (norm(f[0]) + 2 * S_even + 4 * S_odd + norm(f[N - 1])) / 3.0;
}
//dtだけ時間発展させる関数
void timeEvolution(vC &f, fftw_plan plan_for, fftw_plan plan_back){
//ポテンシャル部分の計算
for (int j = 0; j < N; j++){
f[j] *= polar(1.0 / N, -V(i2x(j)) * dt); // 1/Nは正規化因子
}
//光学ポテンシャル部分の計算
for (int j = 0; j < N; j++){
f[j] *= exp(-V_opt(i2x(j)) * dt);
}
//f(x, t) -> g(k, t)
fftw_execute(plan_for);
//時間発展の計算
for (int j = 0; j < N; j++){
f[j] *= polar(1.0, -i2k(j) * i2k(j) * dt / 2.0);
}
//f(k, t+dt) -> f(x, t+dt)
fftw_execute(plan_back);
}
//複素エネルギーピークのインデックスを求める関数
void getComplexPeaks(vector<tuple<double, int, int>> &peak, vector<vector<double>> &res){
//微分値が正から負に変わったところの値とインデックス
for (int i = 1; i < EN_real; i++){
for (int j = 1; j < EN_imag; j++){
if (res[i - 1][j] < res[i][j] && res[i][j] > res[i + 1][j] && res[i][j - 1] < res[i][j] && res[i][j] > res[i][j + 1]){
peak.push_back(make_tuple(res[i][j], i, j));
}
}
}
//ピーク値の大きい順にソート
sort(peak.begin(), peak.end(), [](const tuple<double, int, int> &i, const tuple<double, int, int> &j){ return get<0>(i) > get<0>(j); });
if (peak.empty()){
cout << "no peak" << endl;
exit(1);
}
else{
double E_th = get<0>(peak[0]) / 10; //しきい値
//しきい値以下の要素を削除
peak.erase(remove_if(peak.begin(), peak.end(), [E_th](tuple<double, int, int> tuple) {return get<0>(tuple) < E_th; }), peak.end());
//実部の小さい順にソート
sort(peak.begin(), peak.end(), [](const tuple<double, int, int> &i, const tuple<double, int, int> &j){ return get<1>(i) < get<1>(j); });
//得られたピーク値を表示
cout << "---- complex ver. ----" << endl << endl;
cout << "threshold value : " << E_th << endl << endl;
cout << "Re" << "\t" << "Im" << "\t" << "peak value" << endl;
for (auto tuple : peak){
double Re = i2E(E_BEGIN_real, get<1>(tuple), dE_real);
double Im = i2E(E_BEGIN_imag, get<2>(tuple), dE_imag);
printf("%.3lf\t%.3lf\t%.3lf\n", Re, Im, get<0>(tuple));
}
}
}
//固有状態の抽出
void getComplexEigenfunction(vC &phi, vC &f, fftw_plan plan_for, fftw_plan plan_back, double energy_real, double energy_imag){
for (int i = 0; i <= TN; i++){
//積分計算
for (int j = 0; j < N; j++){
phi[j] += f[j] * polar(dt, energy_real * (i * dt)) * exp(-energy_imag * (i * dt));
}
timeEvolution(f, plan_for, plan_back);
}
for (auto &val : phi){
val *= exp(-fabs(energy_imag) * T_END) / T_END;
}
}
int main(){
auto start = system_clock::now();
vC f(N);
vvvC C(EN_real + 1, vvC(EN_imag + 1, vC(N)));
//順方向Fourier変換
fftw_plan plan_for = fftw_plan_dft_1d(N, fftwcast(f.data()), fftwcast(f.data()), FFTW_FORWARD, FFTW_MEASURE);
//逆方向
fftw_plan plan_back = fftw_plan_dft_1d(N, fftwcast(f.data()), fftwcast(f.data()), FFTW_BACKWARD, FFTW_MEASURE);
printf("---- calculation parameters ----\n");
printf("system size : \t [%.1f, %.1f]\n", X_BEGIN, X_END);
printf("partition number : N = %d\n", N);
printf("calculation time : T = %.0f\n", T_END);
printf("time step : dt = %.1f\n", dt);
printf("energy width (real) : [%.2f, %.2f] N = %d\n", E_BEGIN_real, E_END_real, EN_real);
printf("energy width (imag) : [%.2f, %.2f] N = %d\n", E_BEGIN_imag, E_END_imag, EN_imag);
printf("--------------------------------\n");
init(f); //初期条件f(x,0)の設定
ofstream ofs;
char filename[50];
for (int i = 0; i <= TN; i++){
sprintf(filename, "./output/timeEvo/output%03d.txt", i);
ofs.open(filename);
if (!ofs){
cerr << "file open error!" << endl;
exit(1);
}
for (int j = 0; j < N; j++){
ofs << i2x(j) << "\t" << norm(f[j]) << "\t" << V(i2x(j)) << endl;
}
ofs.close();
for (int j = 0; j <= EN_real; j++){
for (int k = 0; k <= EN_imag; k++){
for (int l = 0; l < N; l++){
C[j][k][l] += f[l] * polar(dt, i2E(E_BEGIN_real, j, dE_real) * (i * dt)) * exp(-i2E(E_BEGIN_imag, k, dE_imag) * (i * dt));
}
}
}
//時間発展
timeEvolution(f, plan_for, plan_back);
}
for (int i = 0; i <= EN_real; i++){
for (int j = 0; j <= EN_imag; j++){
for (int k = 0; k < N; k++){
C[i][j][k] *= exp(-fabs(i2E(E_BEGIN_imag, j, dE_imag)) * T_END) / T_END;
}
}
}
string str = "./output/energy_complex_T_" + to_string((int)T_END) + ".txt";
ofs.open(str);
if (!ofs){
cerr << "file open error!" << endl;
exit(1);
}
vector<vector<double>> res_complex(EN_real + 1, vector<double>(EN_imag + 1));
ofs << scientific;
for (int i = 0; i <= EN_real; i++){
for (int j = 0; j <= EN_imag; j++){
res_complex[i][j] = simpson(C[i][j]);
ofs << i2E(E_BEGIN_real, i, dE_real) << "\t";
ofs << i2E(E_BEGIN_imag, j, dE_imag) << "\t";
ofs << res_complex[i][j] << endl;
}
ofs << endl;
}
ofs.close();;
vector<tuple<double, int, int>> peak_complex; //ピーク値と実部・虚部のインデックスを格納するtuple
getComplexPeaks(peak_complex, res_complex); //固有値のピークの探索
int peakNum = peak_complex.size();
vvC phi(peakNum, vC(N)); //固有状態格納用配列
//固有状態の抽出
for (int i = 0; i < peakNum; i++){
init(f);
getComplexEigenfunction(phi[i], f, plan_for, plan_back, i2E(E_BEGIN_real, get<1>(peak_complex[i]), dE_real), i2E(E_BEGIN_imag, get<2>(peak_complex[i]), dE_imag));
}
//比較のため調和振動子の解を出力
vector<vector<double>> ho(2, vector<double>(N));
for (int i = 0; i < N; i++){
double x = i2x(i);
ho[0][i] = norm(groundState(x, 0.0));
ho[1][i] = norm(firstExcited(x, 0.0));
}
ofs.open("./output/harmonic.txt");
if (!ofs){
cerr << "file open error!" << endl;
exit(1);
}
for (int i = 0; i < N; i++){
ofs << i2x(i) << "\t";
for (int j = 0; j < 2; j++){
ofs << ho[j][i] << "\t";
}
ofs << endl;
}
ofs.close();
//再規格化
for (int i = 0; i < peakNum; i++){
double sNorm = simpson(phi[i]);
for (int j = 0; j < N; j++){
phi[i][j] = norm(phi[i][j]) / sNorm;
}
}
str = "./output/phi_" + to_string((int)T_END) + ".txt";
ofs.open(str);
if (!ofs){
cerr << "file open error!" << endl;
exit(1);
}
//ファイル書き込み
for (int i = 0; i < N; i++){
ofs << i2x(i) << "\t" << V(i2x(i)) << "\t";
for (int j = 0; j < peakNum; j++) {
ofs << real(phi[j][i]) << "\t";
}
ofs << endl;
}
ofs.close();
fftw_destroy_plan(plan_for);
fftw_destroy_plan(plan_back);
auto end = system_clock::now();
auto dur = end - start;
auto sec = duration_cast<seconds>(dur).count();
auto min = duration_cast<minutes>(dur).count();
printf("\nexecution time : %dsec (%dmin)\n\n", sec, min);
return 0;
} | [
"[email protected]"
] | |
847ac3670ebc3cc1fd5268f97e536eb40700e13c | 7ed1319b4e9b3fbdb0941b544cf97a9ba4982add | /UnitTesting/AssistTesting.h | 3e88bf2be7c06a96d6e70cd348fb94a9bc5840cc | [] | no_license | princeyuan/CTT | dda2a533db9140be91eaae2276a794d4e3ca21bb | 2590e01a2ca2e8bade0bcb7a7f3bbdee25d0e5c3 | refs/heads/master | 2016-09-05T22:11:51.229711 | 2014-04-08T06:00:22 | 2014-04-08T06:00:22 | 18,434,139 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 514 | h | #ifndef ASSIST_METHOD_TEST_H
#define ASSIST_METHOD_TEST_H
#include <iostream>
#include "AssistMethod.h"
#include "ReadInputFile.h"
#include "CreatePartialCombSet.h"
void AssistMethodTest();
void getOneNumFromLine_Test();
void getAllNumFromLine_Test();
void next_combination_1_Test();
void next_combination_2_Test();
void toString_Test();
void toDouble_Test();
void GetFixedCoverReq_Test();
void GetFixedPlusCoverReq_Test();
void GetMixedCoverReq_Test();
void Partial_CombSet_Test();
#endif | [
"[email protected]"
] | |
76bfffc7317ebabbd365bf90df7117da187f3a75 | 1459e0cca33ec629d871b5890314ff1d0aa56570 | /algoritmusok_1/cpp/nsort/BRBack.h | 2893b2e6dadaa3017bb3c699a12d1fbdb8c13bce | [] | no_license | zlaval/ELTE_Prog | bac4a82ae4d322e443b82585618323142dbf35c6 | 7d3684e8e6f0fa1e086c44296e253e10cf9829c0 | refs/heads/master | 2023-03-25T11:44:35.782454 | 2022-12-19T19:39:49 | 2022-12-19T19:39:49 | 224,856,198 | 5 | 3 | null | 2023-03-13T21:49:23 | 2019-11-29T13:07:25 | C++ | UTF-8 | C++ | false | false | 2,777 | h |
#ifndef ALG1CPP_BRBACK_H
#define ALG1CPP_BRBACK_H
#include <string>
#include <iostream>
class BRBack {
std::string *a;
std::string *b;
int m;
int numLength;
public:
BRBack(std::string *a, int m, int numLength) {
this->a = a;
this->b = new std::string[m];
this->m = m;
this->numLength = numLength;
}
~BRBack() {
delete b;
//TODO a deleted for easier handling the sandbox
delete a;
}
void binRadix() {
std::string *actualArray = a;
std::string *backArray = b;
int e = 0;
int v = m - 1;
int k = m - 1;
int round = 0;
for (int i = numLength - 1; i >= 0; i--) {
int j = 0;
while (j <= k) {
std::string num = actualArray[j];
int digit = getDigit(num, i);
if (digit == 0) {
backArray[e++] = num;
} else {
backArray[v--] = num;
}
j++;
}
j = m - 1;
while (j > k) {
std::string num = actualArray[j];
int digit = getDigit(num, i);
if (digit == 0) {
backArray[e++] = num;
} else {
backArray[v--] = num;
}
j--;
}
k = e - 1;
e = 0;
v = m - 1;
std::cout << "k=" << k << std::endl;
std::cout << "After " << round << " round the processed array: ";
printArray(actualArray, m, k);
std::cout << std::endl;
std::cout << "After " << round << " round the new array: ";
printArray(backArray, m, k);
round++;
std::cout << std::endl;
std::cout << "******************************************************************" << std::endl;
std::string *tmp = actualArray;
actualArray = backArray;
backArray = tmp;
}
for (int i = 0; i <= k; i++) {
backArray[i] = actualArray[i];
}
int j = k;
for (int l = m - 1; l > k; l--) {
backArray[++j] = actualArray[l];
}
actualArray = backArray;
std::cout << "The final result: ";
printArray(actualArray, m, -1);
}
void printArray(std::string *arr, int l, int k) {
for (int i = 0; i < l; i++) {
if (i == k+1) {
std::cout << " | ";
}
std::cout << arr[i] << " ";
}
}
int getDigit(std::string n, int i) {
std::string d = n.substr(i, 1);
return std::stoi(d);
}
};
#endif //ALG1CPP_BRBACK_H
| [
"[email protected]"
] | |
0bf0fa9c955a652186a62597197bab3963c2319e | 8028c82c0efa30fe68568c872e0c58171a141463 | /cpp/poco/Foundation/testsuite/src/PathTest.h | 6e0c9ebb6d51be9afc2239881ead566c798f4faa | [
"BSL-1.0"
] | permissive | vanzare/MberLinuxSDK | 51a429604b6325c9733cb06e238a7ee22c92901a | 2c50c7a47da07391127016de8e35dd16e5864aef | refs/heads/master | 2021-01-23T11:50:13.529123 | 2014-07-10T02:11:18 | 2014-07-10T02:11:18 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,635 | h | //
// PathTest.h
//
// $Id: //poco/1.4/Foundation/testsuite/src/PathTest.h#2 $
//
// Definition of the PathTest class.
//
// Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH.
// and Contributors.
//
// Permission is hereby granted, free of charge, to any person or organization
// obtaining a copy of the software and accompanying documentation covered by
// this license (the "Software") to use, reproduce, display, distribute,
// execute, and transmit the Software, and to prepare derivative works of the
// Software, and to permit third-parties to whom the Software is furnished to
// do so, all subject to the following:
//
// The copyright notices in the Software and this entire statement, including
// the above license grant, this restriction and the following disclaimer,
// must be included in all copies of the Software, in whole or in part, and
// all derivative works of the Software, unless such copies or derivative
// works are solely in the form of machine-executable object code generated by
// a source language processor.
//
// 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT
// SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
// FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
// ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
//
#ifndef PathTest_INCLUDED
#define PathTest_INCLUDED
#include "Poco/Foundation.h"
#include "CppUnit/TestCase.h"
class PathTest: public CppUnit::TestCase
{
public:
PathTest(const std::string& name);
~PathTest();
void testParseUnix1();
void testParseUnix2();
void testParseUnix3();
void testParseUnix4();
void testParseUnix5();
void testParseWindows1();
void testParseWindows2();
void testParseWindows3();
void testParseWindows4();
void testParseVMS1();
void testParseVMS2();
void testParseVMS3();
void testParseVMS4();
void testParseGuess();
void testTryParse();
void testStatics();
void testBaseNameExt();
void testAbsolute();
void testRobustness();
void testParent();
void testForDirectory();
void testExpand();
void testListRoots();
void testFind();
void testSwap();
void testResolve();
void testPushPop();
void testWindowsSystem();
void setUp();
void tearDown();
static CppUnit::Test* suite();
private:
};
#endif // PathTest_INCLUDED
| [
"[email protected]"
] | |
d70b24e4f1ba3609ce5a37fcdc75f98c3999c43a | a27e939e7d5db9f4bc6ca9afdc1c2b9f8a3e5c2e | /infra/acceptor.cpp | 5184a5fe3e64f786261ad0d554774bc184bfe022 | [] | no_license | ecilaz/ecila | 116004a5541913d06e86f4c3c38b66a6ffd58115 | 230e1efcec476c9b09e78094fcea1f50b23b4f12 | refs/heads/master | 2021-01-10T20:26:17.114891 | 2019-11-24T02:22:01 | 2019-11-24T02:22:01 | 223,353,075 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,814 | cpp | #include "acceptor.h"
#include "iniloader.h"
#include "demultiplexer.h"
#include "syncacceptor.h"
#include "asyncacceptor.h"
#include "syncsessionpool.h"
#include "asyncsessionpool.h"
#include "asyncresultpool.h"
#include "ipackethandler.h"
US_ECILA
Acceptor::Acceptor()
{
acceptor_ = 0;
pkt_handler_ = 0;
}
Acceptor::~Acceptor()
{
ECILA_SAFE_DELETE(acceptor_);
}
void Acceptor::Initialize(Node *root, IPacketHandler *pkt_handler)
{
ECILA_ASSERT(pkt_handler);
pkt_handler_ = pkt_handler;
//ini_loader
IniLoader *ini_loader = root->FindObject<IniLoader>("/iniloader");
ECILA_ASSERT(ini_loader);
const char_t *netio = ini_loader->Property("server", "netio");
ECILA_ASSERT(netio);
//demultiplexer
Demultiplexer *demultiplexer = root->FindObject<Demultiplexer>("/events/demultiplexer");
ECILA_ASSERT(demultiplexer);
//act_pool
AsyncResultPool *act_pool = root->FindObject<AsyncResultPool>("/pool/act_pool");
ECILA_ASSERT(act_pool);
//sess_pool
if(ecila_strncmp(netio, "async", 5) == 0)
{
AsyncSessionPool *sess_pool = root->FindObject<AsyncSessionPool>("/pool/sess_pool");
ECILA_ASSERT(sess_pool);
AsyncAcceptor *acceptor = new AsyncAcceptor(demultiplexer->DemultiplexerImpl(), sess_pool);
ECILA_ASSERT(acceptor);
acceptor->ActPool(act_pool);
acceptor->PKTHandler(pkt_handler_);
acceptor_ = acceptor;
}
else if(ecila_strncmp(netio, "sync", 4) == 0)
{
SyncSessionPool *sess_pool = root->FindObject<SyncSessionPool>("/pool/sess_pool");
ECILA_ASSERT(sess_pool);
SyncAcceptor *acceptor = new SyncAcceptor(demultiplexer->DemultiplexerImpl(), sess_pool);
ECILA_ASSERT(acceptor);
acceptor->PKTHandler(pkt_handler_);
acceptor_ = acceptor;
}
else
{
ECILA_TRACE();
}
}
IAcceptor* Acceptor::AcceptorImpl()
{
return acceptor_;
}
| [
"[email protected]"
] | |
04d22d9c4fabb26e0fe28694dd7422bca9068972 | eba5ec4ee324edfa5a0f377c6f948cffb9dee1d8 | /net/socket/client_socket_pool_manager.cc | 07072dbd0b8113ebf142bcafc0a04aa5f7d25a29 | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause-Views"
] | permissive | bopopescu/Monarch | 2c1e636da3995d1f20df48561db97fd0d8f9317b | 4f8ee8e6dda3669f734866e4999db173c5ec5aef | refs/heads/master | 2021-06-16T11:42:58.246734 | 2017-03-25T04:02:04 | 2017-03-25T04:02:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 20,817 | cc | // Copyright (c) 2012 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/socket/client_socket_pool_manager.h"
#include <string>
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/strings/stringprintf.h"
#include "net/base/load_flags.h"
#include "net/http/http_proxy_client_socket_pool.h"
#include "net/http/http_request_info.h"
#include "net/http/http_stream_factory.h"
#include "net/proxy/proxy_info.h"
#include "net/socket/client_socket_handle.h"
#include "net/socket/socks_client_socket_pool.h"
#include "net/socket/ssl_client_socket_pool.h"
#include "net/socket/transport_client_socket_pool.h"
#include "net/ssl/ssl_config.h"
namespace net {
namespace {
// Limit of sockets of each socket pool.
int g_max_sockets_per_pool[] = {
256, // NORMAL_SOCKET_POOL
256 // WEBSOCKET_SOCKET_POOL
};
static_assert(arraysize(g_max_sockets_per_pool) ==
HttpNetworkSession::NUM_SOCKET_POOL_TYPES,
"max sockets per pool length mismatch");
// Default to allow up to 6 connections per host. Experiment and tuning may
// try other values (greater than 0). Too large may cause many problems, such
// as home routers blocking the connections!?!? See http://crbug.com/12066.
//
// WebSocket connections are long-lived, and should be treated differently
// than normal other connections. 6 connections per group sounded too small
// for such use, thus we use a larger limit which was determined somewhat
// arbitrarily.
// TODO(yutak): Look at the usage and determine the right value after
// WebSocket protocol stack starts to work.
int g_max_sockets_per_group[] = {
6, // NORMAL_SOCKET_POOL
30 // WEBSOCKET_SOCKET_POOL
};
static_assert(arraysize(g_max_sockets_per_group) ==
HttpNetworkSession::NUM_SOCKET_POOL_TYPES,
"max sockets per group length mismatch");
// The max number of sockets to allow per proxy server. This applies both to
// http and SOCKS proxies. See http://crbug.com/12066 and
// http://crbug.com/44501 for details about proxy server connection limits.
int g_max_sockets_per_proxy_server[] = {
kDefaultMaxSocketsPerProxyServer, // NORMAL_SOCKET_POOL
kDefaultMaxSocketsPerProxyServer // WEBSOCKET_SOCKET_POOL
};
static_assert(arraysize(g_max_sockets_per_proxy_server) ==
HttpNetworkSession::NUM_SOCKET_POOL_TYPES,
"max sockets per proxy server length mismatch");
// The meat of the implementation for the InitSocketHandleForHttpRequest,
// InitSocketHandleForRawConnect and PreconnectSocketsForHttpRequest methods.
int InitSocketPoolHelper(ClientSocketPoolManager::SocketGroupType group_type,
const HostPortPair& endpoint,
const HttpRequestHeaders& request_extra_headers,
int request_load_flags,
RequestPriority request_priority,
HttpNetworkSession* session,
const ProxyInfo& proxy_info,
bool expect_spdy,
const SSLConfig& ssl_config_for_origin,
const SSLConfig& ssl_config_for_proxy,
bool force_tunnel,
PrivacyMode privacy_mode,
const BoundNetLog& net_log,
int num_preconnect_streams,
ClientSocketHandle* socket_handle,
HttpNetworkSession::SocketPoolType socket_pool_type,
const OnHostResolutionCallback& resolution_callback,
const CompletionCallback& callback) {
scoped_refptr<HttpProxySocketParams> http_proxy_params;
scoped_refptr<SOCKSSocketParams> socks_params;
scoped_ptr<HostPortPair> proxy_host_port;
bool using_ssl = group_type == ClientSocketPoolManager::SSL_GROUP;
HostPortPair origin_host_port = endpoint;
if (!using_ssl && session->params().testing_fixed_http_port != 0) {
origin_host_port.set_port(session->params().testing_fixed_http_port);
} else if (using_ssl && session->params().testing_fixed_https_port != 0) {
origin_host_port.set_port(session->params().testing_fixed_https_port);
}
bool disable_resolver_cache =
request_load_flags & LOAD_BYPASS_CACHE ||
request_load_flags & LOAD_VALIDATE_CACHE ||
request_load_flags & LOAD_DISABLE_CACHE;
int load_flags = request_load_flags;
if (session->params().ignore_certificate_errors)
load_flags |= LOAD_IGNORE_ALL_CERT_ERRORS;
// Build the string used to uniquely identify connections of this type.
// Determine the host and port to connect to.
std::string connection_group = origin_host_port.ToString();
DCHECK(!connection_group.empty());
if (group_type == ClientSocketPoolManager::FTP_GROUP) {
// Combining FTP with forced SPDY over SSL would be a "path to madness".
// Make sure we never do that.
DCHECK(!using_ssl);
connection_group = "ftp/" + connection_group;
}
if (using_ssl) {
// All connections in a group should use the same SSLConfig settings.
// Encode version_max in the connection group's name, unless it's the
// default version_max. (We want the common case to use the shortest
// encoding). A version_max of TLS 1.1 is encoded as "ssl(max:3.2)/"
// rather than "tlsv1.1/" because the actual protocol version, which
// is selected by the server, may not be TLS 1.1. Do not encode
// version_min in the connection group's name because version_min
// should be the same for all connections, whereas version_max may
// change for version fallbacks.
std::string prefix = "ssl/";
if (ssl_config_for_origin.version_max != kDefaultSSLVersionMax) {
switch (ssl_config_for_origin.version_max) {
case SSL_PROTOCOL_VERSION_TLS1_2:
prefix = "ssl(max:3.3)/";
break;
case SSL_PROTOCOL_VERSION_TLS1_1:
prefix = "ssl(max:3.2)/";
break;
case SSL_PROTOCOL_VERSION_TLS1:
prefix = "ssl(max:3.1)/";
break;
default:
CHECK(false);
break;
}
}
// Place sockets with and without deprecated ciphers into separate
// connection groups.
if (ssl_config_for_origin.deprecated_cipher_suites_enabled)
prefix += "deprecatedciphers/";
connection_group = prefix + connection_group;
}
bool ignore_limits = (request_load_flags & LOAD_IGNORE_LIMITS) != 0;
if (!proxy_info.is_direct()) {
ProxyServer proxy_server = proxy_info.proxy_server();
proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair()));
scoped_refptr<TransportSocketParams> proxy_tcp_params(
new TransportSocketParams(
*proxy_host_port,
disable_resolver_cache,
ignore_limits,
resolution_callback,
TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT));
if (proxy_info.is_http() || proxy_info.is_https()) {
std::string user_agent;
request_extra_headers.GetHeader(HttpRequestHeaders::kUserAgent,
&user_agent);
scoped_refptr<SSLSocketParams> ssl_params;
if (proxy_info.is_https()) {
// Combine connect and write for SSL sockets in TCP FastOpen
// field trial.
TransportSocketParams::CombineConnectAndWritePolicy
combine_connect_and_write =
session->params().enable_tcp_fast_open_for_ssl ?
TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DESIRED :
TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT;
proxy_tcp_params = new TransportSocketParams(*proxy_host_port,
disable_resolver_cache,
ignore_limits,
resolution_callback,
combine_connect_and_write);
// Set ssl_params, and unset proxy_tcp_params
ssl_params =
new SSLSocketParams(proxy_tcp_params, NULL, NULL,
*proxy_host_port.get(), ssl_config_for_proxy,
PRIVACY_MODE_DISABLED, load_flags, expect_spdy);
proxy_tcp_params = NULL;
}
http_proxy_params =
new HttpProxySocketParams(proxy_tcp_params,
ssl_params,
user_agent,
origin_host_port,
session->http_auth_cache(),
session->http_auth_handler_factory(),
session->spdy_session_pool(),
force_tunnel || using_ssl,
session->params().proxy_delegate);
} else {
DCHECK(proxy_info.is_socks());
char socks_version;
if (proxy_server.scheme() == ProxyServer::SCHEME_SOCKS5)
socks_version = '5';
else
socks_version = '4';
connection_group = base::StringPrintf(
"socks%c/%s", socks_version, connection_group.c_str());
socks_params = new SOCKSSocketParams(proxy_tcp_params,
socks_version == '5',
origin_host_port);
}
}
// Change group name if privacy mode is enabled.
if (privacy_mode == PRIVACY_MODE_ENABLED)
connection_group = "pm/" + connection_group;
// Deal with SSL - which layers on top of any given proxy.
if (using_ssl) {
scoped_refptr<TransportSocketParams> ssl_tcp_params;
if (proxy_info.is_direct()) {
// Setup TCP params if non-proxied SSL connection.
// Combine connect and write for SSL sockets in TCP FastOpen field trial.
TransportSocketParams::CombineConnectAndWritePolicy
combine_connect_and_write =
session->params().enable_tcp_fast_open_for_ssl ?
TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DESIRED :
TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT;
ssl_tcp_params = new TransportSocketParams(origin_host_port,
disable_resolver_cache,
ignore_limits,
resolution_callback,
combine_connect_and_write);
}
scoped_refptr<SSLSocketParams> ssl_params = new SSLSocketParams(
ssl_tcp_params, socks_params, http_proxy_params, origin_host_port,
ssl_config_for_origin, privacy_mode, load_flags, expect_spdy);
SSLClientSocketPool* ssl_pool = NULL;
if (proxy_info.is_direct()) {
ssl_pool = session->GetSSLSocketPool(socket_pool_type);
} else {
ssl_pool = session->GetSocketPoolForSSLWithProxy(socket_pool_type,
*proxy_host_port);
}
if (num_preconnect_streams) {
RequestSocketsForPool(ssl_pool, connection_group, ssl_params,
num_preconnect_streams, net_log);
return OK;
}
return socket_handle->Init(connection_group, ssl_params,
request_priority, callback, ssl_pool,
net_log);
}
// Finally, get the connection started.
if (proxy_info.is_http() || proxy_info.is_https()) {
HttpProxyClientSocketPool* pool =
session->GetSocketPoolForHTTPProxy(socket_pool_type, *proxy_host_port);
if (num_preconnect_streams) {
RequestSocketsForPool(pool, connection_group, http_proxy_params,
num_preconnect_streams, net_log);
return OK;
}
return socket_handle->Init(connection_group, http_proxy_params,
request_priority, callback,
pool, net_log);
}
if (proxy_info.is_socks()) {
SOCKSClientSocketPool* pool =
session->GetSocketPoolForSOCKSProxy(socket_pool_type, *proxy_host_port);
if (num_preconnect_streams) {
RequestSocketsForPool(pool, connection_group, socks_params,
num_preconnect_streams, net_log);
return OK;
}
return socket_handle->Init(connection_group, socks_params,
request_priority, callback, pool,
net_log);
}
DCHECK(proxy_info.is_direct());
scoped_refptr<TransportSocketParams> tcp_params =
new TransportSocketParams(
origin_host_port,
disable_resolver_cache,
ignore_limits,
resolution_callback,
TransportSocketParams::COMBINE_CONNECT_AND_WRITE_DEFAULT);
TransportClientSocketPool* pool =
session->GetTransportSocketPool(socket_pool_type);
if (num_preconnect_streams) {
RequestSocketsForPool(pool, connection_group, tcp_params,
num_preconnect_streams, net_log);
return OK;
}
return socket_handle->Init(connection_group, tcp_params,
request_priority, callback,
pool, net_log);
}
} // namespace
ClientSocketPoolManager::ClientSocketPoolManager() {}
ClientSocketPoolManager::~ClientSocketPoolManager() {}
// static
int ClientSocketPoolManager::max_sockets_per_pool(
HttpNetworkSession::SocketPoolType pool_type) {
DCHECK_LT(pool_type, HttpNetworkSession::NUM_SOCKET_POOL_TYPES);
return g_max_sockets_per_pool[pool_type];
}
// static
void ClientSocketPoolManager::set_max_sockets_per_pool(
HttpNetworkSession::SocketPoolType pool_type,
int socket_count) {
DCHECK_LT(0, socket_count);
DCHECK_GT(1000, socket_count); // Sanity check.
DCHECK_LT(pool_type, HttpNetworkSession::NUM_SOCKET_POOL_TYPES);
g_max_sockets_per_pool[pool_type] = socket_count;
DCHECK_GE(g_max_sockets_per_pool[pool_type],
g_max_sockets_per_group[pool_type]);
}
// static
int ClientSocketPoolManager::max_sockets_per_group(
HttpNetworkSession::SocketPoolType pool_type) {
DCHECK_LT(pool_type, HttpNetworkSession::NUM_SOCKET_POOL_TYPES);
return g_max_sockets_per_group[pool_type];
}
// static
void ClientSocketPoolManager::set_max_sockets_per_group(
HttpNetworkSession::SocketPoolType pool_type,
int socket_count) {
DCHECK_LT(0, socket_count);
// The following is a sanity check... but we should NEVER be near this value.
DCHECK_GT(100, socket_count);
DCHECK_LT(pool_type, HttpNetworkSession::NUM_SOCKET_POOL_TYPES);
g_max_sockets_per_group[pool_type] = socket_count;
DCHECK_GE(g_max_sockets_per_pool[pool_type],
g_max_sockets_per_group[pool_type]);
DCHECK_GE(g_max_sockets_per_proxy_server[pool_type],
g_max_sockets_per_group[pool_type]);
}
// static
int ClientSocketPoolManager::max_sockets_per_proxy_server(
HttpNetworkSession::SocketPoolType pool_type) {
DCHECK_LT(pool_type, HttpNetworkSession::NUM_SOCKET_POOL_TYPES);
return g_max_sockets_per_proxy_server[pool_type];
}
// static
void ClientSocketPoolManager::set_max_sockets_per_proxy_server(
HttpNetworkSession::SocketPoolType pool_type,
int socket_count) {
DCHECK_LT(0, socket_count);
DCHECK_GT(100, socket_count); // Sanity check.
DCHECK_LT(pool_type, HttpNetworkSession::NUM_SOCKET_POOL_TYPES);
// Assert this case early on. The max number of sockets per group cannot
// exceed the max number of sockets per proxy server.
DCHECK_LE(g_max_sockets_per_group[pool_type], socket_count);
g_max_sockets_per_proxy_server[pool_type] = socket_count;
}
int InitSocketHandleForHttpRequest(
ClientSocketPoolManager::SocketGroupType group_type,
const HostPortPair& endpoint,
const HttpRequestHeaders& request_extra_headers,
int request_load_flags,
RequestPriority request_priority,
HttpNetworkSession* session,
const ProxyInfo& proxy_info,
bool expect_spdy,
const SSLConfig& ssl_config_for_origin,
const SSLConfig& ssl_config_for_proxy,
PrivacyMode privacy_mode,
const BoundNetLog& net_log,
ClientSocketHandle* socket_handle,
const OnHostResolutionCallback& resolution_callback,
const CompletionCallback& callback) {
DCHECK(socket_handle);
return InitSocketPoolHelper(
group_type, endpoint, request_extra_headers, request_load_flags,
request_priority, session, proxy_info, expect_spdy, ssl_config_for_origin,
ssl_config_for_proxy, /*force_tunnel=*/false, privacy_mode, net_log, 0,
socket_handle, HttpNetworkSession::NORMAL_SOCKET_POOL,
resolution_callback, callback);
}
int InitSocketHandleForWebSocketRequest(
ClientSocketPoolManager::SocketGroupType group_type,
const HostPortPair& endpoint,
const HttpRequestHeaders& request_extra_headers,
int request_load_flags,
RequestPriority request_priority,
HttpNetworkSession* session,
const ProxyInfo& proxy_info,
bool expect_spdy,
const SSLConfig& ssl_config_for_origin,
const SSLConfig& ssl_config_for_proxy,
PrivacyMode privacy_mode,
const BoundNetLog& net_log,
ClientSocketHandle* socket_handle,
const OnHostResolutionCallback& resolution_callback,
const CompletionCallback& callback) {
DCHECK(socket_handle);
return InitSocketPoolHelper(
group_type, endpoint, request_extra_headers, request_load_flags,
request_priority, session, proxy_info, expect_spdy, ssl_config_for_origin,
ssl_config_for_proxy, /*force_tunnel=*/true, privacy_mode, net_log, 0,
socket_handle, HttpNetworkSession::WEBSOCKET_SOCKET_POOL,
resolution_callback, callback);
}
int InitSocketHandleForRawConnect(
const HostPortPair& host_port_pair,
HttpNetworkSession* session,
const ProxyInfo& proxy_info,
const SSLConfig& ssl_config_for_origin,
const SSLConfig& ssl_config_for_proxy,
PrivacyMode privacy_mode,
const BoundNetLog& net_log,
ClientSocketHandle* socket_handle,
const CompletionCallback& callback) {
DCHECK(socket_handle);
HttpRequestHeaders request_extra_headers;
int request_load_flags = 0;
RequestPriority request_priority = MEDIUM;
return InitSocketPoolHelper(
ClientSocketPoolManager::NORMAL_GROUP, host_port_pair,
request_extra_headers, request_load_flags, request_priority, session,
proxy_info, false, ssl_config_for_origin, ssl_config_for_proxy,
/*force_tunnel=*/true, privacy_mode, net_log, 0, socket_handle,
HttpNetworkSession::NORMAL_SOCKET_POOL, OnHostResolutionCallback(),
callback);
}
int InitSocketHandleForTlsConnect(const HostPortPair& endpoint,
HttpNetworkSession* session,
const ProxyInfo& proxy_info,
const SSLConfig& ssl_config_for_origin,
const SSLConfig& ssl_config_for_proxy,
PrivacyMode privacy_mode,
const BoundNetLog& net_log,
ClientSocketHandle* socket_handle,
const CompletionCallback& callback) {
DCHECK(socket_handle);
HttpRequestHeaders request_extra_headers;
int request_load_flags = 0;
RequestPriority request_priority = MEDIUM;
return InitSocketPoolHelper(
ClientSocketPoolManager::SSL_GROUP, endpoint, request_extra_headers,
request_load_flags, request_priority, session, proxy_info,
/*expect_spdy=*/false, ssl_config_for_origin, ssl_config_for_proxy,
/*force_tunnel=*/true, privacy_mode, net_log, 0, socket_handle,
HttpNetworkSession::NORMAL_SOCKET_POOL, OnHostResolutionCallback(),
callback);
}
int PreconnectSocketsForHttpRequest(
ClientSocketPoolManager::SocketGroupType group_type,
const HostPortPair& endpoint,
const HttpRequestHeaders& request_extra_headers,
int request_load_flags,
RequestPriority request_priority,
HttpNetworkSession* session,
const ProxyInfo& proxy_info,
bool expect_spdy,
const SSLConfig& ssl_config_for_origin,
const SSLConfig& ssl_config_for_proxy,
PrivacyMode privacy_mode,
const BoundNetLog& net_log,
int num_preconnect_streams) {
return InitSocketPoolHelper(
group_type, endpoint, request_extra_headers, request_load_flags,
request_priority, session, proxy_info, expect_spdy, ssl_config_for_origin,
ssl_config_for_proxy, /*force_tunnel=*/false, privacy_mode, net_log,
num_preconnect_streams, NULL, HttpNetworkSession::NORMAL_SOCKET_POOL,
OnHostResolutionCallback(), CompletionCallback());
}
} // namespace net
| [
"[email protected]"
] | |
de454d887e579a4967713c66343a130e6ce31ec9 | 2b1a8caa5f6aa4b9b52a1d9e0c2906b260cc7beb | /MfcClock/MfcClockView.cpp | 56026ff64298e7d4c791a60c03b3bad8a730f1fc | [
"MIT"
] | permissive | Tocchann/MfcOnWpf | 7ce66c75c1405f1136acbe131d7f773b4acac37b | 8e2f63e05d826f74b29f0c1d79eb8e368b71f787 | refs/heads/master | 2020-04-11T11:14:29.508438 | 2019-01-17T09:08:00 | 2019-01-17T09:08:00 | 161,742,312 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,438 | cpp |
// MfcClockView.cpp : CMfcClockView クラスの実装
//
#include "stdafx.h"
// SHARED_HANDLERS は、プレビュー、縮小版、および検索フィルター ハンドラーを実装している ATL プロジェクトで定義でき、
// そのプロジェクトとのドキュメント コードの共有を可能にします。
#ifndef SHARED_HANDLERS
#include "MfcClock.h"
#endif
#include "MfcClockDoc.h"
#include "MfcClockView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CMfcClockView
IMPLEMENT_DYNCREATE(CMfcClockView, CWpfView )
BEGIN_MESSAGE_MAP(CMfcClockView, CWpfView )
// 標準印刷コマンド
ON_COMMAND(ID_FILE_PRINT, &CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, &CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, &CView::OnFilePrintPreview)
ON_COMMAND( ID_POPUP, &CMfcClockView::OnPopup )
ON_UPDATE_COMMAND_UI( ID_NONE, &CMfcClockView::OnUpdateNone )
ON_UPDATE_COMMAND_UI( ID_CLOCK, &CMfcClockView::OnUpdateClock )
ON_UPDATE_COMMAND_UI( ID_PHONE, &CMfcClockView::OnUpdatePhone )
ON_UPDATE_COMMAND_UI( ID_LISTBOX, &CMfcClockView::OnUpdateListbox )
ON_UPDATE_COMMAND_UI( ID_ADDR, &CMfcClockView::OnUpdateAddr )
ON_COMMAND( ID_NONE, &CMfcClockView::OnNone )
ON_COMMAND( ID_CLOCK, &CMfcClockView::OnClock )
ON_COMMAND( ID_PHONE, &CMfcClockView::OnPhone )
ON_COMMAND( ID_LISTBOX, &CMfcClockView::OnListbox )
ON_COMMAND( ID_ADDR, &CMfcClockView::OnAddr )
ON_COMMAND( ID_NON_OWNER_POPUP, &CMfcClockView::OnNonOwnerPopup )
END_MESSAGE_MAP()
// CMfcClockView コンストラクション/デストラクション
CMfcClockView::CMfcClockView() noexcept
{
// TODO: 構築コードをここに追加します。
}
CMfcClockView::~CMfcClockView()
{
}
// CMfcClockView 描画
// CMfcClockView の印刷
BOOL CMfcClockView::OnPreparePrinting(CPrintInfo* pInfo)
{
// 既定の印刷準備
return DoPreparePrinting(pInfo);
}
void CMfcClockView::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 印刷前の特別な初期化処理を追加してください。
}
void CMfcClockView::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: 印刷後の後処理を追加してください。
}
// CMfcClockView の診断
#ifdef _DEBUG
void CMfcClockView::AssertValid() const
{
CWpfView::AssertValid();
}
void CMfcClockView::Dump(CDumpContext& dc) const
{
CWpfView::Dump(dc);
}
CMfcClockDoc* CMfcClockView::GetDocument() const // デバッグ以外のバージョンはインラインです。
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMfcClockDoc)));
return (CMfcClockDoc*)m_pDocument;
}
#endif //_DEBUG
// CMfcClockView メッセージ ハンドラー
void CMfcClockView::OnInitialUpdate()
{
CWpfView::OnInitialUpdate();
// 通常はここで一度だけ初期化する
//if( GetHwndSource() == nullptr )
//{
//}
auto phonePage = GetRootVisual<WpfClock::PhoneButtonsPage>();
if( phonePage != nullptr )
{
phonePage->Text = L"";
}
}
void CMfcClockView::OnNonOwnerPopup()
{
auto window = gcnew WpfClock::PopupClock();
window->ShowDialog();
}
void CMfcClockView::OnPopup()
{
auto window = gcnew WpfClock::PopupClock();
// オーナーウィンドウをセット
auto helper = gcnew System::Windows::Interop::WindowInteropHelper( window );
helper->Owner = System::IntPtr( AfxGetMainWnd()->GetSafeHwnd() );
window->ShowDialog();
}
// 何もない状態
void CMfcClockView::OnUpdateNone( CCmdUI *pCmdUI )
{
auto src = GetHwndSource();
pCmdUI->SetCheck( (src == nullptr || src->RootVisual == nullptr) ? TRUE : FALSE );
}
void CMfcClockView::OnNone()
{
DestroyHwndSource();
}
// アナログ時計
void CMfcClockView::OnUpdateClock( CCmdUI *pCmdUI )
{
pCmdUI->SetCheck( (GetRootVisual<WpfClock::Clock>() != nullptr) ? TRUE : FALSE );
}
void CMfcClockView::OnClock()
{
SetRootVisual( gcnew WpfClock::Clock() );
}
// 電話っぽい何か
void CMfcClockView::OnUpdatePhone( CCmdUI *pCmdUI )
{
pCmdUI->SetCheck( (GetRootVisual<WpfClock::PhoneButtonsPage>() != nullptr) ? TRUE : FALSE );
}
void CMfcClockView::OnPhone()
{
auto rootVisual = SetRootVisual( gcnew WpfClock::PhoneButtonsPage() );
// サンプルなのでイベントハンドラのデリゲートを解除していない
rootVisual->RaiseEnterEvent += MAKE_DELEGATE( System::EventHandler, OnEnter );
}
#include <msclr\marshal_atl.h>
void CMfcClockView::OnEnter( System::Object^ sender, System::EventArgs^ )
{
// 送信元はルートのページなので、そっちをキャストして直接参照する
auto page = dynamic_cast<WpfClock::PhoneButtonsPage^>(sender);
auto text = msclr::interop::marshal_as<CString>( page->Text );
if( text.IsEmpty() )
{
AfxMessageBox( _T( "番号を入力してください。" ) );
}
else
{
AfxMessageBox( _T( "電話っぽい感じでしょ?\n\n" ) + text, MB_ICONINFORMATION|MB_OK );
page->Text = L"";
}
page->SetDefFocus();
}
// マウスオーバーでアイテムサイズが変わるリストボックス
void CMfcClockView::OnUpdateListbox( CCmdUI *pCmdUI )
{
pCmdUI->SetCheck( (GetRootVisual<WpfClock::PhotoListPage>() != nullptr) ? TRUE : FALSE );
}
void CMfcClockView::OnListbox()
{
SetRootVisual( gcnew WpfClock::PhotoListPage() );
}
// 住所録っぽい何か
void CMfcClockView::OnUpdateAddr( CCmdUI *pCmdUI )
{
pCmdUI->SetCheck( (GetRootVisual<WpfClock::AddrDetailPage>() != nullptr) ? TRUE : FALSE );
}
void CMfcClockView::OnAddr()
{
SetRootVisual( gcnew WpfClock::AddrDetailPage() );
}
| [
"[email protected]"
] | |
046fa09f66d05c995eed73337bd0004631dfffe6 | fb7bcba5725b90c50049f5c81f1b8568b187ce88 | /opencv-markerless-AR-master/src/ObjRecog/imageDB.cpp | 78501631c52a20995068a66f8176497e6bffef78 | [
"MIT"
] | permissive | stanchiang/constellation | 3f826ecf73f545270c9a6114d9aa404cfc21ecc7 | c99fdf78cd7589ccd2372d67de5d33839cef1fb1 | refs/heads/master | 2021-05-03T10:50:04.145921 | 2016-09-08T21:58:39 | 2016-09-08T21:58:39 | 65,751,116 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 18,831 | cpp | /*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
//
// Copyright (C) 2012, Takuya MINAGAWA.
// Third party copyrights are property of their respective owners.
//
// 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.
//
//M*/
#include "imageDB.h"
#include "orException.h"
#include "commonCvFunctions.h"
#include <iostream>
#include <opencv2/calib3d/calib3d.hpp>
#define _USE_MATH_DEFINES
#include <math.h>
using namespace std;
using namespace cv;
using namespace cvar;
using namespace cvar::or;
imageDB::imageDB(void)
{
imageNum = 0;
featureNum = 0;
// visual_word_num = 0;
threshold = (float)0.9;
geo_threshold = 0.95;
voteNum = 1;
dist_diff_threshold = 0.005;
// angle_diff_threshold = 0.5;
// scale_diff_threshold = 2;
}
imageDB::~imageDB(void)
{
release();
}
void imageDB::clearVoteTables()
{
vector<featureVote>* vote_vec;
map<int,vector<featureVote>*>::iterator itr = imgVote_map.begin();
while(itr != imgVote_map.end()){
vote_vec = itr->second;
vote_vec->clear();
itr++;
}
}
void imageDB::releaseImgVoteMap()
{
vector<featureVote>* vote_vec;
map<int,vector<featureVote>*>::iterator itr = imgVote_map.begin();
while(itr != imgVote_map.end()){
vote_vec = itr->second;
vote_vec->clear();
delete vote_vec;
itr++;
}
imgVote_map.clear();
}
void imageDB::release()
{
imageNum = 0;
featureNum = 0;
releaseImgVoteMap();
imgInfo_map.clear();
keypoint_map.clear();
feature_KPT_map.clear();
}
int imageDB::registImageFeatures(int img_id, Size img_size, vector<KeyPoint> kp_vec, vector<int> id_list)
{
featureInfo feat_info;
// ToDo: 例外処理 kp_vec.size()とid_list.size()の不一致
imageInfo img_info;
img_info.feature_num = kp_vec.size();
img_info.img_size = img_size;
pair<map<int,imageInfo>::iterator,bool> ret_insert;
ret_insert = imgInfo_map.insert(pair<int,imageInfo>(img_id, img_info));
// ToDo: 例外処理
if(!(bool)(ret_insert.second)){
return -1;
}
vector<featureVote>* voteTable = new vector<featureVote>;
imgVote_map.insert(pair<int,vector<featureVote>*>(img_id, voteTable));
feat_info.img_id = img_id;
int keypoint_id;
int i;
int size = kp_vec.size();
// regist image features as img_id
// ToDo: 例外処理
for(i=0;i<size;i++){
if(id_list[i*voteNum]>=0){
keypoint_id = getVacantKptId();
feat_info.keypoint_id = keypoint_id;
this->keypoint_map.insert(pair<int,KeyPoint>(keypoint_id, kp_vec[i]));
this->feature_KPT_map.insert(pair<int,featureInfo>(id_list[i*voteNum], feat_info));
}
}
imageNum++;
return 0;
}
// keypoint_idの割り当て
int imageDB::getVacantKptId()
{
int size = keypoint_map.size();
if(featureNum == size){
featureNum++;
return featureNum;
}
else if(featureNum > size){
for(int i=1; i<=featureNum; i++){
if(keypoint_map.count(i)==0){
return i;
}
}
}
throw orException("Keypoint_map collapse!!!");
}
// img_idの情報をDBから削除
int imageDB::removeImageId(int img_id)
{
/////// erase img_id from imginfo_map //////
map<int, imageInfo>::iterator imginfo_itr;
imginfo_itr = imgInfo_map.find(img_id);
if(imginfo_itr == imgInfo_map.end()){
return -1;
}
imgInfo_map.erase(imginfo_itr);
/////// erase img_id from feature_KPT_map and obtain the list of keypoint_id //////
multimap<int,featureInfo>::iterator begin_itr, end_itr;
multimap<int,featureInfo>::iterator feat_itr = feature_KPT_map.begin();
featureInfo feat_info;
vector<int> kpt_list;
while(feat_itr != feature_KPT_map.end())
{
feat_info = feat_itr->second;
if(feat_info.img_id == img_id){
begin_itr = feat_itr;
do{
kpt_list.push_back(feat_info.keypoint_id);
feat_itr++;
if(feat_itr != feature_KPT_map.end()){
feat_info = feat_itr->second;
}
else{
break;
}
}while(feat_info.img_id == img_id);
end_itr = feat_itr;
feature_KPT_map.erase(begin_itr, end_itr);
feat_itr = feature_KPT_map.begin();
}
else{
feat_itr++;
}
}
/////// erase keypoint_id from keypoint_map //////
map<int, KeyPoint>::iterator kpt_itr;
vector<int>::iterator vec_itr = kpt_list.begin();
while(vec_itr!=kpt_list.end()){
kpt_itr = keypoint_map.find(*vec_itr);
keypoint_map.erase(kpt_itr);
vec_itr++;
}
/////// erase img_id from imgVote_map //////
map<int,std::vector<featureVote>*>::iterator votemap_itr;
votemap_itr = imgVote_map.find(img_id);
vector<featureVote>* fv_vec = votemap_itr->second;
imgVote_map.erase(votemap_itr);
fv_vec->clear();
delete fv_vec;
imageNum--;
return img_id;
}
bool greaterResultProb(const resultInfo& result_A, const resultInfo& result_B)
{
return result_A.probability > result_B.probability;
}
bool greaterResultMatch(const resultInfo& result_A, const resultInfo& result_B)
{
return result_A.matched_num > result_B.matched_num;
}
vector<resultInfo> imageDB::retrieveImageId(const vector<KeyPoint>& kp_vec, const vector<int>& id_list, Size img_size, int visual_word_num, int result_num)
{
// Handling param error
if(voteNum * kp_vec.size() != id_list.size() || visual_word_num < 1){
orArgException e;
e.setFunctionName("imageDB::retrieveImageId");
string msg;
if(kp_vec.size() != id_list.size()){
msg = "keypoint and id list must be same size.";
}
if(visual_word_num < 1){
msg = msg + "visual word must be more than 1";
}
e.setMessage(msg);
throw e;
}
vector<resultInfo> result_vec;
resultInfo result_info;
try{
voteInputFeatures(kp_vec, id_list);
vector<resultInfo> tmp_result = calcMatchCountResult(kp_vec, visual_word_num);
result_vec = calcGeometryConsistentResult(kp_vec, tmp_result, img_size, result_num);
// calcHomograpy(result_vec, kp_vec);
// sort
// std::sort(result_vec.begin(), result_vec.end(), greaterResultProb);
clearVoteTables();
}
catch(std::exception e2){
throw e2;
}
return result_vec;
}
imageInfo imageDB::getImageInfo(int img_id)
{
return imgInfo_map[img_id];
}
////////////// Internal Functions ///////////////////
void imageDB::voteInputFeatures(const vector<KeyPoint>& kp_vec, const vector<int>& id_list)
{
multimap<int,featureInfo>::iterator itr;
map<int, vector<featureVote>*>::iterator vote_itr;
featureInfo feat_info;
featureVote vote_info;
int i,j;
int size = kp_vec.size();
int m;
try{
m=0;
for(i=0;i<size;i++){
for(j=0;j<voteNum;j++){
if(id_list[m] >= 0){
itr = feature_KPT_map.find(id_list[m]);
while(itr != feature_KPT_map.end() && itr->first == id_list[m]){
feat_info = itr->second;
vote_info.in_feat_i = i;
vote_info.keypoint_id = feat_info.keypoint_id;
vote_itr = imgVote_map.find(feat_info.img_id);
if(vote_itr != imgVote_map.end()){
(vote_itr->second)->push_back(vote_info);
}
itr++;
}
}
m++;
}
}
}
catch(std::exception e)
{
throw e;
}
}
// transfer input Keypoint vector and vote_table to the pair of point
// reg_vec: feature point coordinates of registered image
// query_vec: feature point coordinates of query image
void imageDB::calcPointPair(const vector<KeyPoint>& kp_vec, vector<featureVote>& vote_table, vector<Point2f>& query_pts, vector<Point2f>& reg_pts)
{
vector<featureVote>::iterator itr = vote_table.begin();
while(itr!=vote_table.end())
{
query_pts.push_back(kp_vec[itr->in_feat_i].pt);
reg_pts.push_back(keypoint_map[itr->keypoint_id].pt);
itr++;
}
}
vector<resultInfo> imageDB::calcMatchCountResult(const vector<KeyPoint>& kp_vec, int visual_word_num)
{
vector<resultInfo> result_vec;
int img_id, match_num, reg_feats_num;
float Pp;
float prob;
resultInfo result_info;
int in_feats_num = kp_vec.size();
vector<featureVote>* vote_table;
try{
// First, calculate probability from number of matching feature points
map<int, vector<featureVote>*>::iterator vote_itr = imgVote_map.begin();
while(vote_itr!=imgVote_map.end()){
vote_table = vote_itr->second;
match_num = vote_table->size();
if(match_num >= 5){
img_id = vote_itr->first;
reg_feats_num = (imgInfo_map[img_id]).feature_num;
Pp = (float)voteNum*reg_feats_num / visual_word_num;
if(Pp>1) Pp=1;
prob = calcIntegBinDistribution(in_feats_num, match_num, Pp);
if(prob >= threshold){
result_info.img_id = img_id;
result_info.matched_num = match_num;
result_info.img_size = imgInfo_map[img_id].img_size;
result_info.probability = prob;
result_vec.push_back(result_info);
}
}
vote_itr++;
}
int s = result_vec.size();
if(s>1){
std::sort(result_vec.begin(), result_vec.end(), greaterResultProb);
}
return result_vec;
}
catch(cv::Exception e){
orCvException orce;
orce.setFunctionName("imageDB::calcMatchCountResult()");
orce.setCvExceptionClass(e);
throw orce;
}
catch(std::exception e2){
throw e2;
}
}
vector<resultInfo> imageDB::calcGeometryConsistentResult(const vector<KeyPoint>& kp_vec, const vector<resultInfo>& tmp_result_vec, Size img_size, int result_num)
{
vector<resultInfo> result_vec;
int s = tmp_result_vec.size();
if(!s)
return result_vec;
int img_id, match_num;
resultInfo result_info;
int in_feats_num = kp_vec.size();
// int inlier_num;
vector<featureVote>* vote_table;
vector<Point2f> query_vec;
vector<Point2f> reg_vec;
// for scale & direction consistency
// vector<KeyPoint> query_kpt;
// vector<KeyPoint> reg_kpt;
///////////////////////
try{
// Second, calculate geometrical consistency
int count = 0;
// float Pp, prob;
bool shape_valid;
int th_dist = (int)(sqrt(dist_diff_threshold * img_size.width * img_size.height / M_PI) + 0.5);
for(int i=0;i<s && count<result_num;i++){
result_info = tmp_result_vec[i];
img_id = result_info.img_id;
match_num = result_info.matched_num;
vote_table = imgVote_map[img_id];
calcPointPair(kp_vec, *vote_table, query_vec, reg_vec);
// Mat poseMat = findHomography(transPointVecToMat(reg_vec), transPointVecToMat(query_vec), CV_RANSAC, th_dist); // get Homography Matrix
Mat poseMat = findHomography(Mat(reg_vec), Mat(query_vec), CV_RANSAC, th_dist); // get Homography Matrix
// Mat poseMat = findHomography(reg_vec, query_vec, CV_LMEDS); // get Homography Matrix
// Affine Transform regist image with poseMat, and check its shape
vector<Point2f> pos_points = calcAffineTransformRect(imgInfo_map[img_id].img_size, poseMat);
shape_valid = checkRectShape(pos_points);
reg_vec.clear();
query_vec.clear();
if(shape_valid){
result_info.pose_mat = poseMat;
result_info.object_position = pos_points;
result_vec.push_back(result_info);
count++;
}
}
return result_vec;
}
catch(cv::Exception e){
orCvException orce;
orce.setFunctionName("imageDB::calcGeometryConsistentResult()");
orce.setCvExceptionClass(e);
throw orce;
}
catch(std::exception e2){
throw e2;
}
}
/*
void imageDB::calcKeypointPair(const vector<KeyPoint>& kp_vec, vector<featureVote>& vote_table, vector<KeyPoint>& query_kpt, vector<KeyPoint>& reg_kpt)
{
vector<featureVote>::iterator itr = vote_table.begin();
while(itr!=vote_table.end())
{
query_kpt.push_back(kp_vec[itr->in_feat_i]);
reg_kpt.push_back(keypoint_map[itr->keypoint_id]);
itr++;
}
}
*/
// position
int imageDB::countAffineInlier(vector<Point2f> &src_pts, vector<Point2f> &dest_pts, Mat &affMat, double dist_threshold)
{
try{
Mat src_mat = transPointVecToMatHom(src_pts);
// Mat dest_mat = transPointVecToMatHom(dest_pts);
Mat calc_mat = affMat * src_mat;
double sub_x, sub_y, dist;
int count = 0;
int size = src_pts.size();
for(int i=0; i<size; i++){
sub_x = dest_pts[i].x - calc_mat.at<double>(0,i) / calc_mat.at<double>(2,i);
sub_y = dest_pts[i].y - calc_mat.at<double>(1,i) / calc_mat.at<double>(2,i);
dist = sqrt(sub_x * sub_x + sub_y * sub_y);
if(dist < dist_threshold)
count++;
}
return count;
}
catch(cv::Exception e){
orCvException orce;
orce.setFunctionName("imageDB::countAffineInlier()");
orce.setCvExceptionClass(e);
throw orce;
}
catch(std::exception e2){
throw e2;
}
}
float imageDB::calcIntegBinDistribution(int in_feats_num, int match_num, float Pp)
{
float prob = 0;
// float Np = 1.0 - Pp;
float tmp1;
float logPp = log(Pp);
float logNp = log((float)1.0 - Pp);
int i,j;
for(i=0;i<=match_num;i++){
tmp1 = 0;
for(j=0;j<i;j++){
tmp1 += (float)log((double)(in_feats_num - j));
tmp1 -= (float)log((double)(j+1));
}
tmp1 += logPp*i;
tmp1 += logNp*(in_feats_num-i);
prob += exp(tmp1);
if(prob > 1){
prob = 1;
break;
}
}
return prob;
}
////////////////////////////////////////////
void imageDB::setThreshold(float th)
{
this->threshold = th;
}
float imageDB::getThreshold() const
{
return this->threshold;
}
void imageDB::setVoteNum(int vote_num)
{
voteNum = vote_num;
}
///////////// Load & Save ////////////////////
int imageDB::save(const string& filename) const
{
FileStorage cvfs(filename,CV_STORAGE_WRITE);
this->write(cvfs, "imageDB");
return 0;
}
int imageDB::load(const string& filename)
{
try{
FileStorage cvfs(filename,CV_STORAGE_READ);
FileNode cvfn(cvfs.fs, NULL);
FileNode cvfn2 = cvfn["imageDB"];
this->read(cvfs, cvfn2);
}
catch(cv::Exception e){
orCvException orce;
orce.setFunctionName("imageDB::load()");
orce.setCvExceptionClass(e);
throw orce;
}
catch(std::exception e2){
throw e2;
}
return 0;
}
int imageDB::write(FileStorage& cvfs, const string& name) const
{
WriteStructContext ws(cvfs, name, CV_NODE_MAP);
cv::write(cvfs,"imageNum",imageNum);
cv::write(cvfs,"featureNum",featureNum);
cv::write(cvfs,"threshold",threshold);
cv::write(cvfs,"geo_threshold",geo_threshold);
cv::write(cvfs,"dist_diff_threshold",dist_diff_threshold);
writeFeatureKptMap(cvfs, "feature_KPT_map");
writeKeyMap(cvfs, "keypoint_map");
writeImgInfoMap(cvfs, "imgInfo_map");
return 0;
}
int imageDB::read(const FileStorage& cvfs, const FileNode& node)
{
FileNode fn;
imageNum = node["imageNum"];
featureNum = node["featureNum"];
threshold = node["threshold"];
geo_threshold = node["geo_threshold"];
dist_diff_threshold = node["dist_diff_threshold"];
fn = node["feature_KPT_map"];
readFeatureKptMap(cvfs, fn);
fn = node["keypoint_map"];
readKeyMap(cvfs,fn);
fn = node["imgInfo_map"];
readImgInfoMap(cvfs,fn);
return 0;
}
int imageDB::writeFeatureKptMap(FileStorage& cvfs, const string& name) const
{
try{
WriteStructContext ws(cvfs, name, CV_NODE_SEQ);
multimap<int,featureInfo>::const_iterator itr = feature_KPT_map.begin();
featureInfo feature_info;
while(itr!= feature_KPT_map.end()){
WriteStructContext ws2(cvfs, "", CV_NODE_MAP);
cv::write(cvfs, "feature_id", itr->first);
feature_info = itr->second;
cv::write(cvfs, "keypoint_id",feature_info.keypoint_id);
cv::write(cvfs, "img_id", feature_info.img_id);
itr++;
}
}
catch(cv::Exception e){
orCvException orce;
orce.setFunctionName("visualWords::load()");
orce.setCvExceptionClass(e);
throw orce;
}
catch(std::exception e2){
throw e2;
}
// cvEndWriteStruct(cvfs);
return 0;
}
int imageDB::readFeatureKptMap(const FileStorage& cvfs, const FileNode& node)
{
feature_KPT_map.clear();
int feature_id;
featureInfo feature_info;
FileNodeIterator it = node.begin();
while(it != node.end()){
feature_id = (int)(*it)["feature_id"];
feature_info.keypoint_id = (int)(*it)["keypoint_id"];
feature_info.img_id = (int)(*it)["img_id"];
feature_KPT_map.insert(pair<int, featureInfo>(feature_id,feature_info));
it++;
}
return 0;
}
int imageDB::writeKeyMap(FileStorage& cvfs, const string& name) const
{
WriteStructContext ws(cvfs, name, CV_NODE_SEQ);
map<int,KeyPoint>::const_iterator itr = keypoint_map.begin();
while(itr!= keypoint_map.end()){
WriteStructContext ws2(cvfs, "", CV_NODE_MAP);
cv::write(cvfs, "keypoint_id", itr->first);
vector<KeyPoint> kpt_vec;
kpt_vec.push_back(itr->second);
cv::write(cvfs, "KeyPoint", kpt_vec);
itr++;
}
return 0;
}
int imageDB::readKeyMap(const FileStorage& cvfs, const FileNode& node)
{
keypoint_map.clear();
int keypoint_id;
FileNodeIterator it = node.begin();
while(it != node.end()){
vector<KeyPoint> keypt_vec;
keypoint_id = (int)(*it)["keypoint_id"];
cv::read((*it)["KeyPoint"], keypt_vec);
keypoint_map.insert(pair<int,KeyPoint>(keypoint_id,keypt_vec[0]));
it++;
}
return 0;
}
int imageDB::writeImgInfoMap(FileStorage& cvfs, const string& name) const
{
WriteStructContext ws(cvfs, name, CV_NODE_SEQ);
imageInfo img_info;
map<int, imageInfo>::const_iterator itr = imgInfo_map.begin();
while(itr!= imgInfo_map.end()){
WriteStructContext ws2(cvfs, "", CV_NODE_SEQ);
cv::write(cvfs, itr->first);
img_info = itr->second;
cv::write(cvfs, img_info.feature_num);
cv::write(cvfs, img_info.img_size.width);
cv::write(cvfs, img_info.img_size.height);
itr++;
}
return 0;
}
int imageDB::readImgInfoMap(const FileStorage& cvfs, const FileNode& node)
{
imgInfo_map.clear();
releaseImgVoteMap();
int img_id;
imageInfo img_info;
FileNodeIterator it = node.begin();
while(it != node.end()){
img_id = (int)(*it)[0];
img_info.feature_num = (int)(*it)[1];
img_info.img_size = Size((int)(*it)[2],(int)(*it)[3]);
imgInfo_map.insert(pair<int,imageInfo>(img_id,img_info));
// create voteTable
vector<featureVote>* voteTable = new vector<featureVote>;
imgVote_map.insert(pair<int,vector<featureVote>*>(img_id, voteTable));
it++;
}
return 0;
}
////////////////////////////////////////////////////////////////////////////
| [
"[email protected]"
] | |
e0786a70b8e01e0a81b65daa93ac902d2d8d6f48 | 9924cc35038c3743faff030cc284ca4f4f6c684e | /012sllSort.cpp | 736c832d63e014b282baf10fc83fb0f7a48af960 | [] | no_license | sabhitha/MissionRnD-C-LinkedLists-Worksheet | 73073a2fb81e3d5c228a82068d1abdaa41a659f3 | 603aa893e8e248aa4d4abccf29cb4d24d0b9959f | refs/heads/master | 2021-01-10T03:57:07.028348 | 2015-12-08T06:52:46 | 2015-12-08T06:52:46 | 46,938,948 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 933 | cpp | /*
OVERVIEW: Given a single linked list of 0s 1s and 2s ,Sort the SLL such that zeroes
will be followed by ones and then twos.
INPUTS: SLL head pointer
OUTPUT: Sorted SLL ,Head should Finally point to an sll of sorted 0,1,2
ERROR CASES:
NOTES: Only 0,1,2, will be in sll nodes
*/
#include <stdio.h>
#include <malloc.h>
struct node {
int data;
struct node *next;
};
typedef struct node NODE;
void sll_012_sort(struct node *head){
NODE *ptr;
ptr = head;
int count = 0;
int count0 = 0;
int count1 = 0;
int count2 = 0;
while (ptr){
if (ptr->data == 0)
count0++;
else if (ptr->data == 1)
count1++;
else if (ptr->data == 2)
count2++;
count++;
ptr = ptr->next;
}
ptr = head;
for (int i = 0; i < count0; i++){
ptr->data = 0;
ptr = ptr->next;
}
for (int i = 0; i < count1; i++){
ptr->data = 1;
ptr = ptr->next;
}
for (int i = 0; i < count2; i++){
ptr->data = 2;
ptr = ptr->next;
}
} | [
"[email protected]"
] | |
31fa5eee7292872ee6a942fa41f0d5b2c3b7d1ca | 2eb57e97e63b5e30c61bf1df67dc457784ab4b9e | /src/rpcserver.cpp | 904d0eac822e2cafe3681d66720c93d3a3190b0b | [
"MIT"
] | permissive | alp-project/AlphaCoin | 6a2574790be812c2c45bd2e914746533c2137954 | e56a5dbd32ec29340c8462ac3fc6cf3f13930b4c | refs/heads/master | 2021-09-15T23:16:37.351874 | 2018-02-02T02:21:00 | 2018-02-02T02:21:00 | 119,905,330 | 0 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 40,798 | cpp | // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2017 The AlphaCoin developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "rpcserver.h"
#include "base58.h"
#include "init.h"
#include "main.h"
#include "ui_interface.h"
#include "util.h"
#ifdef ENABLE_WALLET
#include "wallet.h"
#endif
#include "json/json_spirit_writer_template.h"
#include <boost/algorithm/string.hpp>
#include <boost/asio.hpp>
#include <boost/asio/ssl.hpp>
#include <boost/bind.hpp>
#include <boost/filesystem.hpp>
#include <boost/foreach.hpp>
#include <boost/iostreams/concepts.hpp>
#include <boost/iostreams/stream.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/thread.hpp>
using namespace boost;
using namespace boost::asio;
using namespace json_spirit;
using namespace std;
static std::string strRPCUserColonPass;
static bool fRPCRunning = false;
static bool fRPCInWarmup = true;
static std::string rpcWarmupStatus("RPC server started");
static CCriticalSection cs_rpcWarmup;
//! These are created by StartRPCThreads, destroyed in StopRPCThreads
static asio::io_service* rpc_io_service = NULL;
static map<string, boost::shared_ptr<deadline_timer> > deadlineTimers;
static ssl::context* rpc_ssl_context = NULL;
static boost::thread_group* rpc_worker_group = NULL;
static boost::asio::io_service::work* rpc_dummy_work = NULL;
static std::vector<CSubNet> rpc_allow_subnets; //!< List of subnets to allow RPC connections from
static std::vector<boost::shared_ptr<ip::tcp::acceptor> > rpc_acceptors;
void RPCTypeCheck(const Array& params,
const list<Value_type>& typesExpected,
bool fAllowNull)
{
unsigned int i = 0;
BOOST_FOREACH (Value_type t, typesExpected) {
if (params.size() <= i)
break;
const Value& v = params[i];
if (!((v.type() == t) || (fAllowNull && (v.type() == null_type)))) {
string err = strprintf("Expected type %s, got %s",
Value_type_name[t], Value_type_name[v.type()]);
throw JSONRPCError(RPC_TYPE_ERROR, err);
}
i++;
}
}
void RPCTypeCheck(const Object& o,
const map<string, Value_type>& typesExpected,
bool fAllowNull)
{
BOOST_FOREACH (const PAIRTYPE(string, Value_type) & t, typesExpected) {
const Value& v = find_value(o, t.first);
if (!fAllowNull && v.type() == null_type)
throw JSONRPCError(RPC_TYPE_ERROR, strprintf("Missing %s", t.first));
if (!((v.type() == t.second) || (fAllowNull && (v.type() == null_type)))) {
string err = strprintf("Expected type %s for %s, got %s",
Value_type_name[t.second], t.first, Value_type_name[v.type()]);
throw JSONRPCError(RPC_TYPE_ERROR, err);
}
}
}
static inline int64_t roundint64(double d)
{
return (int64_t)(d > 0 ? d + 0.5 : d - 0.5);
}
CAmount AmountFromValue(const Value& value)
{
double dAmount = value.get_real();
if (dAmount <= 0.0 || dAmount > 21000000.0)
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
CAmount nAmount = roundint64(dAmount * COIN);
if (!MoneyRange(nAmount))
throw JSONRPCError(RPC_TYPE_ERROR, "Invalid amount");
return nAmount;
}
Value ValueFromAmount(const CAmount& amount)
{
return (double)amount / (double)COIN;
}
uint256 ParseHashV(const Value& v, string strName)
{
string strHex;
if (v.type() == str_type)
strHex = v.get_str();
if (!IsHex(strHex)) // Note: IsHex("") is false
throw JSONRPCError(RPC_INVALID_PARAMETER, strName + " must be hexadecimal string (not '" + strHex + "')");
uint256 result;
result.SetHex(strHex);
return result;
}
uint256 ParseHashO(const Object& o, string strKey)
{
return ParseHashV(find_value(o, strKey), strKey);
}
vector<unsigned char> ParseHexV(const Value& v, string strName)
{
string strHex;
if (v.type() == str_type)
strHex = v.get_str();
if (!IsHex(strHex))
throw JSONRPCError(RPC_INVALID_PARAMETER, strName + " must be hexadecimal string (not '" + strHex + "')");
return ParseHex(strHex);
}
vector<unsigned char> ParseHexO(const Object& o, string strKey)
{
return ParseHexV(find_value(o, strKey), strKey);
}
/**
* Note: This interface may still be subject to change.
*/
string CRPCTable::help(string strCommand) const
{
string strRet;
string category;
set<rpcfn_type> setDone;
vector<pair<string, const CRPCCommand*> > vCommands;
for (map<string, const CRPCCommand*>::const_iterator mi = mapCommands.begin(); mi != mapCommands.end(); ++mi)
vCommands.push_back(make_pair(mi->second->category + mi->first, mi->second));
sort(vCommands.begin(), vCommands.end());
BOOST_FOREACH (const PAIRTYPE(string, const CRPCCommand*) & command, vCommands) {
const CRPCCommand* pcmd = command.second;
string strMethod = pcmd->name;
// We already filter duplicates, but these deprecated screw up the sort order
if (strMethod.find("label") != string::npos)
continue;
if ((strCommand != "" || pcmd->category == "hidden") && strMethod != strCommand)
continue;
#ifdef ENABLE_WALLET
if (pcmd->reqWallet && !pwalletMain)
continue;
#endif
try {
Array params;
rpcfn_type pfn = pcmd->actor;
if (setDone.insert(pfn).second)
(*pfn)(params, true);
} catch (std::exception& e) {
// Help text is returned in an exception
string strHelp = string(e.what());
if (strCommand == "") {
if (strHelp.find('\n') != string::npos)
strHelp = strHelp.substr(0, strHelp.find('\n'));
if (category != pcmd->category) {
if (!category.empty())
strRet += "\n";
category = pcmd->category;
string firstLetter = category.substr(0, 1);
boost::to_upper(firstLetter);
strRet += "== " + firstLetter + category.substr(1) + " ==\n";
}
}
strRet += strHelp + "\n";
}
}
if (strRet == "")
strRet = strprintf("help: unknown command: %s\n", strCommand);
strRet = strRet.substr(0, strRet.size() - 1);
return strRet;
}
Value help(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 1)
throw runtime_error(
"help ( \"command\" )\n"
"\nList all commands, or get help for a specified command.\n"
"\nArguments:\n"
"1. \"command\" (string, optional) The command to get help on\n"
"\nResult:\n"
"\"text\" (string) The help text\n");
string strCommand;
if (params.size() > 0)
strCommand = params[0].get_str();
return tableRPC.help(strCommand);
}
Value stop(const Array& params, bool fHelp)
{
// Accept the deprecated and ignored 'detach' boolean argument
if (fHelp || params.size() > 1)
throw runtime_error(
"stop\n"
"\nStop ALP server.");
// Shutdown will take long enough that the response should get back
StartShutdown();
return "ALP server stopping";
}
/**
* Call Table
*/
static const CRPCCommand vRPCCommands[] =
{
// category name actor (function) okSafeMode threadSafe reqWallet
// --------------------- ------------------------ ----------------------- ---------- ---------- ---------
/* Overall control/query calls */
{"control", "getinfo", &getinfo, true, false, false}, /* uses wallet if enabled */
{"control", "help", &help, true, true, false},
{"control", "stop", &stop, true, true, false},
/* P2P networking */
{"network", "getnetworkinfo", &getnetworkinfo, true, false, false},
{"network", "addnode", &addnode, true, true, false},
{"network", "getaddednodeinfo", &getaddednodeinfo, true, true, false},
{"network", "getconnectioncount", &getconnectioncount, true, false, false},
{"network", "getnettotals", &getnettotals, true, true, false},
{"network", "getpeerinfo", &getpeerinfo, true, false, false},
{"network", "ping", &ping, true, false, false},
/* Block chain and UTXO */
{"blockchain", "getblockchaininfo", &getblockchaininfo, true, false, false},
{"blockchain", "getbestblockhash", &getbestblockhash, true, false, false},
{"blockchain", "getblockcount", &getblockcount, true, false, false},
{"blockchain", "getblock", &getblock, true, false, false},
{"blockchain", "getblockhash", &getblockhash, true, false, false},
{"blockchain", "getblockheader", &getblockheader, false, false, false},
{"blockchain", "getchaintips", &getchaintips, true, false, false},
{"blockchain", "getdifficulty", &getdifficulty, true, false, false},
{"blockchain", "getmempoolinfo", &getmempoolinfo, true, true, false},
{"blockchain", "getrawmempool", &getrawmempool, true, false, false},
{"blockchain", "gettxout", &gettxout, true, false, false},
{"blockchain", "gettxoutsetinfo", &gettxoutsetinfo, true, false, false},
{"blockchain", "verifychain", &verifychain, true, false, false},
{"blockchain", "invalidateblock", &invalidateblock, true, true, false},
{"blockchain", "reconsiderblock", &reconsiderblock, true, true, false},
/* Mining */
{"mining", "getblocktemplate", &getblocktemplate, true, false, false},
{"mining", "getmininginfo", &getmininginfo, true, false, false},
{"mining", "getnetworkhashps", &getnetworkhashps, true, false, false},
{"mining", "prioritisetransaction", &prioritisetransaction, true, false, false},
{"mining", "submitblock", &submitblock, true, true, false},
{"mining", "reservebalance", &reservebalance, true, true, false},
#ifdef ENABLE_WALLET
/* Coin generation */
{"generating", "getgenerate", &getgenerate, true, false, false},
{"generating", "gethashespersec", &gethashespersec, true, false, false},
{"generating", "setgenerate", &setgenerate, true, true, false},
#endif
/* Raw transactions */
{"rawtransactions", "createrawtransaction", &createrawtransaction, true, false, false},
{"rawtransactions", "decoderawtransaction", &decoderawtransaction, true, false, false},
{"rawtransactions", "decodescript", &decodescript, true, false, false},
{"rawtransactions", "getrawtransaction", &getrawtransaction, true, false, false},
{"rawtransactions", "sendrawtransaction", &sendrawtransaction, false, false, false},
{"rawtransactions", "signrawtransaction", &signrawtransaction, false, false, false}, /* uses wallet if enabled */
/* Utility functions */
{"util", "createmultisig", &createmultisig, true, true, false},
{"util", "validateaddress", &validateaddress, true, false, false}, /* uses wallet if enabled */
{"util", "verifymessage", &verifymessage, true, false, false},
{"util", "estimatefee", &estimatefee, true, true, false},
{"util", "estimatepriority", &estimatepriority, true, true, false},
/* Not shown in help */
{"hidden", "invalidateblock", &invalidateblock, true, true, false},
{"hidden", "reconsiderblock", &reconsiderblock, true, true, false},
{"hidden", "setmocktime", &setmocktime, true, false, false},
/* AlphaCoin features */
{"alp", "masternode", &masternode, true, true, false},
{"alp", "masternodelist", &masternodelist, true, true, false},
{"alp", "mnbudget", &mnbudget, true, true, false},
{"alp", "mnbudgetvoteraw", &mnbudgetvoteraw, true, true, false},
{"alp", "mnfinalbudget", &mnfinalbudget, true, true, false},
{"alp", "mnsync", &mnsync, true, true, false},
{"alp", "spork", &spork, true, true, false},
#ifdef ENABLE_WALLET
{"alp", "obfuscation", &obfuscation, false, false, true}, /* not threadSafe because of SendMoney */
/* Wallet */
{"wallet", "addmultisigaddress", &addmultisigaddress, true, false, true},
{"wallet", "autocombinerewards", &autocombinerewards, false, false, true},
{"wallet", "backupwallet", &backupwallet, true, false, true},
{"wallet", "dumpprivkey", &dumpprivkey, true, false, true},
{"wallet", "dumpwallet", &dumpwallet, true, false, true},
{"wallet", "bip38encrypt", &bip38encrypt, true, false, true},
{"wallet", "bip38decrypt", &bip38decrypt, true, false, true},
{"wallet", "encryptwallet", &encryptwallet, true, false, true},
{"wallet", "getaccountaddress", &getaccountaddress, true, false, true},
{"wallet", "getaccount", &getaccount, true, false, true},
{"wallet", "getaddressesbyaccount", &getaddressesbyaccount, true, false, true},
{"wallet", "getbalance", &getbalance, false, false, true},
{"wallet", "getnewaddress", &getnewaddress, true, false, true},
{"wallet", "getrawchangeaddress", &getrawchangeaddress, true, false, true},
{"wallet", "getreceivedbyaccount", &getreceivedbyaccount, false, false, true},
{"wallet", "getreceivedbyaddress", &getreceivedbyaddress, false, false, true},
{"wallet", "getstakingstatus", &getstakingstatus, false, false, true},
{"wallet", "getstakesplitthreshold", &getstakesplitthreshold, false, false, true},
{"wallet", "gettransaction", &gettransaction, false, false, true},
{"wallet", "getunconfirmedbalance", &getunconfirmedbalance, false, false, true},
{"wallet", "getwalletinfo", &getwalletinfo, false, false, true},
{"wallet", "importprivkey", &importprivkey, true, false, true},
{"wallet", "importwallet", &importwallet, true, false, true},
{"wallet", "importaddress", &importaddress, true, false, true},
{"wallet", "keypoolrefill", &keypoolrefill, true, false, true},
{"wallet", "listaccounts", &listaccounts, false, false, true},
{"wallet", "listaddressgroupings", &listaddressgroupings, false, false, true},
{"wallet", "listlockunspent", &listlockunspent, false, false, true},
{"wallet", "listreceivedbyaccount", &listreceivedbyaccount, false, false, true},
{"wallet", "listreceivedbyaddress", &listreceivedbyaddress, false, false, true},
{"wallet", "listsinceblock", &listsinceblock, false, false, true},
{"wallet", "listtransactions", &listtransactions, false, false, true},
{"wallet", "listunspent", &listunspent, false, false, true},
{"wallet", "lockunspent", &lockunspent, true, false, true},
{"wallet", "move", &movecmd, false, false, true},
{"wallet", "multisend", &multisend, false, false, true},
{"wallet", "sendfrom", &sendfrom, false, false, true},
{"wallet", "sendmany", &sendmany, false, false, true},
{"wallet", "sendtoaddress", &sendtoaddress, false, false, true},
{"wallet", "sendtoaddressix", &sendtoaddressix, false, false, true},
{"wallet", "setaccount", &setaccount, true, false, true},
{"wallet", "setstakesplitthreshold", &setstakesplitthreshold, false, false, true},
{"wallet", "settxfee", &settxfee, true, false, true},
{"wallet", "signmessage", &signmessage, true, false, true},
{"wallet", "walletlock", &walletlock, true, false, true},
{"wallet", "walletpassphrasechange", &walletpassphrasechange, true, false, true},
{"wallet", "walletpassphrase", &walletpassphrase, true, false, true},
#endif // ENABLE_WALLET
};
CRPCTable::CRPCTable()
{
unsigned int vcidx;
for (vcidx = 0; vcidx < (sizeof(vRPCCommands) / sizeof(vRPCCommands[0])); vcidx++) {
const CRPCCommand* pcmd;
pcmd = &vRPCCommands[vcidx];
mapCommands[pcmd->name] = pcmd;
}
}
const CRPCCommand* CRPCTable::operator[](string name) const
{
map<string, const CRPCCommand*>::const_iterator it = mapCommands.find(name);
if (it == mapCommands.end())
return NULL;
return (*it).second;
}
bool HTTPAuthorized(map<string, string>& mapHeaders)
{
string strAuth = mapHeaders["authorization"];
if (strAuth.substr(0, 6) != "Basic ")
return false;
string strUserPass64 = strAuth.substr(6);
boost::trim(strUserPass64);
string strUserPass = DecodeBase64(strUserPass64);
return TimingResistantEqual(strUserPass, strRPCUserColonPass);
}
void ErrorReply(std::ostream& stream, const Object& objError, const Value& id)
{
// Send error reply from json-rpc error object
int nStatus = HTTP_INTERNAL_SERVER_ERROR;
int code = find_value(objError, "code").get_int();
if (code == RPC_INVALID_REQUEST)
nStatus = HTTP_BAD_REQUEST;
else if (code == RPC_METHOD_NOT_FOUND)
nStatus = HTTP_NOT_FOUND;
string strReply = JSONRPCReply(Value::null, objError, id);
stream << HTTPReply(nStatus, strReply, false) << std::flush;
}
CNetAddr BoostAsioToCNetAddr(boost::asio::ip::address address)
{
CNetAddr netaddr;
// Make sure that IPv4-compatible and IPv4-mapped IPv6 addresses are treated as IPv4 addresses
if (address.is_v6() && (address.to_v6().is_v4_compatible() || address.to_v6().is_v4_mapped()))
address = address.to_v6().to_v4();
if (address.is_v4()) {
boost::asio::ip::address_v4::bytes_type bytes = address.to_v4().to_bytes();
netaddr.SetRaw(NET_IPV4, &bytes[0]);
} else {
boost::asio::ip::address_v6::bytes_type bytes = address.to_v6().to_bytes();
netaddr.SetRaw(NET_IPV6, &bytes[0]);
}
return netaddr;
}
bool ClientAllowed(const boost::asio::ip::address& address)
{
CNetAddr netaddr = BoostAsioToCNetAddr(address);
BOOST_FOREACH (const CSubNet& subnet, rpc_allow_subnets)
if (subnet.Match(netaddr))
return true;
return false;
}
template <typename Protocol>
class AcceptedConnectionImpl : public AcceptedConnection
{
public:
AcceptedConnectionImpl(
asio::io_service& io_service,
ssl::context& context,
bool fUseSSL) : sslStream(io_service, context),
_d(sslStream, fUseSSL),
_stream(_d)
{
}
virtual std::iostream& stream()
{
return _stream;
}
virtual std::string peer_address_to_string() const
{
return peer.address().to_string();
}
virtual void close()
{
_stream.close();
}
typename Protocol::endpoint peer;
asio::ssl::stream<typename Protocol::socket> sslStream;
private:
SSLIOStreamDevice<Protocol> _d;
iostreams::stream<SSLIOStreamDevice<Protocol> > _stream;
};
void ServiceConnection(AcceptedConnection* conn);
//! Forward declaration required for RPCListen
template <typename Protocol, typename SocketAcceptorService>
static void RPCAcceptHandler(boost::shared_ptr<basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
ssl::context& context,
bool fUseSSL,
boost::shared_ptr<AcceptedConnection> conn,
const boost::system::error_code& error);
/**
* Sets up I/O resources to accept and handle a new connection.
*/
template <typename Protocol, typename SocketAcceptorService>
static void RPCListen(boost::shared_ptr<basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
ssl::context& context,
const bool fUseSSL)
{
// Accept connection
boost::shared_ptr<AcceptedConnectionImpl<Protocol> > conn(new AcceptedConnectionImpl<Protocol>(acceptor->get_io_service(), context, fUseSSL));
acceptor->async_accept(
conn->sslStream.lowest_layer(),
conn->peer,
boost::bind(&RPCAcceptHandler<Protocol, SocketAcceptorService>,
acceptor,
boost::ref(context),
fUseSSL,
conn,
_1));
}
/**
* Accept and handle incoming connection.
*/
template <typename Protocol, typename SocketAcceptorService>
static void RPCAcceptHandler(boost::shared_ptr<basic_socket_acceptor<Protocol, SocketAcceptorService> > acceptor,
ssl::context& context,
const bool fUseSSL,
boost::shared_ptr<AcceptedConnection> conn,
const boost::system::error_code& error)
{
// Immediately start accepting new connections, except when we're cancelled or our socket is closed.
if (error != asio::error::operation_aborted && acceptor->is_open())
RPCListen(acceptor, context, fUseSSL);
AcceptedConnectionImpl<ip::tcp>* tcp_conn = dynamic_cast<AcceptedConnectionImpl<ip::tcp>*>(conn.get());
if (error) {
// TODO: Actually handle errors
LogPrintf("%s: Error: %s\n", __func__, error.message());
}
// Restrict callers by IP. It is important to
// do this before starting client thread, to filter out
// certain DoS and misbehaving clients.
else if (tcp_conn && !ClientAllowed(tcp_conn->peer.address())) {
// Only send a 403 if we're not using SSL to prevent a DoS during the SSL handshake.
if (!fUseSSL)
conn->stream() << HTTPError(HTTP_FORBIDDEN, false) << std::flush;
conn->close();
} else {
ServiceConnection(conn.get());
conn->close();
}
}
static ip::tcp::endpoint ParseEndpoint(const std::string& strEndpoint, int defaultPort)
{
std::string addr;
int port = defaultPort;
SplitHostPort(strEndpoint, port, addr);
return ip::tcp::endpoint(asio::ip::address::from_string(addr), port);
}
void StartRPCThreads()
{
rpc_allow_subnets.clear();
rpc_allow_subnets.push_back(CSubNet("127.0.0.0/8")); // always allow IPv4 local subnet
rpc_allow_subnets.push_back(CSubNet("::1")); // always allow IPv6 localhost
if (mapMultiArgs.count("-rpcallowip")) {
const vector<string>& vAllow = mapMultiArgs["-rpcallowip"];
BOOST_FOREACH (string strAllow, vAllow) {
CSubNet subnet(strAllow);
if (!subnet.IsValid()) {
uiInterface.ThreadSafeMessageBox(
strprintf("Invalid -rpcallowip subnet specification: %s. Valid are a single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or a network/CIDR (e.g. 1.2.3.4/24).", strAllow),
"", CClientUIInterface::MSG_ERROR);
StartShutdown();
return;
}
rpc_allow_subnets.push_back(subnet);
}
}
std::string strAllowed;
BOOST_FOREACH (const CSubNet& subnet, rpc_allow_subnets)
strAllowed += subnet.ToString() + " ";
LogPrint("rpc", "Allowing RPC connections from: %s\n", strAllowed);
strRPCUserColonPass = mapArgs["-rpcuser"] + ":" + mapArgs["-rpcpassword"];
if (((mapArgs["-rpcpassword"] == "") ||
(mapArgs["-rpcuser"] == mapArgs["-rpcpassword"])) &&
Params().RequireRPCPassword()) {
unsigned char rand_pwd[32];
GetRandBytes(rand_pwd, 32);
uiInterface.ThreadSafeMessageBox(strprintf(
_("To use alpd, or the -server option to alp-qt, you must set an rpcpassword in the configuration file:\n"
"%s\n"
"It is recommended you use the following random password:\n"
"rpcuser=alprpc\n"
"rpcpassword=%s\n"
"(you do not need to remember this password)\n"
"The username and password MUST NOT be the same.\n"
"If the file does not exist, create it with owner-readable-only file permissions.\n"
"It is also recommended to set alertnotify so you are notified of problems;\n"
"for example: alertnotify=echo %%s | mail -s \"ALP Alert\" [email protected]\n"),
GetConfigFile().string(),
EncodeBase58(&rand_pwd[0], &rand_pwd[0] + 32)),
"", CClientUIInterface::MSG_ERROR | CClientUIInterface::SECURE);
StartShutdown();
return;
}
assert(rpc_io_service == NULL);
rpc_io_service = new asio::io_service();
rpc_ssl_context = new ssl::context(*rpc_io_service, ssl::context::sslv23);
const bool fUseSSL = GetBoolArg("-rpcssl", false);
if (fUseSSL) {
rpc_ssl_context->set_options(ssl::context::no_sslv2 | ssl::context::no_sslv3);
filesystem::path pathCertFile(GetArg("-rpcsslcertificatechainfile", "server.cert"));
if (!pathCertFile.is_complete()) pathCertFile = filesystem::path(GetDataDir()) / pathCertFile;
if (filesystem::exists(pathCertFile))
rpc_ssl_context->use_certificate_chain_file(pathCertFile.string());
else
LogPrintf("ThreadRPCServer ERROR: missing server certificate file %s\n", pathCertFile.string());
filesystem::path pathPKFile(GetArg("-rpcsslprivatekeyfile", "server.pem"));
if (!pathPKFile.is_complete()) pathPKFile = filesystem::path(GetDataDir()) / pathPKFile;
if (filesystem::exists(pathPKFile))
rpc_ssl_context->use_private_key_file(pathPKFile.string(), ssl::context::pem);
else
LogPrintf("ThreadRPCServer ERROR: missing server private key file %s\n", pathPKFile.string());
string strCiphers = GetArg("-rpcsslciphers", "TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH");
SSL_CTX_set_cipher_list(rpc_ssl_context->impl(), strCiphers.c_str());
}
std::vector<ip::tcp::endpoint> vEndpoints;
bool bBindAny = false;
int defaultPort = GetArg("-rpcport", BaseParams().RPCPort());
if (!mapArgs.count("-rpcallowip")) // Default to loopback if not allowing external IPs
{
vEndpoints.push_back(ip::tcp::endpoint(asio::ip::address_v6::loopback(), defaultPort));
vEndpoints.push_back(ip::tcp::endpoint(asio::ip::address_v4::loopback(), defaultPort));
if (mapArgs.count("-rpcbind")) {
LogPrintf("WARNING: option -rpcbind was ignored because -rpcallowip was not specified, refusing to allow everyone to connect\n");
}
} else if (mapArgs.count("-rpcbind")) // Specific bind address
{
BOOST_FOREACH (const std::string& addr, mapMultiArgs["-rpcbind"]) {
try {
vEndpoints.push_back(ParseEndpoint(addr, defaultPort));
} catch (const boost::system::system_error&) {
uiInterface.ThreadSafeMessageBox(
strprintf(_("Could not parse -rpcbind value %s as network address"), addr),
"", CClientUIInterface::MSG_ERROR);
StartShutdown();
return;
}
}
} else { // No specific bind address specified, bind to any
vEndpoints.push_back(ip::tcp::endpoint(asio::ip::address_v6::any(), defaultPort));
vEndpoints.push_back(ip::tcp::endpoint(asio::ip::address_v4::any(), defaultPort));
// Prefer making the socket dual IPv6/IPv4 instead of binding
// to both addresses seperately.
bBindAny = true;
}
bool fListening = false;
std::string strerr;
std::string straddress;
BOOST_FOREACH (const ip::tcp::endpoint& endpoint, vEndpoints) {
try {
asio::ip::address bindAddress = endpoint.address();
straddress = bindAddress.to_string();
LogPrintf("Binding RPC on address %s port %i (IPv4+IPv6 bind any: %i)\n", straddress, endpoint.port(), bBindAny);
boost::system::error_code v6_only_error;
boost::shared_ptr<ip::tcp::acceptor> acceptor(new ip::tcp::acceptor(*rpc_io_service));
acceptor->open(endpoint.protocol());
acceptor->set_option(boost::asio::ip::tcp::acceptor::reuse_address(true));
// Try making the socket dual IPv6/IPv4 when listening on the IPv6 "any" address
acceptor->set_option(boost::asio::ip::v6_only(
!bBindAny || bindAddress != asio::ip::address_v6::any()),
v6_only_error);
acceptor->bind(endpoint);
acceptor->listen(socket_base::max_connections);
RPCListen(acceptor, *rpc_ssl_context, fUseSSL);
rpc_acceptors.push_back(acceptor);
fListening = true;
rpc_acceptors.push_back(acceptor);
// If dual IPv6/IPv4 bind successful, skip binding to IPv4 separately
if (bBindAny && bindAddress == asio::ip::address_v6::any() && !v6_only_error)
break;
} catch (boost::system::system_error& e) {
LogPrintf("ERROR: Binding RPC on address %s port %i failed: %s\n", straddress, endpoint.port(), e.what());
strerr = strprintf(_("An error occurred while setting up the RPC address %s port %u for listening: %s"), straddress, endpoint.port(), e.what());
}
}
if (!fListening) {
uiInterface.ThreadSafeMessageBox(strerr, "", CClientUIInterface::MSG_ERROR);
StartShutdown();
return;
}
rpc_worker_group = new boost::thread_group();
for (int i = 0; i < GetArg("-rpcthreads", 4); i++)
rpc_worker_group->create_thread(boost::bind(&asio::io_service::run, rpc_io_service));
fRPCRunning = true;
}
void StartDummyRPCThread()
{
if (rpc_io_service == NULL) {
rpc_io_service = new asio::io_service();
/* Create dummy "work" to keep the thread from exiting when no timeouts active,
* see http://www.boost.org/doc/libs/1_51_0/doc/html/boost_asio/reference/io_service.html#boost_asio.reference.io_service.stopping_the_io_service_from_running_out_of_work */
rpc_dummy_work = new asio::io_service::work(*rpc_io_service);
rpc_worker_group = new boost::thread_group();
rpc_worker_group->create_thread(boost::bind(&asio::io_service::run, rpc_io_service));
fRPCRunning = true;
}
}
void StopRPCThreads()
{
if (rpc_io_service == NULL) return;
// Set this to false first, so that longpolling loops will exit when woken up
fRPCRunning = false;
// First, cancel all timers and acceptors
// This is not done automatically by ->stop(), and in some cases the destructor of
// asio::io_service can hang if this is skipped.
boost::system::error_code ec;
BOOST_FOREACH (const boost::shared_ptr<ip::tcp::acceptor>& acceptor, rpc_acceptors) {
acceptor->cancel(ec);
if (ec)
LogPrintf("%s: Warning: %s when cancelling acceptor", __func__, ec.message());
}
rpc_acceptors.clear();
BOOST_FOREACH (const PAIRTYPE(std::string, boost::shared_ptr<deadline_timer>) & timer, deadlineTimers) {
timer.second->cancel(ec);
if (ec)
LogPrintf("%s: Warning: %s when cancelling timer", __func__, ec.message());
}
deadlineTimers.clear();
rpc_io_service->stop();
cvBlockChange.notify_all();
if (rpc_worker_group != NULL)
rpc_worker_group->join_all();
delete rpc_dummy_work;
rpc_dummy_work = NULL;
delete rpc_worker_group;
rpc_worker_group = NULL;
delete rpc_ssl_context;
rpc_ssl_context = NULL;
delete rpc_io_service;
rpc_io_service = NULL;
}
bool IsRPCRunning()
{
return fRPCRunning;
}
void SetRPCWarmupStatus(const std::string& newStatus)
{
LOCK(cs_rpcWarmup);
rpcWarmupStatus = newStatus;
}
void SetRPCWarmupFinished()
{
LOCK(cs_rpcWarmup);
assert(fRPCInWarmup);
fRPCInWarmup = false;
}
bool RPCIsInWarmup(std::string* outStatus)
{
LOCK(cs_rpcWarmup);
if (outStatus)
*outStatus = rpcWarmupStatus;
return fRPCInWarmup;
}
void RPCRunHandler(const boost::system::error_code& err, boost::function<void(void)> func)
{
if (!err)
func();
}
void RPCRunLater(const std::string& name, boost::function<void(void)> func, int64_t nSeconds)
{
assert(rpc_io_service != NULL);
if (deadlineTimers.count(name) == 0) {
deadlineTimers.insert(make_pair(name,
boost::shared_ptr<deadline_timer>(new deadline_timer(*rpc_io_service))));
}
deadlineTimers[name]->expires_from_now(posix_time::seconds(nSeconds));
deadlineTimers[name]->async_wait(boost::bind(RPCRunHandler, _1, func));
}
class JSONRequest
{
public:
Value id;
string strMethod;
Array params;
JSONRequest() { id = Value::null; }
void parse(const Value& valRequest);
};
void JSONRequest::parse(const Value& valRequest)
{
// Parse request
if (valRequest.type() != obj_type)
throw JSONRPCError(RPC_INVALID_REQUEST, "Invalid Request object");
const Object& request = valRequest.get_obj();
// Parse id now so errors from here on will have the id
id = find_value(request, "id");
// Parse method
Value valMethod = find_value(request, "method");
if (valMethod.type() == null_type)
throw JSONRPCError(RPC_INVALID_REQUEST, "Missing method");
if (valMethod.type() != str_type)
throw JSONRPCError(RPC_INVALID_REQUEST, "Method must be a string");
strMethod = valMethod.get_str();
if (strMethod != "getblocktemplate")
LogPrint("rpc", "ThreadRPCServer method=%s\n", SanitizeString(strMethod));
// Parse params
Value valParams = find_value(request, "params");
if (valParams.type() == array_type)
params = valParams.get_array();
else if (valParams.type() == null_type)
params = Array();
else
throw JSONRPCError(RPC_INVALID_REQUEST, "Params must be an array");
}
static Object JSONRPCExecOne(const Value& req)
{
Object rpc_result;
JSONRequest jreq;
try {
jreq.parse(req);
Value result = tableRPC.execute(jreq.strMethod, jreq.params);
rpc_result = JSONRPCReplyObj(result, Value::null, jreq.id);
} catch (Object& objError) {
rpc_result = JSONRPCReplyObj(Value::null, objError, jreq.id);
} catch (std::exception& e) {
rpc_result = JSONRPCReplyObj(Value::null,
JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq.id);
}
return rpc_result;
}
static string JSONRPCExecBatch(const Array& vReq)
{
Array ret;
for (unsigned int reqIdx = 0; reqIdx < vReq.size(); reqIdx++)
ret.push_back(JSONRPCExecOne(vReq[reqIdx]));
return write_string(Value(ret), false) + "\n";
}
static bool HTTPReq_JSONRPC(AcceptedConnection* conn,
string& strRequest,
map<string, string>& mapHeaders,
bool fRun)
{
// Check authorization
if (mapHeaders.count("authorization") == 0) {
conn->stream() << HTTPError(HTTP_UNAUTHORIZED, false) << std::flush;
return false;
}
if (!HTTPAuthorized(mapHeaders)) {
LogPrintf("ThreadRPCServer incorrect password attempt from %s\n", conn->peer_address_to_string());
/* Deter brute-forcing
If this results in a DoS the user really
shouldn't have their RPC port exposed. */
MilliSleep(250);
conn->stream() << HTTPError(HTTP_UNAUTHORIZED, false) << std::flush;
return false;
}
JSONRequest jreq;
try {
// Parse request
Value valRequest;
if (!read_string(strRequest, valRequest))
throw JSONRPCError(RPC_PARSE_ERROR, "Parse error");
// Return immediately if in warmup
{
LOCK(cs_rpcWarmup);
if (fRPCInWarmup)
throw JSONRPCError(RPC_IN_WARMUP, rpcWarmupStatus);
}
string strReply;
// singleton request
if (valRequest.type() == obj_type) {
jreq.parse(valRequest);
Value result = tableRPC.execute(jreq.strMethod, jreq.params);
// Send reply
strReply = JSONRPCReply(result, Value::null, jreq.id);
// array of requests
} else if (valRequest.type() == array_type)
strReply = JSONRPCExecBatch(valRequest.get_array());
else
throw JSONRPCError(RPC_PARSE_ERROR, "Top-level object parse error");
conn->stream() << HTTPReplyHeader(HTTP_OK, fRun, strReply.size()) << strReply << std::flush;
} catch (Object& objError) {
ErrorReply(conn->stream(), objError, jreq.id);
return false;
} catch (std::exception& e) {
ErrorReply(conn->stream(), JSONRPCError(RPC_PARSE_ERROR, e.what()), jreq.id);
return false;
}
return true;
}
void ServiceConnection(AcceptedConnection* conn)
{
bool fRun = true;
while (fRun && !ShutdownRequested()) {
int nProto = 0;
map<string, string> mapHeaders;
string strRequest, strMethod, strURI;
// Read HTTP request line
if (!ReadHTTPRequestLine(conn->stream(), nProto, strMethod, strURI))
break;
// Read HTTP message headers and body
ReadHTTPMessage(conn->stream(), mapHeaders, strRequest, nProto, MAX_SIZE);
// HTTP Keep-Alive is false; close connection immediately
if ((mapHeaders["connection"] == "close") || (!GetBoolArg("-rpckeepalive", true)))
fRun = false;
// Process via JSON-RPC API
if (strURI == "/") {
if (!HTTPReq_JSONRPC(conn, strRequest, mapHeaders, fRun))
break;
// Process via HTTP REST API
} else if (strURI.substr(0, 6) == "/rest/" && GetBoolArg("-rest", false)) {
if (!HTTPReq_REST(conn, strURI, mapHeaders, fRun))
break;
} else {
conn->stream() << HTTPError(HTTP_NOT_FOUND, false) << std::flush;
break;
}
}
}
json_spirit::Value CRPCTable::execute(const std::string& strMethod, const json_spirit::Array& params) const
{
// Find method
const CRPCCommand* pcmd = tableRPC[strMethod];
if (!pcmd)
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found");
#ifdef ENABLE_WALLET
if (pcmd->reqWallet && !pwalletMain)
throw JSONRPCError(RPC_METHOD_NOT_FOUND, "Method not found (disabled)");
#endif
// Observe safe mode
string strWarning = GetWarnings("rpc");
if (strWarning != "" && !GetBoolArg("-disablesafemode", false) &&
!pcmd->okSafeMode)
throw JSONRPCError(RPC_FORBIDDEN_BY_SAFE_MODE, string("Safe mode: ") + strWarning);
try {
// Execute
Value result;
{
if (pcmd->threadSafe)
result = pcmd->actor(params, false);
#ifdef ENABLE_WALLET
else if (!pwalletMain) {
LOCK(cs_main);
result = pcmd->actor(params, false);
} else {
while (true) {
TRY_LOCK(cs_main, lockMain);
if (!lockMain) {
MilliSleep(50);
continue;
}
while (true) {
TRY_LOCK(pwalletMain->cs_wallet, lockWallet);
if (!lockMain) {
MilliSleep(50);
continue;
}
result = pcmd->actor(params, false);
break;
}
break;
}
}
#else // ENABLE_WALLET
else {
LOCK(cs_main);
result = pcmd->actor(params, false);
}
#endif // !ENABLE_WALLET
}
return result;
} catch (std::exception& e) {
throw JSONRPCError(RPC_MISC_ERROR, e.what());
}
}
std::vector<std::string> CRPCTable::listCommands() const
{
std::vector<std::string> commandList;
typedef std::map<std::string, const CRPCCommand*> commandMap;
std::transform( mapCommands.begin(), mapCommands.end(),
std::back_inserter(commandList),
boost::bind(&commandMap::value_type::first,_1) );
return commandList;
}
std::string HelpExampleCli(string methodname, string args)
{
return "> alp-cli " + methodname + " " + args + "\n";
}
std::string HelpExampleRpc(string methodname, string args)
{
return "> curl --user myusername --data-binary '{\"jsonrpc\": \"1.0\", \"id\":\"curltest\", "
"\"method\": \"" +
methodname + "\", \"params\": [" + args + "] }' -H 'content-type: text/plain;' http://127.0.0.1:52334/\n";
}
const CRPCTable tableRPC;
| [
"[email protected]"
] | |
03fe5e69e82bc39e4ce5405aea427cb0551e2a55 | fc38a55144a0ad33bd94301e2d06abd65bd2da3c | /thirdparty/cgal/CGAL-4.13/include/CGAL/Nef_S2/SM_visualizor.h | 51ee7fe9917a6c6482595bbb3da535023b595310 | [
"LGPL-2.0-or-later",
"LGPL-3.0-or-later",
"GPL-1.0-or-later",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-commercial-license",
"MIT",
"LicenseRef-scancode-free-unknown",
"LGPL-3.0-only",
"GPL-3.0-only",
"LGPL-2.1-or-later",
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"MIT-0"
] | permissive | bobpepin/dust3d | 20fc2fa4380865bc6376724f0843100accd4b08d | 6dcc6b1675cb49ef3fac4a58845f9c9025aa4c9f | refs/heads/master | 2022-11-30T06:00:10.020207 | 2020-08-09T09:54:29 | 2020-08-09T09:54:29 | 286,051,200 | 0 | 0 | MIT | 2020-08-08T13:45:15 | 2020-08-08T13:45:14 | null | UTF-8 | C++ | false | false | 7,293 | h | // Copyright (c) 1997-2002 Max-Planck-Institute Saarbruecken (Germany).
// All rights reserved.
//
// This file is part of CGAL (www.cgal.org).
// 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 3 of the License, or (at your option) any later version.
//
// Licensees holding a valid commercial license may use this file in
// accordance with the commercial license agreement provided with the software.
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
//
// $URL$
// $Id$
// SPDX-License-Identifier: GPL-3.0+
//
//
// Author(s) : Michael Seel <[email protected]>
#ifndef CGAL_NEF_SM_VISUALIZOR_H
#define CGAL_NEF_SM_VISUALIZOR_H
#include <CGAL/license/Nef_S2.h>
#include <CGAL/basic.h>
#include <CGAL/Nef_S2/SM_decorator.h>
#include <CGAL/Nef_S2/SM_triangulator.h>
#include <CGAL/Nef_S2/Sphere_geometry_OGL.h>
#define CGAL_NEF_LGREY CGAL::Color(170,170,200)
#define CGAL_NEF_DGREY CGAL::Color(30,30,50)
namespace CGAL {
template <typename Map_>
class SM_BooleColor
{
typedef typename Map_::SVertex_const_handle SVertex_const_handle;
typedef typename Map_::SHalfedge_const_handle SHalfedge_const_handle;
typedef typename Map_::SHalfloop_const_handle SHalfloop_const_handle;
typedef typename Map_::SFace_const_handle SFace_const_handle;
typedef typename Map_::Mark Mark;
public:
Color color(SVertex_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
Color color(SHalfedge_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
Color color(SHalfloop_const_handle, Mark m) const
{ return ( m ? CGAL::BLACK : CGAL::WHITE ); }
Color color(SFace_const_handle, Mark m) const
{ return ( m ? CGAL_NEF_DGREY : CGAL_NEF_LGREY ); }
};
/*{\Moptions outfile=SM_visualizor.man }*/
/*{\Manpage {SM_visualizor}{Map_,Sphere_kernel_}
{Drawing plane maps}{V}}*/
template <typename SM_explorer>
class SM_visualizor : public SM_triangulator< SM_decorator<typename SM_explorer::Sphere_map> >
{
/*{\Mdefinition An instance |\Mvar| of the data type |\Mname| is a
decorator to draw the structure of a sphere map into the surface
of a OpenGL sphere. It is generic with respect to the template
concept.}*/
/*{\Mgeneralization SM_decorator}*/
/*{\Mtypes 3}*/
public:
typedef typename SM_explorer::Sphere_map Sphere_map;
typedef CGAL::SM_BooleColor<Sphere_map> Color_;
typedef typename Sphere_map::Sphere_kernel Sphere_kernel;
typedef SM_visualizor<SM_explorer> Self;
typedef SM_decorator<Sphere_map> Decorator;
typedef SM_triangulator<Decorator> Base;
typedef typename Sphere_map::SVertex_const_handle SVertex_const_handle;
typedef typename Sphere_map::SHalfedge_const_handle SHalfedge_const_handle;
typedef typename Sphere_map::SFace_const_handle SFace_const_handle;
typedef typename Sphere_map::SVertex_const_iterator SVertex_const_iterator;
typedef typename Sphere_map::SHalfedge_const_iterator SHalfedge_const_iterator;
typedef typename Sphere_map::SFace_const_iterator SFace_const_iterator;
typedef typename Sphere_map::Mark Mark;
typedef typename Sphere_kernel::Sphere_point Sphere_point;
typedef typename Sphere_kernel::Sphere_segment Sphere_segment;
typedef typename Sphere_kernel::Sphere_circle Sphere_circle;
typedef typename Sphere_kernel::Sphere_triangle Sphere_triangle;
typedef Color_ Color_objects;
protected:
const SM_explorer* E_;
const Color_objects& CO_;
Sphere_map MT_;
CGAL::OGL::Unit_sphere& S_;
public:
/*{\Mcreation 4}*/
SM_visualizor(const SM_explorer* M, CGAL::OGL::Unit_sphere& S,
const Color_objects& C = Color_objects())
/*{\Mcreate creates an instance |\Mvar| of type |\Mname| to visualize
the vertices, edges, and faces of |D| in an open GL window.}*/
: Base(&MT_,M), E_(M), CO_(C), MT_(true), S_(S)
{ triangulate(); }
/*{\Moperations 2 1}*/
/* |draw_map| draws all object of the referenced sphere map:
1) edges, loops, and vertices are taken from E_
2) faces are drawn via the calculated triangulation in MT_ */
void draw_map() const
/*{\Mop draw the whole plane map.}*/
{
// draw sphere segments underlying edges of E_:
SHalfedge_const_iterator e;
CGAL_forall_sedges(e,*E_) {
if ( source(e) == target(e) ) {
S_.push_back(E_->circle(e), CO_.color(e,E_->mark(e)));
} else {
S_.push_back(Sphere_segment(E_->point(E_->source(e)),
E_->point(E_->target(e)),
E_->circle(e)),CO_.color(e,E_->mark(e)));
}
}
// draw sphere circles underlying loops of E_:
if ( E_->has_shalfloop() )
S_.push_back(
Sphere_circle(E_->circle(E_->shalfloop())),
CO_.color(E_->shalfloop(),E_->mark(E_->shalfloop())));
// draw points underlying vertices of E_:
SVertex_const_iterator v;
CGAL_forall_svertices(v,*E_)
S_.push_back(E_->point(v),CO_.color(v,E_->mark(v)));
Unique_hash_map<SHalfedge_const_iterator,bool> Done(false);
CGAL_forall_shalfedges(e,*this) {
if ( Done[e] ) continue;
SHalfedge_const_handle en(next(e)),enn(next(en));
CGAL_NEF_TRACEV(Base::incident_triangle(e));
CGAL_NEF_TRACEN(incident_mark(e)<<incident_mark(en)<<incident_mark(enn));
CGAL_assertion(Base::incident_mark(e)==Base::incident_mark(en) &&
Base::incident_mark(en)==Base::incident_mark(enn));
Mark m = Base::incident_mark(e);
Sphere_triangle t = Base::incident_triangle(e);
S_.push_back(t, (m ? CGAL_NEF_DGREY : CGAL_NEF_LGREY) );
Done[e]=Done[en]=Done[enn]=true;
}
Done.clear(false);
CGAL_forall_shalfedges(e,*this) {
if ( Done[e] ) continue;
S_.push_back_triangle_edge(Sphere_segment(E_->point(E_->source(e)),
E_->point(E_->target(e)),
E_->circle(e)));
Done[e]=Done[twin(e)]=true;
}
}
/* |draw_triangulation| draws all object of the underlying triangulation:
1) edges, loops, and vertices are taken from E_
2) faces are drawn via the calculated triangulation in MT_ */
void draw_triangulation() const
{
// draw sphere segments underlying edges of triangulation:
SHalfedge_const_iterator e;
CGAL_forall_sedges(e,*this) {
S_.push_back(Sphere_segment(point(source(e)),point(target(e)),
circle(e)),CO_.color(e,mark(e)));
}
// draw points underlying vertices of triangulation:
SVertex_const_iterator v;
CGAL_forall_svertices(v,*this)
S_.push_back(point(v),CO_.color(v,mark(v)));
Unique_hash_map<SHalfedge_const_iterator,bool> Done(false);
CGAL_forall_shalfedges(e,*this) {
if ( Done[e] ) continue;
SHalfedge_const_handle en(next(e)),enn(next(en));
CGAL_assertion(incident_mark(e)==incident_mark(en)&&
incident_mark(en)==incident_mark(enn));
Mark m = incident_mark(e);
Sphere_triangle t = incident_triangle(e);
S_.push_back(t, (m ? CGAL_NEF_DGREY : CGAL_NEF_LGREY) );
Done[e]=Done[en]=Done[enn]=true;
}
}
}; // end of SM_visualizor
} //namespace CGAL
#undef CGAL_USING
//#undef CGAL_NEF_LGREY
//#undef CGAL_NEF_DGREY
#endif // CGAL_NEF_SM_VISUALIZOR_H
| [
"[email protected]"
] | |
d4b9f0914e57a9b349b2595741c60e118f51acbb | acf7796906e59d64f285a88574406e1b9d4cd453 | /218-B/218-B-51210406.cpp | 8eb571afe77c9f6dcf4af931654f3f2769886f74 | [] | no_license | samnoon1971/Codeforces | 13fd99aa13a1d57792c7a0b9042c9f1fc3a14deb | a31444c717944d2c81f75af7a3e6650fb41ccf1d | refs/heads/main | 2023-03-07T18:46:31.705957 | 2021-02-18T19:52:34 | 2021-02-18T19:52:34 | 340,160,077 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 623 | cpp | #include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
priority_queue <int> a, b;
for(int i=0; i<m; i++)
{
int x;
cin >> x;
a.push(x);
b.push(-x);
}
int x=0, y=0, sumx=0, sumy=0;
while(x<n)
{
int s=a.top();
a.pop();
sumx+=s;
if(s-1!=0)
a.push(s-1);
x++;
}
while(y<n)
{
int s=-b.top();
b.pop();
sumy+=s;
if(s-1!=0)
b.push(1-s);
y++;
}
cout << sumx << " " << sumy << endl;
return 0;
} | [
"[email protected]"
] | |
0c78c95f0bed4d0bb044d685c6266a1a33a6b350 | a92b18defb50c5d1118a11bc364f17b148312028 | /src/prod/ktl/src/tools/tests/khttp/KHttpTestCases.cpp | 64d5dde8e10a60f8f456a4bf04aacdf93dd76f53 | [
"MIT"
] | permissive | KDSBest/service-fabric | 34694e150fde662286e25f048fb763c97606382e | fe61c45b15a30fb089ad891c68c893b3a976e404 | refs/heads/master | 2023-01-28T23:19:25.040275 | 2020-11-30T11:11:58 | 2020-11-30T11:11:58 | 301,365,601 | 1 | 0 | MIT | 2020-11-30T11:11:59 | 2020-10-05T10:05:53 | null | UTF-8 | C++ | false | false | 723 | cpp | /*++
Copyright (c) Microsoft Corporation
Module Name:
KHttpTestCases.cpp
Abstract:
This file contains the test case table.
To add a new unit test case:
1. Declare your test case routine in KHttpTests.h.
2. Add an entry to the gs_KuTestCases table in KHttpTestCases.cpp.
3. Implement your test case routine. The implementation can be in
this file or any other file.
--*/
#pragma once
#include <ktl.h>
#include "KHttpTests.h"
//
// A table containing information of all test cases.
//
const KU_TEST_ENTRY gs_KuTestCases[] =
{
{ L"KHttpTest", KHttpTest, L"BVT", L"Template for first test"}
};
const ULONG gs_KuTestCasesSize = ARRAYSIZE(gs_KuTestCases);
| [
"[email protected]"
] | |
efdab5129ee88cc0163bb394f122f26e71411cb5 | 6b76db12b8d45fdded76d07aacaa6c00656bb251 | /Dependencies/HIRO/include/COGS/Octree.h | 2f06b7adbbe546ba2e74d2b6c57265d7c5dabe25 | [] | no_license | xpetrov/DP | ab0158c063c65d6cc912aaa35d3f78b86e282476 | 7147a9b745629bdec77b9dd989be759f5c413372 | refs/heads/master | 2022-12-16T08:31:25.046980 | 2020-09-10T19:51:22 | 2020-09-10T19:51:22 | 294,459,415 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,747 | h | /*
Copyright (C) Skeletex Research, s.r.o. - All Rights Reserved
Unauthorized copying of this file, via any medium is strictly prohibited
Proprietary and confidential
*/
#pragma once
#include <COGS/PointCloud.h>
namespace cogs
{
//! Used internally to store the nodes of the octree.
struct OctreeNode;
//! Space-partitioning data structure for point clouds.
class COGS_API Octree
{
public:
//! When an octree node contains this number of points or less, it does not subdivide further.
static const uint8_t POINTS_THRESHOLD = 64;
//! Octree destructor.
~Octree();
//! Default constructor.
Octree() = default;
/*!
\brief
Constructs Octree over the given cloud.
\param cloud
Octree will be constructed over points of this cloud.
*/
Octree(const cogs::PointCloud &cloud);
/*!
\brief
Constructs Octree over the given vector of points.
\param positions
Octree will be constructed over these points.
*/
Octree(const std::vector<glm::vec3> &positions);
/*!
\brief
Adds points of the input cloud into the Octree.
\param positions
Points of this cloud will be included in the octree.
*/
void Include(const cogs::PointCloud &cloud);
/*!
\brief
Adds points of input clouds into the Octree.
\param positions
Points from all the clouds in this vector will be included in the octree.
*/
void Include(const std::vector<const cogs::PointCloud *> &clouds);
/*!
\brief
Get the string representation of this octree.
\return
String representation of this octree.
*/
std::string ToString() const;
/*!
\brief
Whether any of the points exist in the range from the given location.
\param location
Location in the world around which will be searched.
\param radius
Radius range of the search area.
\return
True if any point is in range, false otherwise.
*/
bool HasPointIn(const glm::vec3 &location, float_t radius) const;
/*!
\brief
Whether any of the points exist inside the input AABB.
\param search_range
Area of this axis aligned box will be searched for points.
\return
True if any point is included in the input AABB, false otherwise.
*/
bool HasPointIn(const geom::Aabb3 &search_range) const;
/*!
\brief
Get indices of points in the radius from the given location.
\param location
Location in the world around which will be searched.
\param radius
Radius range of the search area.
\return
Vector of point indices in the area.
*/
std::vector<uint32_t> Find(const glm::vec3 &location, float_t radius) const;
/*!
\brief
Get indices of points that are inside the input AABB.
\param search_range
Area of this axis aligned box will be searched for points.
\param output
Used as an output parameter to fill with points.
*/
std::vector<uint32_t> Find(const geom::Aabb3 &search_range) const;
private:
//! Reference to the root of this octree.
OctreeNode *root_ = nullptr;
//! Initializes the root and constructs the tree.
void InitializeRoot(const std::vector<glm::vec3> &positions);
//! Find the maximum coordinate of the given positions.
float_t MaximumExtent(const std::vector<glm::vec3> &positions) const;
//! Find the minimum coordinate of the given positions.
float_t MinimumExtent(const std::vector<glm::vec3> &positions) const;
};
} | [
"[email protected]"
] | |
5183254b04c344e17825c4cff9e89197107b2688 | e104892af303d85c5e661d099b500dc1e35b882d | /Sample12_14/app/src/main/cpp/bndev/FlatData.h | cdf8d96c61a74b5c79e91139fe1415f2f69394cb | [
"Unlicense"
] | permissive | siwangqishiq/Vulkan_Develpment_Samples | 624900dabaca75c9ad21ef5a1ee5af6709dcc9a8 | 409c973e0b37086c854cde07b1e620c3d8d9f15d | refs/heads/master | 2023-08-16T04:13:54.777841 | 2021-10-14T06:53:11 | 2021-10-14T06:53:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 230 | h | #ifndef SAMPLE11_6_FLATDATA_H
#define SAMPLE11_6_FLATDATA_H
class FlatData {
public:
static float* vdata;
static int dataByteCount;
static int vCount;
static void genVertexData();
};
#endif //SAMPLE11_6_FLATDATA_H
| [
"[email protected]"
] | |
81f0cf1a0dbfc2e339a0add8802098775143cc65 | b60001258ce2caf01eb3d783a4ce4997fe4cc89b | /FSMProject/Troll.cpp | f84221f8ac3f390e4478a4860aee627dbcc390bf | [] | no_license | tsxy2007/FSMProject | 2e4afb473a9aac93c8ec9c10b94c1d4e2f883199 | 34dd199c9116bfcfb523ed99c7dd6762c8a0e517 | refs/heads/master | 2020-06-26T00:10:29.844884 | 2017-12-04T02:42:56 | 2017-12-04T02:42:56 | 96,997,544 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,407 | cpp | //
// Troll.cpp
// FSMProject
//
// Created by fengkai on 2017/7/6.
// Copyright © 2017年 fengkai. All rights reserved.
//
#include "PCH.h"
Troll::Troll(int id):BaseGameEntity(id),power(100)
{
m_pStateMachine = new StateMachine<Troll>(this);
m_pStateMachine->SetCurrentState(State_RunAway::instance());
SharedNotificaitonCenter()->addObserver(this, CC_CALLFUNCO_SELECTOR(Troll::ChangeState), "powerplus", nullptr);
// SharedNotificaitonCenter()->removeAllObserver(this);
m_invoker = new Invoker<BaseGameEntity>();
m_invoker->setCommand(new ConcerteCommand( this ) );
}
Troll::~Troll()
{
BaseGameEntity::~BaseGameEntity();
}
void Troll::Update()
{
if (m_pStateMachine)
{
m_pStateMachine->Update();
}
}
void Troll::ChangeState(State<Troll> *pNewState)
{
if (this->m_pStateMachine)
{
this->m_pStateMachine->ChangeState(pNewState);
}
}
void Troll::plusPower()
{
power++;
cout<<"State_Sleep Excute ........"<<power<<endl;
}
void Troll::subPower()
{
power--;
cout<<"State_RunAway Excute ........"<<power<<endl;
}
bool Troll::isLei()
{
return power <= 30;
}
bool Troll::isPower()
{
return power >= 90;
}
void Troll::ChangeState(BaseGameEntity *object)
{
m_invoker->ExecuteCommand();
}
void Troll::Run( )
{
BaseGameEntity::Run();
this->ChangeState(State_RunAway::instance());
}
| [
"[email protected]"
] | |
9083e6b7f9c40abfaec7c9f41e4c3f40e98deb21 | f23d1bf6d80fc85e60dede29a5e00b50e51b27db | /examples/Advanced/Display/JpegDraw/JpegDraw.ino | 200e66a6f2cf3698521b2b04e67dfc762237bb4a | [
"MIT"
] | permissive | rdfwxff3/M5Stack | 108f650ea0c382ef8e7970e02b3547bd12ae7acb | 5b51f9549181ed3241c9abd90eaae7d6e868e99a | refs/heads/master | 2021-07-12T11:24:21.385597 | 2017-10-16T09:00:22 | 2017-10-16T09:00:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 179 | ino | #include <M5Stack.h>
void setup(void) {
M5.begin();
//Draw the jpeg file form TF card
M5.Lcd.setBrightness(200);
M5.Lcd.drawJpgFile(SD, "/p2.jpg");
}
void loop() {
}
| [
"[email protected]"
] | |
49360a1aa3ab6e6d4187e097b85683c3f1154691 | 8f62f3e4e57ea9700f1113533c8ed87e867d9d9e | /src/color.hpp | 1c2e922c683766e2cba2a550de1df09d554730c0 | [
"Apache-2.0"
] | permissive | sweetkristas/hexes | 9f247d86cdd232d1be77a0dc0d70e6726ff7ceef | 0e290b5cadbe2944e9144268f863c225abb0920a | refs/heads/master | 2021-01-01T05:40:30.137193 | 2014-08-19T20:14:16 | 2014-08-19T20:14:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,830 | hpp | #pragma once
#include "graphics.hpp"
namespace graphics
{
class color
{
public:
color(int r, int g, int b, int a = 255)
{
c_.rgba[0] = truncate_to_char(r);
c_.rgba[1] = truncate_to_char(g);
c_.rgba[2] = truncate_to_char(b);
c_.rgba[3] = truncate_to_char(a);
set_float_values();
}
explicit color(uint32_t rgba = 0)
{
c_.value = rgba;
set_float_values();
}
explicit color(const SDL_Color& col)
{
c_.rgba[0] = col.r;
c_.rgba[1] = col.g;
c_.rgba[2] = col.b;
c_.rgba[3] = 255;
set_float_values();
}
explicit color(float r, float g, float b, float a = 1.0f)
{
rgbaf_[0] = clampf(r);
rgbaf_[1] = clampf(g);
rgbaf_[2] = clampf(b);
rgbaf_[3] = clampf(a);
c_.rgba[0] = int(rgbaf_[0] * 255.0f);
c_.rgba[1] = int(rgbaf_[1] * 255.0f);
c_.rgba[2] = int(rgbaf_[2] * 255.0f);
c_.rgba[3] = int(rgbaf_[3] * 255.0f);
}
uint8_t r() const { return c_.rgba[0]; }
uint8_t g() const { return c_.rgba[1]; }
uint8_t b() const { return c_.rgba[2]; }
uint8_t a() const { return c_.rgba[3]; }
SDL_Color as_sdl_color() const
{
SDL_Color c = {c_.rgba[0], c_.rgba[1], c_.rgba[2], 255};
return c;
}
const float* as_gl_color() const
{
return rgbaf_;
}
float* as_gl_color()
{
return rgbaf_;
}
uint8_t truncate_to_char(int value)
{
if(value < 0) return 0;
if(value > 255) return 255;
return value;
}
private:
void set_float_values()
{
rgbaf_[0] = c_.rgba[0] / 255.0f;
rgbaf_[1] = c_.rgba[1] / 255.0f;
rgbaf_[2] = c_.rgba[2] / 255.0f;
rgbaf_[3] = c_.rgba[3] / 255.0f;
}
float clampf(float value)
{
if(value < 0.0f) return 0.0f;
if(value > 1.0f) return 1.0f;
return value;
}
union PixelUnion
{
uint32_t value;
uint8_t rgba[4];
};
float rgbaf_[4];
PixelUnion c_;
};
}
| [
"[email protected]"
] | |
4011346663d7176c7b5d276b025bec23105403ba | b33a9177edaaf6bf185ef20bf87d36eada719d4f | /qtbase/src/corelib/json/qjsonvalue.h | a8b5d2796d70ee572d3dacf643a750fd3b5acd46 | [
"LicenseRef-scancode-proprietary-license",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-commercial-license",
"LGPL-2.0-or-later",
"LGPL-2.1-only",
"GFDL-1.3-only",
"LicenseRef-scancode-qt-commercial-1.1",
"LGPL-3.0-only",
"LicenseRef-scancode-qt-company-exception-lgpl-2.1",
"GPL-1.0-or-later",
"GPL-3.0-only",
"BSD-3-Clause",
"LGPL-2.1-or-later",
"GPL-2.0-only",
"Qt-LGPL-exception-1.1",
"LicenseRef-scancode-digia-qt-preview",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-other-copyleft",
"LicenseRef-scancode-generic-exception"
] | permissive | wgnet/wds_qt | ab8c093b8c6eead9adf4057d843e00f04915d987 | 8db722fd367d2d0744decf99ac7bafaba8b8a3d3 | refs/heads/master | 2021-04-02T11:07:10.181067 | 2020-06-02T10:29:03 | 2020-06-02T10:34:19 | 248,267,925 | 1 | 0 | Apache-2.0 | 2020-04-30T12:16:53 | 2020-03-18T15:20:38 | null | UTF-8 | C++ | false | false | 7,357 | h | /****************************************************************************
**
** Copyright (C) 2015 The Qt Company Ltd.
** Contact: http://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL21$
** 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 http://www.qt.io/terms-conditions. For further
** information use the contact form at http://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 2.1 or version 3 as published by the Free
** Software Foundation and appearing in the file LICENSE.LGPLv21 and
** LICENSE.LGPLv3 included in the packaging of this file. Please review the
** following information to ensure the GNU Lesser General Public License
** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** As a special exception, The Qt Company gives you certain additional
** rights. These rights are described in The Qt Company LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QJSONVALUE_H
#define QJSONVALUE_H
#include <QtCore/qglobal.h>
#include <QtCore/qstring.h>
QT_BEGIN_NAMESPACE
class QDebug;
class QVariant;
class QJsonArray;
class QJsonObject;
namespace QJsonPrivate {
class Data;
class Base;
class Object;
class Header;
class Array;
class Value;
class Entry;
}
class Q_CORE_EXPORT QJsonValue
{
public:
enum Type {
Null = 0x0,
Bool = 0x1,
Double = 0x2,
String = 0x3,
Array = 0x4,
Object = 0x5,
Undefined = 0x80
};
QJsonValue(Type = Null);
QJsonValue(bool b);
QJsonValue(double n);
QJsonValue(int n);
QJsonValue(qint64 n);
QJsonValue(const QString &s);
QJsonValue(QLatin1String s);
#ifndef QT_NO_CAST_FROM_ASCII
inline QT_ASCII_CAST_WARN QJsonValue(const char *s)
: d(Q_NULLPTR), t(String) { stringDataFromQStringHelper(QString::fromUtf8(s)); }
#endif
QJsonValue(const QJsonArray &a);
QJsonValue(const QJsonObject &o);
~QJsonValue();
QJsonValue(const QJsonValue &other);
QJsonValue &operator =(const QJsonValue &other);
static QJsonValue fromVariant(const QVariant &variant);
QVariant toVariant() const;
Type type() const;
inline bool isNull() const { return type() == Null; }
inline bool isBool() const { return type() == Bool; }
inline bool isDouble() const { return type() == Double; }
inline bool isString() const { return type() == String; }
inline bool isArray() const { return type() == Array; }
inline bool isObject() const { return type() == Object; }
inline bool isUndefined() const { return type() == Undefined; }
bool toBool(bool defaultValue = false) const;
int toInt(int defaultValue = 0) const;
double toDouble(double defaultValue = 0) const;
QString toString(const QString &defaultValue = QString()) const;
QJsonArray toArray() const;
QJsonArray toArray(const QJsonArray &defaultValue) const;
QJsonObject toObject() const;
QJsonObject toObject(const QJsonObject &defaultValue) const;
bool operator==(const QJsonValue &other) const;
bool operator!=(const QJsonValue &other) const;
private:
// avoid implicit conversions from char * to bool
inline QJsonValue(const void *) {}
friend class QJsonPrivate::Value;
friend class QJsonArray;
friend class QJsonObject;
friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonValue &);
QJsonValue(QJsonPrivate::Data *d, QJsonPrivate::Base *b, const QJsonPrivate::Value& v);
void stringDataFromQStringHelper(const QString &string);
void detach();
union {
quint64 ui;
bool b;
double dbl;
QStringData *stringData;
QJsonPrivate::Base *base;
};
QJsonPrivate::Data *d; // needed for Objects and Arrays
Type t;
};
class Q_CORE_EXPORT QJsonValueRef
{
public:
QJsonValueRef(QJsonArray *array, int idx)
: a(array), is_object(false), index(idx) {}
QJsonValueRef(QJsonObject *object, int idx)
: o(object), is_object(true), index(idx) {}
inline operator QJsonValue() const { return toValue(); }
QJsonValueRef &operator = (const QJsonValue &val);
QJsonValueRef &operator = (const QJsonValueRef &val);
QVariant toVariant() const;
inline QJsonValue::Type type() const { return toValue().type(); }
inline bool isNull() const { return type() == QJsonValue::Null; }
inline bool isBool() const { return type() == QJsonValue::Bool; }
inline bool isDouble() const { return type() == QJsonValue::Double; }
inline bool isString() const { return type() == QJsonValue::String; }
inline bool isArray() const { return type() == QJsonValue::Array; }
inline bool isObject() const { return type() == QJsonValue::Object; }
inline bool isUndefined() const { return type() == QJsonValue::Undefined; }
inline bool toBool() const { return toValue().toBool(); }
inline int toInt() const { return toValue().toInt(); }
inline double toDouble() const { return toValue().toDouble(); }
inline QString toString() const { return toValue().toString(); }
QJsonArray toArray() const;
QJsonObject toObject() const;
// ### Qt 6: Add default values
inline bool toBool(bool defaultValue) const { return toValue().toBool(defaultValue); }
inline int toInt(int defaultValue) const { return toValue().toInt(defaultValue); }
inline double toDouble(double defaultValue) const { return toValue().toDouble(defaultValue); }
inline QString toString(const QString &defaultValue) const { return toValue().toString(defaultValue); }
inline bool operator==(const QJsonValue &other) const { return toValue() == other; }
inline bool operator!=(const QJsonValue &other) const { return toValue() != other; }
private:
QJsonValue toValue() const;
union {
QJsonArray *a;
QJsonObject *o;
};
uint is_object : 1;
uint index : 31;
};
#ifndef Q_QDOC
// ### Qt 6: Get rid of these fake pointer classes
class QJsonValuePtr
{
QJsonValue value;
public:
explicit QJsonValuePtr(const QJsonValue& val)
: value(val) {}
QJsonValue& operator*() { return value; }
QJsonValue* operator->() { return &value; }
};
class QJsonValueRefPtr
{
QJsonValueRef valueRef;
public:
QJsonValueRefPtr(QJsonArray *array, int idx)
: valueRef(array, idx) {}
QJsonValueRefPtr(QJsonObject *object, int idx)
: valueRef(object, idx) {}
QJsonValueRef& operator*() { return valueRef; }
QJsonValueRef* operator->() { return &valueRef; }
};
#endif
#if !defined(QT_NO_DEBUG_STREAM) && !defined(QT_JSON_READONLY)
Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonValue &);
#endif
QT_END_NAMESPACE
#endif // QJSONVALUE_H
| [
"[email protected]"
] | |
1faa3042bcf61772a1cc32209d5e2a4085b9fff9 | ac2c7ce45a28c8ceb10d543944db90f6025e8a58 | /src/debug_gui/types/updgroup.cpp | 3708402b9de0d440408d1a4f8cda84941671c157 | [
"MIT",
"BSD-3-Clause",
"Zlib",
"BSL-1.0"
] | permissive | degarashi/revenant | a5997ccc9090690abd03a19e749606c9cdf935d4 | 9e671320a5c8790f6bdd1b14934f81c37819f7b3 | refs/heads/master | 2021-01-11T00:15:06.876412 | 2019-09-08T13:00:26 | 2019-09-08T13:00:26 | 70,564,404 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,666 | cpp | #include "../../object/updgroup.hpp"
#include "../state_storage.hpp"
#include "../column.hpp"
#include "../id.hpp"
#include "../print.hpp"
#include "../popup.hpp"
#include "../textfilter.hpp"
#include "../sstream.hpp"
#include "../resource_window.hpp"
#include "../tree.hpp"
#include <iomanip>
namespace rev {
bool UpdGroup::property(const bool edit) {
bool mod = false;
if(const auto _ = debug::TreePush(IObject::getDebugName())) {
mod |= IObject::property(edit);
}
if(const auto _ = debug::TreePush("Interval")) {
mod |= _interval.property(edit);
}
ImGui::Separator();
{
const auto col = debug::ColumnPush(2);
const auto id_obj = ImGui::GetID("Object");
using St = debug::StateStorage<WDbg>;
auto cur = St::Get<IObject>(id_obj);
if(const auto c = debug::ChildPush("Left", {0,0})) {
debug::TextFilter filter(ImGui::GetID("Filter"));
const float h = ImGui::GetContentRegionAvail().y;
ImGui::TextUnformatted("Member");
StringStream s;
s << std::hex;
const auto makename = [&s](const auto& p) {
s << "0x" << std::setfill('0') << std::setw(8);
if(p.second->isNode())
s << " [G]";
if(p.second->isDead())
s << " [D]";
s << p.first << "\t" << p.second->getDebugName();
return s.output();
};
if(const auto c = debug::ChildPush("Member", {0, h*0.75f}, true, ImGuiWindowFlags_HorizontalScrollbar)) {
int idx = 0;
for(auto& p : _objV) {
const auto idp = debug::IdPush(idx++);
const auto str = makename(p);
if(filter.PassFilter(str.c_str())) {
if(ImGui::Selectable(str.c_str(), cur == p.second)) {
cur = p.second;
St::Set(id_obj, cur);
}
if(ImGui::IsItemClicked(1)) {
ImGui::OpenPopup("popup");
}
if(const auto pu = debug::PopupPush("popup")) {
if(ImGui::Selectable("Open in new window...")) {
debug::ResourceWindow::Add(p.second);
}
if(ImGui::Selectable("Delete")) {
remObj(p.second);
}
}
}
}
}
ImGui::TextUnformatted("Add(Reserved)");
if(const auto c = debug::ChildPush("Add", {0, 0}, true, ImGuiWindowFlags_HorizontalScrollbar)) {
int idx = 0;
for(auto& p : _addObj) {
const auto idp = debug::IdPush(idx++);
const auto str = makename(p);
if(ImGui::Selectable(str.c_str(), cur == p.second)) {
cur = p.second;
St::Set(id_obj, cur);
}
}
}
}
ImGui::NextColumn();
if(cur) {
if(const auto _ = debug::ChildPush("Right", 0, true, ImGuiWindowFlags_HorizontalScrollbar)) {
mod |= debug::Edit("", cur);
}
}
}
return mod;
}
}
| [
"[email protected]"
] | |
8a6d8362f7295a551b369deb8c1d8ba24f32cd2b | 2c58d713fef80b2daf0beedd0503a9c45aafc48a | /subject.cc | ed8c12cf10f32b1748a0bebcc0dfa9daa8536e04 | [] | no_license | nirujans/StraightsCPlusPlus | fa017a26d626bd3c82e5c9e8d2ebae81dd6d3119 | 63a2305942b222bc2af0550fd52ddbe7d24368df | refs/heads/master | 2022-11-13T22:04:34.533431 | 2020-07-12T05:02:51 | 2020-07-12T05:02:51 | 278,988,719 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,736 | cc | /*
* MVC example of GTKmm program
*
* Subject class. Abstract class for Observer Pattern
*
*
* Created by Jo Atlee on 06/07/09.
* Copyright 2009 UW. All rights reserved.
*
*/
#include <set>
#include "subject.h"
#include "observer.h"
using namespace std;
//subject and observer relationship
void Subject::subscribe(Observer *newView) {
observers_.insert(newView);
}
void Subject::unsubscribe(Observer *formerView) {
observers_.erase(formerView);
}
//asks view to create a popup to tell what player goes first in the current round
void Subject::playerturn(string msg) {
Observers::iterator i;
for (i = observers_.begin(); i != observers_.end(); ++i)
(*i)->update(msg);
}
//asks view to create a popup to output the end of round scores
void Subject::endRound(string msg, vector<int> d, vector<int> s) {
Observers::iterator i;
for (i = observers_.begin(); i != observers_.end(); ++i)
(*i)->endRound(msg, d, s);
}
//update the table, discards, and player's hand for the human player's turn
void Subject::updateInterface(vector<int> discard, vector<int> hand,
vector<int> table, vector<int> legalIndex) {
Observers::iterator i;
for (i = observers_.begin(); i != observers_.end(); ++i)
(*i)->updateInterface(discard, hand, table, legalIndex);
}
//notifies the view to clear the table and hand to null cards (back side of cards)
void Subject::notifyTableClear() {
Observers::iterator i;
for (i = observers_.begin(); i != observers_.end(); ++i)
(*i)->notifyTableClear();
}
//tells view to end the game (clear all cards to null, and reset all labels, buttons)
void Subject::endGame(string msg) {
Observers::iterator i;
for (i = observers_.begin(); i != observers_.end(); ++i)
(*i)->endGame(msg);
}
| [
"[email protected]"
] | |
a7478b1cb43e621544690306f043aeee6270f4f2 | f75c62b9227f8459e2807fde3279b2a5e56e6e64 | /CHr41/cpm210/4.5/omega | 0c11c8b4304baad45d7073d6d0dc3bd1a812162b | [] | no_license | kohoman/mstAdvComp.sp21 | a718a930d693030e0abf05f451cdee50a6fca5f0 | 30307c3ff3c3e1e2c1dabf611e550f2c426d5d8d | refs/heads/main | 2023-04-22T08:27:11.181441 | 2021-05-03T19:57:22 | 2021-05-03T19:57:22 | 338,087,447 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,765 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5.0 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class volScalarField;
location "4.5";
object omega;
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
dimensions [0 0 -1 0 0 0 0];
internalField nonuniform List<scalar>
400
(
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
37.0089
55.0117
73.7178
78.2668
72.6321
62.2123
53.6716
44.8088
39.7071
35.3384
33.536
32.9355
35.4241
37.9328
42.8851
50.3018
63.189
87.9125
128
128
38.1558
48.3596
51.7011
47.5536
37.0472
30.3597
25.2943
22.7405
21.4764
20.9754
20.9051
21.7422
23.1066
25.6486
29.9683
37.8521
52.2067
81.4733
128
128
38.0295
40.0069
38.0187
30.1335
22.6706
19.1425
16.5001
15.2518
14.4383
14.1008
14.0074
14.4437
15.4131
17.2948
20.701
27.2242
40.5328
71.5459
128
128
36.3058
33.2974
28.5781
20.5736
15.9646
13.6691
11.8051
10.9164
10.3518
10.134
10.1034
10.5778
11.4766
13.1684
16.1791
22.0641
34.3622
64.7026
128
128
33.2058
27.696
22.1911
15.3996
12.2892
10.4494
9.13273
8.51689
8.22269
8.14188
8.319
8.82217
9.55497
10.7695
13.0141
17.9747
28.8077
58.6848
128
128
30.458
23.8676
18.0395
12.4964
10.0697
8.51475
7.71119
7.38688
7.2968
7.42654
7.77346
8.23443
8.80645
9.69779
11.4676
15.9467
26.0852
55.0493
128
128
28.7775
20.7919
15.4336
10.74
8.6693
7.55569
7.11571
7.01725
7.13165
7.38433
7.69823
8.02935
8.46409
9.11214
10.1653
13.814
22.9519
51.7634
128
128
27.1324
18.9952
13.848
9.77468
7.94996
7.14306
6.92642
6.95913
7.09052
7.22315
7.29157
7.40416
7.758
8.48636
9.44534
12.5263
21.1819
49.5716
128
128
27.5049
17.5168
12.9295
9.20291
7.58307
6.9634
6.86032
6.89899
6.85753
6.46019
6.12082
6.01186
6.33429
7.21646
8.62778
11.1242
19.1826
47.4149
128
128
29.7898
17.0967
12.45
9.09317
7.46779
6.87851
6.80684
6.77332
6.31419
5.63668
5.29993
5.27526
5.57193
6.27606
8.05143
10.4197
18.2126
45.5929
128
128
35.3379
17.5028
12.5133
9.1925
7.50639
6.84967
6.70668
6.51638
5.8966
5.28862
5.0365
5.07865
5.33722
5.94554
7.66568
10.0726
17.6206
43.7409
128
128
43.5223
18.8993
12.8696
9.49934
7.66375
6.89206
6.67806
6.44598
5.90268
5.32754
5.06622
5.08011
5.296
5.86545
7.51739
9.97121
17.4255
42.1728
128
128
53.2459
21.8122
13.7545
10.0557
8.01183
7.04488
6.72915
6.50328
6.03208
5.49874
5.20909
5.22278
5.41642
5.93954
7.50089
10.1347
17.5153
41.6256
128
128
63.5739
27.7752
15.716
11.1579
8.73032
7.43045
6.92159
6.6582
6.33374
5.87284
5.52749
5.53354
5.72101
6.26814
7.90335
10.6365
18.2518
42.2858
128
128
63.5033
33.9872
19.5267
13.0577
9.97091
8.26114
7.43413
7.02974
6.74572
6.40443
6.05768
6.05584
6.22964
6.79145
8.54764
11.4838
19.3893
43.9523
128
128
58.7177
36.0271
24.2942
17.1697
12.9188
10.2866
8.78712
7.98719
7.58206
7.25291
6.93685
6.95214
7.17742
7.85605
9.93717
13.178
21.6041
47.8717
128
128
44.1703
34.0517
26.2554
20.4922
16.5073
13.7113
11.8112
10.486
9.72737
9.26922
8.96505
9.03505
9.38708
10.4288
13.4463
17.4055
27.6219
58.0284
128
128
36.4476
34.4039
30.534
27.2389
24.6564
22.3876
21.1841
20.275
20.3164
20.6754
21.5154
23.225
25.952
29.4024
34.9337
41.1982
55.4729
88.2067
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
)
;
boundaryField
{
movingWall
{
Cmu 0.09;
kappa 0.41;
E 9.8;
beta1 0.075;
blended false;
type omegaWallFunction;
value nonuniform List<scalar>
20
(
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
)
;
}
fixedWalls
{
Cmu 0.09;
kappa 0.41;
E 9.8;
beta1 0.075;
blended false;
type omegaWallFunction;
value nonuniform List<scalar>
60
(
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
128
)
;
}
frontAndBack
{
type empty;
}
}
// ************************************************************************* //
| [
"[email protected]"
] | ||
ff8b297778adcd1e1b2c4a94b2ba0c208fdb7b72 | 66880b4c06bf662d058b1184642e9f052779ea9e | /art/runtime/arch_backup/x86_64/fault_handler_x86_64.cc | 233d3c7d1ad4613b7a787e76f68d75ca5dde00c2 | [] | no_license | ParkHanbum/dex2ir | afa195163a048efa01c1cbd44c90ffd84565d053 | a4cc0fe939146ca258c50a6b52b8fa09313f5eb4 | refs/heads/master | 2022-07-02T20:28:19.323269 | 2022-05-30T09:22:33 | 2022-05-30T09:22:33 | 247,693,944 | 51 | 16 | null | null | null | null | UTF-8 | C++ | false | false | 1,338 | cc | /*
* Copyright (C) 2008 The Android Open Source Project
*
* 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 "fault_handler.h"
#include <sys/ucontext.h>
#include "base/macros.h"
#include "globals.h"
#include "base/logging.h"
#include "base/hex_dump.h"
//
// X86_64 specific fault handler functions.
//
namespace art {
void FaultManager::GetMethodAndReturnPCAndSP(void* context, mirror::ArtMethod** out_method,
uintptr_t* out_return_pc, uintptr_t* out_sp) {
}
bool NullPointerHandler::Action(int sig, siginfo_t* info, void* context) {
return false;
}
bool SuspensionHandler::Action(int sig, siginfo_t* info, void* context) {
return false;
}
bool StackOverflowHandler::Action(int sig, siginfo_t* info, void* context) {
return false;
}
} // namespace art
| [
"[email protected]"
] | |
7492d403129e0331f4bb9eed2decbc3cb7f48564 | fa0c642ba67143982d3381f66c029690b6d2bd17 | /Source/Engine/Encryption/DESDecryptor.h | 67ee4e84dcc93a4dc6e62709f569217f4cdfd1ca | [
"MIT"
] | permissive | blockspacer/EasyGameEngine | 3f605fb2d5747ab250ef8929b0b60e5a41cf6966 | da0b0667138573948cbd2e90e56ece5c42cb0392 | refs/heads/master | 2023-05-05T20:01:31.532452 | 2021-06-01T13:35:54 | 2021-06-01T13:35:54 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 691 | h | //! @file DESDecryptor.h
//! @author LiCode
//! @version 1.1.0.689
//! @date 2011/02/13
//! Copyright ...
#pragma once
namespace EGE
{
//----------------------------------------------------------------------------
// DESDecryptor
//----------------------------------------------------------------------------
class DESDecryptor : public TDecryptor< IDecryptor, 8 >
{
private:
des_context mContext;
// TDecryptor Interface
private:
virtual _void OnProcessBuffer( const _byte* in_buffer, _dword size, _byte* out_buffer ) override;
public:
DESDecryptor( );
virtual ~DESDecryptor( );
// IDecryptor Interface
public:
virtual _ubool SetKey( AStringPtr key ) override;
};
}
| [
"[email protected]"
] | |
2bc86306766a07c344ad52482889ae93dfa6366e | 62d48af115ea9d14bc5a7dd85212e616a48dcac6 | /src/optimizerBenchmark/headers/ScanMovieStarSet.h | 711ec6bfd708f0b37f006de8d855ca0766edfd97 | [
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause"
] | permissive | asu-cactus/lachesis | ab1ab1704e4f0f2d6aef1a2bff2dc99ea8f09337 | 92efa7b124a23894485a900bb394670487051948 | refs/heads/master | 2023-03-05T11:41:35.016673 | 2021-02-14T21:50:32 | 2021-02-14T21:50:32 | 151,744,205 | 2 | 0 | Apache-2.0 | 2021-02-14T16:37:54 | 2018-10-05T15:49:15 | C++ | UTF-8 | C++ | false | false | 386 | h | #ifndef SCAN_MOVIESTAR_SET_H
#define SCAN_MOVIESTAR_SET_H
#include "ScanUserSet.h"
#include "MovieStar.h"
using namespace pdb;
class ScanMovieStarSet : public ScanUserSet<MovieStar> {
public:
ENABLE_DEEP_COPY
ScanMovieStarSet() {}
ScanMovieStarSet(std::string dbName, std::string setName) {
setDatabaseName(dbName);
setSetName(setName);
}
};
#endif | [
"[email protected]"
] | |
e4a24b45848578d32e04889da26165d04ca902d2 | 00413d600530396733988bbc9ecd48b6a67fd359 | /enigma/include/enigma/utils.h | f19029706f6b9843437d281ec4fc877a3a6bc1ab | [] | no_license | carzil/enigma | 520a44a69985390704188658e9c882e048caf69f | 0156a89a66adc62c6afea4d03fa1fd4224ab4162 | refs/heads/master | 2020-12-24T19:28:19.305487 | 2016-06-04T23:49:39 | 2016-06-04T23:49:39 | 58,167,126 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,262 | h | #pragma once
#include <experimental/string_view>
using std::experimental::string_view;
namespace Enigma {
void print_char_bits(char c);
class DataInput {
public:
DataInput(const std::string& s) : raw(s), pos(0) {}
uint8_t ReadChar() {
uint8_t r = raw[pos];
pos++;
return r;
}
int ReadInt() {
int n = static_cast<uint8_t>(raw[pos]);
n |= static_cast<uint8_t>(raw[pos + 1]) << 8;
n |= static_cast<uint8_t>(raw[pos + 2]) << 16;
n |= static_cast<uint8_t>(raw[pos + 3]) << 24;
pos += 4;
return n;
}
private:
const std::string& raw;
size_t pos;
};
class DataOutput {
public:
DataOutput() {}
void WriteInt(int n) {
raw.push_back(static_cast<uint8_t>(n));
raw.push_back(static_cast<uint8_t>(n >> 8));
raw.push_back(static_cast<uint8_t>(n >> 16));
raw.push_back(static_cast<uint8_t>(n >> 24));
}
void WriteChar(uint8_t ch) {
raw.push_back(static_cast<uint8_t>(ch));
}
const std::string& GetStr() {
return raw;
}
private:
std::string raw;
};
} | [
"[email protected]"
] | |
ce620474339fad0666dc6eb6f8804dac38e1cd93 | 55821b09861478c6db214d808f12f493f54ff82a | /trunk/webcgi/oraclesmsdll/oraclesmsdll.cpp | 23a1d629307a7d301f1fa71505be311dca9d2485 | [] | no_license | SiteView/ECC8.13 | ede526a869cf0cb076cd9695dbc16075a1cf9716 | bced98372138b09140dc108b33bb63f33ef769fe | refs/heads/master | 2016-09-05T13:57:21.282048 | 2012-06-12T08:54:40 | 2012-06-12T08:54:40 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,397 | cpp | // oraclesmsdll.cpp : 定义 DLL 的初始化例程。
//
#include "stdafx.h"
#include "oraclesmsdll.h"
#include "Ado.h"
#include "AdoRecordSet.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
//
// 注意!
//
// 如果此 DLL 动态链接到 MFC
// DLL,从此 DLL 导出并
// 调入 MFC 的任何函数在函数的最前面
// 都必须添加 AFX_MANAGE_STATE 宏。
//
// 例如:
//
// extern "C" BOOL PASCAL EXPORT ExportedFunction()
// {
// AFX_MANAGE_STATE(AfxGetStaticModuleState());
// // 此处为普通函数体
// }
//
// 此宏先于任何 MFC 调用
// 出现在每个函数中十分重要。这意味着
// 它必须作为函数中的第一个语句
// 出现,甚至先于所有对象变量声明,
// 这是因为它们的构造函数可能生成 MFC
// DLL 调用。
//
// 有关其他详细信息,
// 请参阅 MFC 技术说明 33 和 58。
//
// CoraclesmsdllApp
BEGIN_MESSAGE_MAP(CoraclesmsdllApp, CWinApp)
END_MESSAGE_MAP()
// CoraclesmsdllApp 构造
CoraclesmsdllApp::CoraclesmsdllApp()
{
// TODO: 在此处添加构造代码,
// 将所有重要的初始化放置在 InitInstance 中
}
// 唯一的一个 CoraclesmsdllApp 对象
CoraclesmsdllApp theApp;
// CoraclesmsdllApp 初始化
BOOL CoraclesmsdllApp::InitInstance()
{
CWinApp::InitInstance();
return TRUE;
}
| [
"[email protected]"
] | |
04bb09dd8e2858a7f199dfee8e0abd09a7a6ff2b | ca7697e9035231a9cf27daaa957ac8465af60ff1 | /custom_op/tanh/tanh.cc | bdca633235cb8fba68c362ccee181778729f29bc | [] | no_license | chenwhql/PaddleScripts | 4d10b9e9ebc18ab823fb058eb2fc5ec00826e9ee | d4e08cd83c9cdf8678739d20db5a0fb180915756 | refs/heads/master | 2022-11-11T10:11:32.302287 | 2022-11-04T06:11:08 | 2022-11-04T06:11:08 | 225,184,564 | 0 | 2 | null | 2021-03-07T22:23:14 | 2019-12-01T15:34:51 | Python | UTF-8 | C++ | false | false | 2,778 | cc | #include <paddle/extension.h>
#include <vector>
#define PADDLE_WITH_CUDA
#define CHECK_INPUT(x) PD_CHECK(x.place() == paddle::PlaceType::kGPU, #x " must be a GPU Tensor.")
// cuda实现声明
std::vector<paddle::Tensor> tanh_cuda_forward(const paddle::Tensor& x);
std::vector<paddle::Tensor> tanh_cuda_backward(const paddle::Tensor& x,
const paddle::Tensor& y,
const paddle::Tensor& dy);
std::vector<paddle::Tensor> tanh_cuda_double_backward(const paddle::Tensor& y,
const paddle::Tensor& dy,
const paddle::Tensor& ddx);
// 决定调用cpu或者gpu实现。暂时只提供了gpu实现
std::vector<paddle::Tensor> TanhForward(const paddle::Tensor& x) {
CHECK_INPUT(x);
return tanh_cuda_forward(x);
}
std::vector<paddle::Tensor> TanhBackward(const paddle::Tensor& x,
const paddle::Tensor& y,
const paddle::Tensor& dy) {
CHECK_INPUT(x);
CHECK_INPUT(y);
CHECK_INPUT(dy);
return tanh_cuda_backward(x, y, dy);
}
std::vector<paddle::Tensor> TanhDoubleBackward(const paddle::Tensor& y,
const paddle::Tensor& dy,
const paddle::Tensor& ddx) {
CHECK_INPUT(y);
CHECK_INPUT(dy);
CHECK_INPUT(ddx);
return tanh_cuda_double_backward(y, dy, ddx);
}
// 形状推断函数
std::vector<std::vector<int64_t>> tanh_forward_InferShape(
const std::vector<int64_t>& x_shape) {
return {x_shape};
}
std::vector<std::vector<int64_t>> tanh_backward_InferShape(
const std::vector<int64_t>& x_shape,
const std::vector<int64_t>& y_shape,
const std::vector<int64_t>& dy_shape) {
return {x_shape};
}
std::vector<std::vector<int64_t>> tanh_double_backward_InferShape(
const std::vector<int64_t>& y_shape,
const std::vector<int64_t>& dy_shape,
const std::vector<int64_t>& ddx_shape) {
return {y_shape};
}
PD_BUILD_OP(tanh_op)
.Inputs({"X"})
.Outputs({"Y"})
.SetKernelFn(PD_KERNEL(TanhForward))
.SetInferShapeFn(PD_INFER_SHAPE(tanh_forward_InferShape));
PD_BUILD_GRAD_OP(tanh_op)
.Inputs({"X", "Y", paddle::Grad("Y")})
.Outputs({paddle::Grad("X")})
.SetKernelFn(PD_KERNEL(TanhBackward))
.SetInferShapeFn(PD_INFER_SHAPE(tanh_backward_InferShape));
PD_BUILD_DOUBLE_GRAD_OP(tanh_op)
.Inputs({"Y", paddle::Grad("Y"), paddle::Grad(paddle::Grad("X"))})
.Outputs({paddle::Grad(paddle::Grad("Y")), paddle::Grad("Y")})
.SetKernelFn(PD_KERNEL(TanhDoubleBackward))
.SetInferShapeFn(PD_INFER_SHAPE(tanh_double_backward_InferShape)); | [
"[email protected]"
] | |
624fc8b9d90556dd512b9357fa661f1229fed993 | e7f4f02765a1bbfb8d01e922e03bd4954657e8cc | /src/top/msg_conversion.cc | 233d2e9059937df9ff3b09e4d4882ef02dbfa492 | [] | no_license | Forrest-Z/cartoSLAM | 536a5aef1b7db58f78c174c1afd0c64e631ef5e7 | eee6c67998c516412f33f7bd8a6709063b9d23e7 | refs/heads/master | 2020-03-21T04:30:38.530573 | 2017-11-10T10:08:53 | 2017-11-10T10:08:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,923 | cc | /*
* Copyright 2016 The Cartographer Authors
*
* 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 "msg_conversion.h"
#include "../common/port.h"
#include "src/transform/proto/transform.pb.h"
#include "../transform/transform.h"
#include "geometry_msgs/Pose.h"
#include "geometry_msgs/Quaternion.h"
#include "geometry_msgs/Transform.h"
#include "geometry_msgs/TransformStamped.h"
#include "geometry_msgs/Vector3.h"
#include "glog/logging.h"
#include "ros/ros.h"
#include "sensor_msgs/Imu.h"
#include "sensor_msgs/LaserScan.h"
#include "sensor_msgs/MultiEchoLaserScan.h"
#include "sensor_msgs/PointCloud2.h"
namespace cartographer_ros {
using ::cartographer::transform::Rigid3d;
using ::cartographer::sensor::PointCloudWithIntensities;
constexpr float kPointCloudComponentFourMagic = 1.;
// For sensor_msgs::LaserScan.
bool HasEcho(float) { return true; }
float GetFirstEcho(float range) { return range; }
// For sensor_msgs::MultiEchoLaserScan.
bool HasEcho(const sensor_msgs::LaserEcho& echo) {
return !echo.echoes.empty();
}
float GetFirstEcho(const sensor_msgs::LaserEcho& echo) {
return echo.echoes[0];
}
template <typename LaserMessageType>
PointCloudWithIntensities LaserScanToPointCloudWithIntensities(const LaserMessageType &msg)
{
PointCloudWithIntensities point_cloud;
float angle = msg.angle_min;
for (size_t i = 0; i < msg.ranges.size(); ++i)
{
const auto &echoes = msg.ranges[i];
if (HasEcho(echoes))
{
const float first_echo = GetFirstEcho(echoes);
if (msg.range_min <= first_echo && first_echo <= msg.range_max)
{
const Eigen::AngleAxisf rotation(angle, Eigen::Vector3f::UnitZ());
point_cloud.points.push_back(rotation *
(first_echo * Eigen::Vector3f::UnitX()));
if (msg.intensities.size() > 0)
{
const auto &echo_intensities = msg.intensities[i];
point_cloud.intensities.push_back(GetFirstEcho(echo_intensities));
}
else
{
point_cloud.intensities.push_back(0.f);
}
}
}
angle += msg.angle_increment;
}
return point_cloud;
}
sensor_msgs::PointCloud2 PreparePointCloud2Message(const double timestamp,
const string& frame_id,
const int num_points) {
sensor_msgs::PointCloud2 msg;
msg.header.stamp = ::ros::Time(timestamp);
msg.header.frame_id = frame_id;
msg.height = 1;
msg.width = num_points;
msg.fields.resize(3);
msg.fields[0].name = "x";
msg.fields[0].offset = 0;
msg.fields[0].datatype = sensor_msgs::PointField::FLOAT32;
msg.fields[0].count = 1;
msg.fields[1].name = "y";
msg.fields[1].offset = 4;
msg.fields[1].datatype = sensor_msgs::PointField::FLOAT32;
msg.fields[1].count = 1;
msg.fields[2].name = "z";
msg.fields[2].offset = 8;
msg.fields[2].datatype = sensor_msgs::PointField::FLOAT32;
msg.fields[2].count = 1;
msg.is_bigendian = false;
msg.point_step = 16;
msg.row_step = 16 * msg.width;
msg.is_dense = true;
msg.data.resize(16 * num_points);
return msg;
}
sensor_msgs::PointCloud2 ToPointCloud2Message(
const double timestamp, const string& frame_id,
const ::cartographer::sensor::PointCloud& point_cloud) {
auto msg = PreparePointCloud2Message(timestamp, frame_id, point_cloud.size());
::ros::serialization::OStream stream(msg.data.data(), msg.data.size());
for (const auto& point : point_cloud) {
stream.next(point.x());
stream.next(point.y());
stream.next(point.z());
stream.next(kPointCloudComponentFourMagic);
}
return msg;
}
PointCloudWithIntensities ToPointCloudWithIntensities(
const sensor_msgs::LaserScan& msg) {
return LaserScanToPointCloudWithIntensities(msg);
}
Rigid3d ToRigid3d(const geometry_msgs::TransformStamped& transform) {
return Rigid3d(ToEigen(transform.transform.translation),
ToEigen(transform.transform.rotation));
}
Rigid3d ToRigid3d(const geometry_msgs::Pose& pose) {
return Rigid3d({pose.position.x, pose.position.y, pose.position.z},
ToEigen(pose.orientation));
}
Eigen::Vector3d ToEigen(const geometry_msgs::Vector3& vector3) {
return Eigen::Vector3d(vector3.x, vector3.y, vector3.z);
}
Eigen::Quaterniond ToEigen(const geometry_msgs::Quaternion& quaternion) {
return Eigen::Quaterniond(quaternion.w, quaternion.x, quaternion.y,
quaternion.z);
}
/*
geometry_msgs::Transform ToGeometryMsgTransform(const Rigid3d& rigid3d) {
geometry_msgs::Transform transform;
transform.translation.x = rigid3d.translation().x();
transform.translation.y = rigid3d.translation().y();
transform.translation.z = rigid3d.translation().z();
transform.rotation.w = rigid3d.rotation().w();
transform.rotation.x = rigid3d.rotation().x();
transform.rotation.y = rigid3d.rotation().y();
transform.rotation.z = rigid3d.rotation().z();
return transform;
}
geometry_msgs::Pose ToGeometryMsgPose(const Rigid3d& rigid3d) {
geometry_msgs::Pose pose;
pose.position = ToGeometryMsgPoint(rigid3d.translation());
pose.orientation.w = rigid3d.rotation().w();
pose.orientation.x = rigid3d.rotation().x();
pose.orientation.y = rigid3d.rotation().y();
pose.orientation.z = rigid3d.rotation().z();
return pose;
}
geometry_msgs::Point ToGeometryMsgPoint(const Eigen::Vector3d& vector3d) {
geometry_msgs::Point point;
point.x = vector3d.x();
point.y = vector3d.y();
point.z = vector3d.z();
return point;
}*/
} // namespace cartographer_ros
| [
"[email protected]"
] | |
96bae72b6fd30f74810619ca4cfc9d393ad18172 | 60cb1638f0c44b850d197b48e9ebe57ac14feb7a | /C++语言实现算法设计与分析/ch5/knap2.cpp | f482f724ba59ddf7ebf675d758bad3950c7f2d2e | [] | no_license | losangler/C_project | 44e0cf5426df1b83c3c69ad00a5038d8a595bf84 | ef36e9e2dbc606c7eb28afcd3691613c306be15f | refs/heads/master | 2022-05-10T01:21:45.101742 | 2020-04-28T10:09:30 | 2020-04-28T10:09:30 | null | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,420 | cpp | //采用进一步剪枝求解0/1背包问题的算法
#include <stdio.h>
#include <string.h>
#define MAXN 20 //最多物品数
//问题表示
int n=4; //4种物品
int W=6; //限制重量为6
int w[]={0,5,3,2,1}; //存放4个物品重量,不用下标0元素
int v[]={0,4,4,3,1}; //存放4个物品价值,不用下标0元素
//求解结果表示
int x[MAXN]; //存放最终解
int maxv; //存放最优解的总价值
void dfs(int i,int tw,int tv,int rw,int op[]) //求解0/1背包问题
{
int j;
if (i>n) //找到一个叶子结点
{ if (tw==W && tv>maxv) //找到一个满足条件的更优解,保存它
{ maxv=tv;
for (j=1;j<=n;j++) //复制最优解
x[j]=op[j];
}
}
else //尚未找完所有物品
{ if (tw+w[i]<=W) //左孩子结点剪枝:满足条件时才放入第i个物品
{
op[i]=1; //选取第i个物品
dfs(i+1,tw+w[i],tv+v[i],rw-w[i],op);
}
op[i]=0; //不选取第i个物品,回溯
if (tw+rw>W) //右孩子结点剪枝
dfs(i+1,tw,tv,rw-w[i],op);
}
}
void dispasolution() //输出最优解
{ int i;
printf("最佳装填方案是:\n");
for (i=1;i<=n;i++)
if (x[i]==1)
printf(" 选取第%d个物品\n",i);
printf("总重量=%d,总价值=%d\n",W,maxv);
}
void main()
{
int op[MAXN]; //存放临时解
memset(op,0,sizeof(op));
int rw=0;
for (int i=1;i<=n;i++)
rw+=w[i];
dfs(1,0,0,rw,op);
dispasolution();
}
| [
"[email protected]"
] | |
d1d9bfd344ffa7ddeed686d53e07302698fd58df | 08c59366b00b1c68ec07d2358e0bbf93be1dba47 | /include/Engine/Event/KeyEvent.h | 0108aad64a3728b12636fa1c2ae743a001ee0316 | [] | no_license | minad/isometric | 835c9ba5bbedaa029706a86d7f806813075590c8 | 382d9c30c6714b3fc65e7e3eca936892997c94fa | refs/heads/master | 2023-08-22T17:50:43.961618 | 2017-03-07T00:32:34 | 2017-03-07T00:32:34 | 84,135,423 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 536 | h | #ifndef _Engine_Event_KeyEvent_h
#define _Engine_Event_KeyEvent_h
#include "Engine/Event/Event.h"
#include "SDLWrapper.h"
namespace Engine {
namespace Event {
struct KeyEvent : public Event
{
SDL::Key key;
SDL::Mod mod;
Uint16 unicode;
bool pressed;
KeyEvent(EventSource* source, SDL::Key key, SDL::Mod mod, Uint16 unicode, bool pressed)
: Event(source), key(key), mod(mod), unicode(unicode), pressed(pressed) {}
};
} // namespace Event
} // namespace Engine
#endif // _Engine_Event_KeyEvent_h
| [
"[email protected]"
] | |
5e8f10aec7ec1acb7ca496d8847d530496467129 | 2bee1a708a18fa3681bcbf4fe59d99b3365c2b22 | /Displays/Classes/common.hpp | ea8e447ec4cb101d2375294c838d0bca7672c1c0 | [] | no_license | JohnDeved/BountyHunters-Client | 4312a61d51517936ccd8471f1a6adf9485719e1e | 50d593d7fa9410675a0b4fd5b111d1c8b352a7ac | refs/heads/master | 2021-07-24T23:22:58.782594 | 2017-11-05T16:19:50 | 2017-11-05T16:19:50 | 109,595,187 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 100,635 | hpp | // Generated by: "call BIS_fnc_exportGUIBaseClasses" call BIS_fnc_exportGUIBaseClasses;
// Control types
#define CT_STATIC 0
#define CT_BUTTON 1
#define CT_EDIT 2
#define CT_SLIDER 3
#define CT_COMBO 4
#define CT_LISTBOX 5
#define CT_TOOLBOX 6
#define CT_CHECKBOXES 7
#define CT_PROGRESS 8
#define CT_HTML 9
#define CT_STATIC_SKEW 10
#define CT_ACTIVETEXT 11
#define CT_TREE 12
#define CT_STRUCTURED_TEXT 13
#define CT_CONTEXT_MENU 14
#define CT_CONTROLS_GROUP 15
#define CT_SHORTCUTBUTTON 16
#define CT_HITZONES 17
#define CT_XKEYDESC 40
#define CT_XBUTTON 41
#define CT_XLISTBOX 42
#define CT_XSLIDER 43
#define CT_XCOMBO 44
#define CT_ANIMATED_TEXTURE 45
#define CT_OBJECT 80
#define CT_OBJECT_ZOOM 81
#define CT_OBJECT_CONTAINER 82
#define CT_OBJECT_CONT_ANIM 83
#define CT_LINEBREAK 98
#define CT_USER 99
#define CT_MAP 100
#define CT_MAP_MAIN 101
#define CT_LISTNBOX 102
#define CT_ITEMSLOT 103
#define CT_CHECKBOX 77
// Static styles
#define ST_POS 0x0F
#define ST_HPOS 0x03
#define ST_VPOS 0x0C
#define ST_LEFT 0x00
#define ST_RIGHT 0x01
#define ST_CENTER 0x02
#define ST_DOWN 0x04
#define ST_UP 0x08
#define ST_VCENTER 0x0C
#define ST_TYPE 0xF0
#define ST_SINGLE 0x00
#define ST_MULTI 0x10
#define ST_TITLE_BAR 0x20
#define ST_PICTURE 0x30
#define ST_FRAME 0x40
#define ST_BACKGROUND 0x50
#define ST_GROUP_BOX 0x60
#define ST_GROUP_BOX2 0x70
#define ST_HUD_BACKGROUND 0x80
#define ST_TILE_PICTURE 0x90
#define ST_WITH_RECT 0xA0
#define ST_LINE 0xB0
#define ST_UPPERCASE 0xC0
#define ST_LOWERCASE 0xD0
#define ST_SHADOW 0x100
#define ST_NO_RECT 0x200
#define ST_KEEP_ASPECT_RATIO 0x800
// Slider styles
#define SL_DIR 0x400
#define SL_VERT 0
#define SL_HORZ 0x400
#define SL_TEXTURES 0x10
// progress bar
#define ST_VERTICAL 0x01
#define ST_HORIZONTAL 0
// Listbox styles
#define LB_TEXTURES 0x10
#define LB_MULTI 0x20
// Tree styles
#define TR_SHOWROOT 1
#define TR_AUTOCOLLAPSE 2
// Default grid
#define GUI_GRID_WAbs ((safezoneW / safezoneH) min 1.2)
#define GUI_GRID_HAbs (GUI_GRID_WAbs / 1.2)
#define GUI_GRID_W (GUI_GRID_WAbs / 40)
#define GUI_GRID_H (GUI_GRID_HAbs / 25)
#define GUI_GRID_X (safezoneX)
#define GUI_GRID_Y (safezoneY + safezoneH - GUI_GRID_HAbs)
// Default text sizes
#define GUI_TEXT_SIZE_SMALL (GUI_GRID_H * 0.8)
#define GUI_TEXT_SIZE_MEDIUM (GUI_GRID_H * 1)
#define GUI_TEXT_SIZE_LARGE (GUI_GRID_H * 1.2)
// Pixel grid
#define pixelScale 0.50
#define GRID_W (pixelW * pixelGrid * pixelScale)
#define GRID_H (pixelH * pixelGrid * pixelScale)
class ScrollBar
{
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.3};
width = 0;
height = 0;
autoScrollEnabled = 0;
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
thumb = "\A3\ui_f\data\gui\cfg\scrollbar\thumb_ca.paa";
arrowEmpty = "\A3\ui_f\data\gui\cfg\scrollbar\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\scrollbar\arrowFull_ca.paa";
border = "\A3\ui_f\data\gui\cfg\scrollbar\border_ca.paa";
shadow = 0;
scrollSpeed = 0.06;
};
class RscObject
{
access = 0;
type = CT_OBJECT;
scale = 1;
direction[] = {0,0,1};
up[] = {0,1,0};
shadow = 0;
};
class RscText
{
deletable = 0;
fade = 0;
access = 0;
type = CT_STATIC;
idc = -1;
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
text = "";
fixedWidth = 0;
x = 0;
y = 0;
h = 0.037;
w = 0.3;
style = ST_LEFT;
shadow = 1;
colorShadow[] = {0,0,0,0.5};
font = "RobotoCondensed";
SizeEx = GUI_TEXT_SIZE_MEDIUM;
linespacing = 1;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class RscTextSmall: RscText
{
h = 0.03;
sizeEx = 0.027;
};
class RscTitle: RscText
{
x = 0.15;
y = 0.06;
w = 0.7;
shadow = 0;
style = ST_LEFT;
sizeEx = GUI_TEXT_SIZE_MEDIUM;
colorText[] = {0.95,0.95,0.95,1};
font = "PuristaMedium";
};
class RscProgress
{
deletable = 0;
fade = 0;
access = 0;
type = CT_PROGRESS;
style = ST_HORIZONTAL;
colorFrame[] = {0,0,0,0};
colorBar[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"
};
x = 0.344;
y = 0.619;
w = 0.313726;
h = 0.0261438;
shadow = 2;
texture = "#(argb,8,8,3)color(1,1,1,1)";
};
class RscProgressNotFreeze
{
deletable = 0;
fade = 0;
idc = -1;
type = CT_ANIMATED_TEXTURE;
style = ST_LEFT;
shadow = 0;
x = 0;
y = 0;
w = 0.5;
h = 0.1;
texture = "#(argb,8,8,3)color(0,0,0,0)";
};
class RscPicture
{
deletable = 0;
fade = 0;
access = 0;
type = CT_STATIC;
idc = -1;
style = ST_MULTI + ST_TITLE_BAR;
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
font = "TahomaB";
sizeEx = 0;
lineSpacing = 0;
text = "";
fixedWidth = 0;
shadow = 0;
x = 0;
y = 0;
w = 0.2;
h = 0.15;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class RscLadderPicture: RscPicture
{
bottomValue = 0;
topValue = 100;
visibleRange = -1;
};
class RscPictureKeepAspect: RscPicture
{
style = ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
};
class RscHTML
{
deletable = 0;
fade = 0;
access = 0;
type = CT_HTML;
idc = -1;
style = ST_LEFT;
filename = "";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
colorBold[] = {1,1,1,1};
colorLink[] = {1,1,1,0.75};
colorLinkActive[] = {1,1,1,1};
colorPicture[] = {1,1,1,1};
colorPictureLink[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureBorder[] = {0,0,0,0};
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
class H1
{
font = "RobotoCondensed";
fontBold = "RobotoCondensedBold";
sizeEx = GUI_TEXT_SIZE_LARGE;
align = "left";
};
class H2
{
font = "RobotoCondensed";
fontBold = "RobotoCondensedBold";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
align = "right";
};
class H3
{
font = "RobotoCondensed";
fontBold = "RobotoCondensedBold";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
align = "left";
};
class H4
{
font = "RobotoCondensed";
fontBold = "RobotoCondensedBold";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
align = "left";
};
class H5
{
font = "RobotoCondensed";
fontBold = "RobotoCondensedBold";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
align = "left";
};
class H6
{
font = "RobotoCondensed";
fontBold = "RobotoCondensedBold";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
align = "left";
};
class P
{
font = "RobotoCondensed";
fontBold = "RobotoCondensedBold";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
align = "left";
};
x = 0;
y = 0;
w = 0.1;
h = 0.1;
sizeEx = GUI_TEXT_SIZE_MEDIUM;
prevPage = "\A3\ui_f\data\gui\rsccommon\rschtml\arrow_left_ca.paa";
nextPage = "\A3\ui_f\data\gui\rsccommon\rschtml\arrow_right_ca.paa";
shadow = 2;
};
class RscButton
{
deletable = 0;
fade = 0;
access = 0;
type = CT_BUTTON;
text = "";
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
colorBackground[] = {0,0,0,0.5};
colorBackgroundDisabled[] = {0,0,0,0.5};
colorBackgroundActive[] = {0,0,0,1};
colorFocused[] = {0,0,0,1};
colorShadow[] = {0,0,0,0};
colorBorder[] = {0,0,0,1};
soundEnter[] =
{
"\A3\ui_f\data\sound\RscButton\soundEnter",
0.09,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
soundClick[] =
{
"\A3\ui_f\data\sound\RscButton\soundClick",
0.09,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButton\soundEscape",
0.09,
1
};
idc = -1;
style = ST_CENTER;
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
shadow = 2;
font = "RobotoCondensed";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
url = "";
offsetX = 0;
offsetY = 0;
offsetPressedX = 0;
offsetPressedY = 0;
borderSize = 0;
};
class RscShortcutButton
{
deletable = 0;
fade = 0;
type = CT_SHORTCUTBUTTON;
x = 0.1;
y = 0.1;
class HitZone
{
left = 0;
top = 0;
right = 0;
bottom = 0;
};
class ShortcutPos
{
left = 0;
top = ((GUI_GRID_HAbs / 20) - GUI_TEXT_SIZE_MEDIUM) / 2;
w = GUI_TEXT_SIZE_MEDIUM * (3/4);
h = GUI_TEXT_SIZE_MEDIUM;
};
class TextPos
{
left = GUI_TEXT_SIZE_MEDIUM * (3/4);
top = ((GUI_GRID_HAbs / 20) - GUI_TEXT_SIZE_MEDIUM) / 2;
right = 0.005;
bottom = 0;
};
shortcuts[] = {};
textureNoShortcut = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {1,1,1,1};
colorFocused[] = {1,1,1,1};
color2[] = {0.95,0.95,0.95,1};
colorDisabled[] = {1,1,1,0.25};
colorBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
1
};
colorBackgroundFocused[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
1
};
colorBackground2[] = {1,1,1,1};
soundEnter[] =
{
"\A3\ui_f\data\sound\RscButton\soundEnter",
0.09,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
soundClick[] =
{
"\A3\ui_f\data\sound\RscButton\soundClick",
0.09,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButton\soundEscape",
0.09,
1
};
class Attributes
{
font = "RobotoCondensed";
color = "#E5E5E5";
align = "left";
shadow = "true";
};
idc = -1;
style = ST_LEFT;
default = 0;
shadow = 1;
w = 0.183825;
h = (GUI_GRID_HAbs / 20);
textSecondary = "";
colorSecondary[] = {1,1,1,1};
colorFocusedSecondary[] = {1,1,1,1};
color2Secondary[] = {0.95,0.95,0.95,1};
colorDisabledSecondary[] = {1,1,1,0.25};
sizeExSecondary = GUI_TEXT_SIZE_MEDIUM;
fontSecondary = "RobotoCondensed";
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\normal_ca.paa";
animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\over_ca.paa";
animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\focus_ca.paa";
animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButton\down_ca.paa";
periodFocus = 1.2;
periodOver = 0.8;
period = 0.4;
font = "RobotoCondensed";
size = GUI_TEXT_SIZE_MEDIUM;
sizeEx = GUI_TEXT_SIZE_MEDIUM;
text = "";
url = "";
action = "";
class AttributesImage
{
font = "RobotoCondensed";
color = "#E5E5E5";
align = "left";
};
};
class RscButtonSmall: RscButton
{
w = 0.12;
};
class RscEdit
{
deletable = 0;
fade = 0;
access = 0;
type = CT_EDIT;
x = 0;
y = 0;
h = 0.04;
w = 0.2;
colorBackground[] = {0,0,0,0};
colorText[] = {0.95,0.95,0.95,1};
colorDisabled[] = {1,1,1,0.25};
colorSelection[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
1
};
autocomplete = "";
text = "";
size = 0.2;
style = ST_FRAME;
font = "RobotoCondensed";
shadow = 2;
sizeEx = GUI_TEXT_SIZE_MEDIUM;
canModify = 1;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class RscCombo
{
deletable = 0;
fade = 0;
access = 0;
type = CT_COMBO;
colorSelect[] = {0,0,0,1};
colorText[] = {1,1,1,1};
colorBackground[] = {0,0,0,1};
colorScrollbar[] = {1,0,0,1};
colorDisabled[] = {1,1,1,0.25};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,0.25};
colorPictureRight[] = {1,1,1,1};
colorPictureRightSelected[] = {1,1,1,1};
colorPictureRightDisabled[] = {1,1,1,0.25};
colorTextRight[] = {1,1,1,1};
colorSelectRight[] = {0,0,0,1};
colorSelect2Right[] = {0,0,0,1};
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
soundSelect[] =
{
"\A3\ui_f\data\sound\RscCombo\soundSelect",
0.1,
1
};
soundExpand[] =
{
"\A3\ui_f\data\sound\RscCombo\soundExpand",
0.1,
1
};
soundCollapse[] =
{
"\A3\ui_f\data\sound\RscCombo\soundCollapse",
0.1,
1
};
maxHistoryDelay = 1;
class ComboScrollBar: ScrollBar
{
color[] = {1,1,1,1};
};
style = ST_MULTI + ST_NO_RECT;
font = "RobotoCondensed";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
shadow = 0;
x = 0;
y = 0;
w = 0.12;
h = 0.035;
colorSelectBackground[] = {1,1,1,0.7};
arrowEmpty = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_ca.paa";
arrowFull = "\A3\ui_f\data\GUI\RscCommon\rsccombo\arrow_combo_active_ca.paa";
wholeHeight = 0.45;
colorActive[] = {1,0,0,1};
};
class RscListBox
{
deletable = 0;
fade = 0;
access = 0;
type = CT_LISTBOX;
rowHeight = 0;
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
colorScrollbar[] = {1,0,0,0};
colorSelect[] = {0,0,0,1};
colorSelect2[] = {0,0,0,1};
colorSelectBackground[] = {0.95,0.95,0.95,1};
colorSelectBackground2[] = {1,1,1,0.5};
colorBackground[] = {0,0,0,0.3};
soundSelect[] =
{
"\A3\ui_f\data\sound\RscListbox\soundSelect",
0.09,
1
};
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,0.25};
colorPictureRight[] = {1,1,1,1};
colorPictureRightSelected[] = {1,1,1,1};
colorPictureRightDisabled[] = {1,1,1,0.25};
colorTextRight[] = {1,1,1,1};
colorSelectRight[] = {0,0,0,1};
colorSelect2Right[] = {0,0,0,1};
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
class ListScrollBar: ScrollBar
{
color[] = {1,1,1,1};
autoScrollEnabled = 1;
};
x = 0;
y = 0;
w = 0.3;
h = 0.3;
style = LB_TEXTURES;
font = "RobotoCondensed";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
shadow = 0;
colorShadow[] = {0,0,0,0.5};
period = 1.2;
maxHistoryDelay = 1;
};
class RscListNBox
{
deletable = 0;
fade = 0;
access = 0;
type = CT_LISTNBOX;
rowHeight = 0;
colorText[] = {1,1,1,1};
colorScrollbar[] = {0.95,0.95,0.95,1};
colorSelect[] = {0,0,0,1};
colorSelect2[] = {0,0,0,1};
colorSelectBackground[] = {0.95,0.95,0.95,1};
colorSelectBackground2[] = {1,1,1,0.5};
colorBackground[] = {0,0,0,1};
maxHistoryDelay = 1;
soundSelect[] =
{
"",
0.1,
1
};
autoScrollSpeed = -1;
autoScrollDelay = 5;
autoScrollRewind = 0;
arrowEmpty = "#(argb,8,8,3)color(1,1,1,1)";
arrowFull = "#(argb,8,8,3)color(1,1,1,1)";
drawSideArrows = 0;
columns[] = {0.3,0.6,0.7};
idcLeft = -1;
idcRight = -1;
class ListScrollBar: ScrollBar
{
};
style = ST_MULTI;
shadow = 0;
font = "RobotoCondensed";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
color[] = {0.95,0.95,0.95,1};
colorDisabled[] = {1,1,1,0.25};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,1};
period = 1.2;
x = 0;
y = 0;
w = 0.3;
h = 0.3;
class ScrollBar: ScrollBar
{
};
};
class RscXListBox
{
deletable = 0;
fade = 0;
idc = -1;
type = CT_XLISTBOX;
x = 0.1;
y = 0.1;
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
colorSelect[] = {0.95,0.95,0.95,1};
colorText[] = {1,1,1,1};
soundSelect[] =
{
"\A3\ui_f\data\sound\RscListbox\soundSelect",
0.09,
1
};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,0.25};
colorPictureRight[] = {1,1,1,1};
colorPictureRightSelected[] = {1,1,1,1};
colorPictureRightDisabled[] = {1,1,1,0.25};
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
style = ST_CENTER + LB_TEXTURES + SL_HORZ;
shadow = 2;
arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";
border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";
w = 0.14706;
h = 0.039216;
font = "RobotoCondensed";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
};
class RscTree
{
deletable = 0;
fade = 0;
access = 0;
type = CT_TREE;
colorBackground[] = {0,0,0,0};
colorSelect[] = {1,1,1,0.7};
colorDisabled[] = {1,1,1,0.25};
colorText[] = {1,1,1,1};
colorSelectText[] = {0,0,0,1};
colorBorder[] = {0,0,0,0};
colorSearch[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
"(profilenamespace getvariable ['GUI_BCG_RGB_A',0.8])"
};
colorMarked[] = {0.2,0.3,0.7,1};
colorMarkedText[] = {0,0,0,1};
colorMarkedSelected[] = {0,0.5,0.5,1};
multiselectEnabled = 0;
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {0,0,0,1};
colorPictureDisabled[] = {1,1,1,0.25};
colorPictureRight[] = {1,1,1,1};
colorPictureRightSelected[] = {0,0,0,1};
colorPictureRightDisabled[] = {1,1,1,0.25};
colorArrow[] = {1,1,1,1};
maxHistoryDelay = 1;
shadow = 0;
style = ST_LEFT;
font = "RobotoCondensed";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
expandedTexture = "A3\ui_f\data\gui\rsccommon\rsctree\expandedTexture_ca.paa";
hiddenTexture = "A3\ui_f\data\gui\rsccommon\rsctree\hiddenTexture_ca.paa";
x = 0;
y = 0;
w = 0.1;
h = 0.2;
rowHeight = 0.0439091;
colorSelectBackground[] = {0,0,0,0.5};
colorLines[] = {0,0,0,0};
borderSize = 0;
expandOnDoubleclick = 1;
class ScrollBar: ScrollBar
{
};
};
class RscSlider
{
deletable = 0;
fade = 0;
access = 0;
type = CT_SLIDER;
style = SL_HORZ;
color[] = {1,1,1,0.8};
colorActive[] = {1,1,1,1};
shadow = 0;
x = 0;
y = 0;
w = 0.3;
h = 0.025;
};
class RscSliderH: RscSlider
{
};
class RscXSliderH
{
deletable = 0;
fade = 0;
type = CT_XSLIDER;
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisable[] = {1,1,1,0.4};
style = SL_TEXTURES + SL_HORZ;
shadow = 0;
x = 0;
y = 0;
h = 0.029412;
w = 0.4;
colorDisabled[] = {1,1,1,0.2};
arrowEmpty = "\A3\ui_f\data\gui\cfg\slider\arrowEmpty_ca.paa";
arrowFull = "\A3\ui_f\data\gui\cfg\slider\arrowFull_ca.paa";
border = "\A3\ui_f\data\gui\cfg\slider\border_ca.paa";
thumb = "\A3\ui_f\data\gui\cfg\slider\thumb_ca.paa";
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class RscActiveText
{
deletable = 0;
fade = 0;
access = 0;
type = CT_ACTIVETEXT;
style = ST_CENTER;
color[] = {0,0,0,1};
colorActive[] = {0.3,0.4,0,1};
colorDisabled[] = {1,1,1,0.25};
soundEnter[] =
{
"",
0.1,
1
};
soundPush[] =
{
"",
0.1,
1
};
soundClick[] =
{
"",
0.1,
1
};
soundEscape[] =
{
"",
0.1,
1
};
text = "";
default = 0;
idc = -1;
x = 0;
y = 0;
h = 0.035;
w = 0.035;
font = "RobotoCondensed";
shadow = 2;
sizeEx = GUI_TEXT_SIZE_MEDIUM;
url = "";
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
};
class RscStructuredText
{
deletable = 0;
fade = 0;
access = 0;
type = CT_STRUCTURED_TEXT;
idc = -1;
style = ST_LEFT;
colorText[] = {1,1,1,1};
class Attributes
{
font = "RobotoCondensed";
color = "#ffffff";
colorLink = "#D09B43";
align = "left";
shadow = 1;
};
x = 0;
y = 0;
h = 0.035;
w = 0.1;
text = "";
size = GUI_TEXT_SIZE_MEDIUM;
shadow = 1;
};
class RscControlsGroup
{
deletable = 0;
fade = 0;
class VScrollbar: ScrollBar
{
color[] = {1,1,1,1};
width = 0.021;
autoScrollEnabled = 1;
};
class HScrollbar: ScrollBar
{
color[] = {1,1,1,1};
height = 0.028;
};
class Controls
{
};
type = CT_CONTROLS_GROUP;
idc = -1;
x = 0;
y = 0;
w = 1;
h = 1;
shadow = 0;
style = ST_MULTI;
};
class RscBackgroundStripeTop: RscText
{
colorBackground[] = {0.1,0.1,0.1,1};
access = 0;
x = "safezoneX";
y = "safezoneY";
w = "safezoneW";
h = "0.125*safezoneH";
text = "";
};
class RscBackgroundStripeBottom: RscText
{
access = 0;
colorBackground[] = {0.1,0.1,0.1,1};
x = "safezoneX";
y = "safezoneY + safezoneH - 0.125*safezoneH";
w = "safezoneW";
h = "0.125*safezoneH";
text = "";
};
class RscToolbox
{
deletable = 0;
fade = 0;
access = 0;
type = CT_TOOLBOX;
style = ST_CENTER;
colorText[] = {0.95,0.95,0.95,1};
color[] = {0.95,0.95,0.95,1};
colorTextSelect[] = {0.95,0.95,0.95,1};
colorSelect[] = {0.95,0.95,0.95,1};
colorTextDisable[] = {0.4,0.4,0.4,1};
colorDisable[] = {0.4,0.4,0.4,1};
colorSelectedBg[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
0.5
};
shadow = 0;
strings[] =
{
"",
""
};
x = 0;
y = 0;
w = 0.3;
h = 0.025;
rows = 1;
columns = 2;
font = "RobotoCondensed";
sizeEx = GUI_TEXT_SIZE_SMALL;
};
class RscMapControl
{
deletable = 0;
fade = 0;
access = 0;
type = CT_MAP_MAIN;
idc = 51;
style = ST_MULTI + ST_TITLE_BAR;
colorBackground[] = {0.969,0.957,0.949,1};
colorOutside[] = {0,0,0,1};
colorText[] = {0,0,0,1};
font = "TahomaB";
sizeEx = 0.04;
colorSea[] = {0.467,0.631,0.851,0.5};
colorForest[] = {0.624,0.78,0.388,0.5};
colorRocks[] = {0,0,0,0.3};
colorCountlines[] = {0.572,0.354,0.188,0.25};
colorMainCountlines[] = {0.572,0.354,0.188,0.5};
colorCountlinesWater[] = {0.491,0.577,0.702,0.3};
colorMainCountlinesWater[] = {0.491,0.577,0.702,0.6};
colorForestBorder[] = {0,0,0,0};
colorRocksBorder[] = {0,0,0,0};
colorPowerLines[] = {0.1,0.1,0.1,1};
colorRailWay[] = {0.8,0.2,0,1};
colorNames[] = {0.1,0.1,0.1,0.9};
colorInactive[] = {1,1,1,0.5};
colorLevels[] = {0.286,0.177,0.094,0.5};
colorTracks[] = {0.84,0.76,0.65,0.15};
colorRoads[] = {0.7,0.7,0.7,1};
colorMainRoads[] = {0.9,0.5,0.3,1};
colorTracksFill[] = {0.84,0.76,0.65,1};
colorRoadsFill[] = {1,1,1,1};
colorMainRoadsFill[] = {1,0.6,0.4,1};
colorGrid[] = {0.1,0.1,0.1,0.6};
colorGridMap[] = {0.1,0.1,0.1,0.6};
stickX[] = {0.2,["Gamma",1,1.5]};
stickY[] = {0.2,["Gamma",1,1.5]};
class Legend
{
colorBackground[] = {1,1,1,0.5};
color[] = {0,0,0,1};
x = SafeZoneX + GUI_GRID_W;
y = SafeZoneY + safezoneH - 4.5 * GUI_GRID_H;
w = 10 * GUI_GRID_W;
h = 3.5 * GUI_GRID_H;
font = "RobotoCondensed";
sizeEx = GUI_TEXT_SIZE_SMALL;
};
class ActiveMarker
{
color[] = {0.3,0.1,0.9,1};
size = 50;
};
class Command
{
color[] = {1,1,1,1};
icon = "\a3\ui_f\data\map\mapcontrol\waypoint_ca.paa";
size = 18;
importance = 1;
coefMin = 1;
coefMax = 1;
};
class Task
{
taskNone = "#(argb,8,8,3)color(0,0,0,0)";
taskCreated = "#(argb,8,8,3)color(0,0,0,1)";
taskAssigned = "#(argb,8,8,3)color(1,1,1,1)";
taskSucceeded = "#(argb,8,8,3)color(0,1,0,1)";
taskFailed = "#(argb,8,8,3)color(1,0,0,1)";
taskCanceled = "#(argb,8,8,3)color(1,0.5,0,1)";
colorCreated[] = {1,1,1,1};
colorCanceled[] = {0.7,0.7,0.7,1};
colorDone[] = {0.7,1,0.3,1};
colorFailed[] = {1,0.3,0.2,1};
color[] =
{
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
icon = "\A3\ui_f\data\map\mapcontrol\taskIcon_CA.paa";
iconCreated = "\A3\ui_f\data\map\mapcontrol\taskIconCreated_CA.paa";
iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa";
iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa";
iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa";
size = 27;
importance = 1;
coefMin = 1;
coefMax = 1;
};
class CustomMark
{
color[] = {1,1,1,1};
icon = "\a3\ui_f\data\map\mapcontrol\custommark_ca.paa";
size = 18;
importance = 1;
coefMin = 1;
coefMax = 1;
};
class Tree
{
color[] = {0.45,0.64,0.33,0.4};
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
size = 12;
importance = "0.9 * 16 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class SmallTree
{
color[] = {0.45,0.64,0.33,0.4};
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
size = 12;
importance = "0.6 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Bush
{
color[] = {0.45,0.64,0.33,0.4};
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
size = "14/2";
importance = "0.2 * 14 * 0.05 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Church
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\church_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Chapel
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\Chapel_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Cross
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\Cross_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Rock
{
color[] = {0.1,0.1,0.1,0.8};
icon = "\A3\ui_f\data\map\mapcontrol\rock_ca.paa";
size = 12;
importance = "0.5 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Bunker
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa";
size = 14;
importance = "1.5 * 14 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Fortress
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa";
size = 16;
importance = "2 * 16 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class Fountain
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\fountain_ca.paa";
size = 11;
importance = "1 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
class ViewTower
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\viewtower_ca.paa";
size = 16;
importance = "2.5 * 16 * 0.05";
coefMin = 0.5;
coefMax = 4;
};
class Lighthouse
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\lighthouse_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Quay
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\quay_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Fuelstation
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\fuelstation_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Hospital
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\hospital_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class BusStop
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\busstop_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class LineMarker
{
textureComboBoxColor = "#(argb,8,8,3)color(1,1,1,1)";
lineWidthThin = 0.008;
lineWidthThick = 0.014;
lineDistanceMin = 3e-005;
lineLengthMin = 5;
};
class Transmitter
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\transmitter_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Stack
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\stack_ca.paa";
size = 16;
importance = "2 * 16 * 0.05";
coefMin = 0.4;
coefMax = 2;
};
class Ruin
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\ruin_ca.paa";
size = 16;
importance = "1.2 * 16 * 0.05";
coefMin = 1;
coefMax = 4;
};
class Tourism
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\tourism_ca.paa";
size = 16;
importance = "1 * 16 * 0.05";
coefMin = 0.7;
coefMax = 4;
};
class Watertower
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\watertower_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
};
class Waypoint
{
color[] = {1,1,1,1};
importance = 1;
coefMin = 1;
coefMax = 1;
icon = "\a3\ui_f\data\map\mapcontrol\waypoint_ca.paa";
size = 18;
};
class WaypointCompleted
{
color[] = {1,1,1,1};
importance = 1;
coefMin = 1;
coefMax = 1;
icon = "\a3\ui_f\data\map\mapcontrol\waypointcompleted_ca.paa";
size = 18;
};
moveOnEdges = 1;
x = "SafeZoneXAbs";
y = SafeZoneY + 1.5 * GUI_GRID_H;
w = "SafeZoneWAbs";
h = SafeZoneH - 1.5 * GUI_GRID_H;
shadow = 0;
ptsPerSquareSea = 5;
ptsPerSquareTxt = 20;
ptsPerSquareCLn = 10;
ptsPerSquareExp = 10;
ptsPerSquareCost = 10;
ptsPerSquareFor = 9;
ptsPerSquareForEdge = 9;
ptsPerSquareRoad = 6;
ptsPerSquareObj = 9;
showCountourInterval = 0;
scaleMin = 0.001;
scaleMax = 1;
scaleDefault = 0.16;
maxSatelliteAlpha = 0.85;
alphaFadeStartScale = 2;
alphaFadeEndScale = 2;
colorTrails[] = {0.84,0.76,0.65,0.15};
colorTrailsFill[] = {0.84,0.76,0.65,0.65};
fontLabel = "RobotoCondensed";
sizeExLabel = GUI_TEXT_SIZE_SMALL;
fontGrid = "TahomaB";
sizeExGrid = 0.02;
fontUnits = "TahomaB";
sizeExUnits = GUI_TEXT_SIZE_SMALL;
fontNames = "EtelkaNarrowMediumPro";
sizeExNames = GUI_TEXT_SIZE_SMALL * 2;
fontInfo = "RobotoCondensed";
sizeExInfo = GUI_TEXT_SIZE_SMALL;
fontLevel = "TahomaB";
sizeExLevel = 0.02;
text = "#(argb,8,8,3)color(1,1,1,1)";
idcMarkerColor = -1;
idcMarkerIcon = -1;
textureComboBoxColor = "#(argb,8,8,3)color(1,1,1,1)";
showMarkers = 1;
class power
{
icon = "\A3\ui_f\data\map\mapcontrol\power_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class powersolar
{
icon = "\A3\ui_f\data\map\mapcontrol\powersolar_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class powerwave
{
icon = "\A3\ui_f\data\map\mapcontrol\powerwave_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class powerwind
{
icon = "\A3\ui_f\data\map\mapcontrol\powerwind_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {1,1,1,1};
};
class Shipwreck
{
icon = "\A3\ui_f\data\map\mapcontrol\Shipwreck_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {0,0,0,1};
};
};
class RscCheckBox
{
idc = -1;
type = CT_CHECKBOX;
deletable = 0;
style = ST_LEFT;
checked = 0;
x = "0.375 * safezoneW + safezoneX";
y = "0.36 * safezoneH + safezoneY";
w = "0.025 * safezoneW";
h = "0.04 * safezoneH";
color[] = {1,1,1,0.7};
colorFocused[] = {1,1,1,1};
colorHover[] = {1,1,1,1};
colorPressed[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.2};
colorBackground[] = {0,0,0,0};
colorBackgroundFocused[] = {0,0,0,0};
colorBackgroundHover[] = {0,0,0,0};
colorBackgroundPressed[] = {0,0,0,0};
colorBackgroundDisabled[] = {0,0,0,0};
textureChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
textureUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
textureFocusedChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
textureFocusedUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
textureHoverChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
textureHoverUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
texturePressedChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
texturePressedUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
textureDisabledChecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_checked_ca.paa";
textureDisabledUnchecked = "A3\Ui_f\data\GUI\RscCommon\RscCheckBox\CheckBox_unchecked_ca.paa";
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
soundEnter[] =
{
"",
0.1,
1
};
soundPush[] =
{
"",
0.1,
1
};
soundClick[] =
{
"",
0.1,
1
};
soundEscape[] =
{
"",
0.1,
1
};
};
class RscIGText: RscText
{
access = 0;
h = 0.04;
colorText[] = {0.8,0.8,0.8,1};
font = "TahomaB";
sizeEx = 0.024;
style = ST_SHADOW;
};
class RscIGProgress: RscProgress
{
colorFrame[] = {0.706,0.098,0.9294,0};
colorBar[] =
{
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
style = ST_VERTICAL;
w = 0.009;
h = 0.178;
texture = "#(argb,8,8,3)color(1,1,1,1)";
};
class RscListBoxKeys: RscListBox
{
collisionColor[] =
{
"(profilenamespace getvariable ['IGUI_ERROR_RGB_R',0.8])",
"(profilenamespace getvariable ['IGUI_ERROR_RGB_G',0.0])",
"(profilenamespace getvariable ['IGUI_ERROR_RGB_B',0.0])",
1
};
collisionColorFirstKey[] =
{
"(profilenamespace getvariable ['IGUI_WARNING_RGB_R',0.8])",
"(profilenamespace getvariable ['IGUI_WARNING_RGB_G',0.5])",
"(profilenamespace getvariable ['IGUI_WARNING_RGB_B',0.0])",
1
};
disabledKeyColor[] = {0.4,0.4,0.4,1};
mainCollumW = 0.4;
secndCollumW = 0.6;
};
class RscControlsGroupNoScrollbars: RscControlsGroup
{
class VScrollbar: VScrollbar
{
width = 0;
};
class HScrollbar: HScrollbar
{
height = 0;
};
};
class RscControlsGroupNoHScrollbars: RscControlsGroup
{
class HScrollbar: HScrollbar
{
height = 0;
};
};
class RscControlsGroupNoVScrollbars: RscControlsGroup
{
class VScrollbar: VScrollbar
{
width = 0;
};
};
class RscLine: RscText
{
idc = -1;
style = ST_MULTI + ST_TITLE_BAR + ST_HUD_BACKGROUND;
x = 0.17;
y = 0.48;
w = 0.66;
h = 0;
text = "";
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
};
class RscActivePicture: RscActiveText
{
style = ST_MULTI + ST_TITLE_BAR;
color[] = {1,1,1,0.5};
colorActive[] = {1,1,1,1};
};
class RscButtonTextOnly: RscButton
{
SizeEx = GUI_TEXT_SIZE_SMALL;
colorBackground[] = {1,1,1,0};
colorBackgroundActive[] = {1,1,1,0};
colorBackgroundDisabled[] = {1,1,1,0};
colorFocused[] = {1,1,1,0};
colorShadow[] = {1,1,1,0};
borderSize = 0;
};
class RscShortcutButtonMain: RscShortcutButton
{
idc = -1;
style = ST_LEFT;
default = 0;
w = 0.313726;
h = 0.104575;
color[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
class HitZone
{
left = 0;
top = 0;
right = 0;
bottom = 0;
};
class ShortcutPos
{
left = 0.0145;
top = ((GUI_GRID_HAbs / 20) - GUI_TEXT_SIZE_LARGE) / 2;
w = GUI_TEXT_SIZE_LARGE * (3/4);
h = GUI_TEXT_SIZE_LARGE;
};
class TextPos
{
left = (GUI_GRID_WAbs / 32) * 1.5;
top = ((GUI_GRID_HAbs / 20)*2 - GUI_TEXT_SIZE_LARGE) / 2;
right = 0.005;
bottom = 0;
};
animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa";
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\disabled_ca.paa";
animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\over_ca.paa";
animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\focus_ca.paa";
animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\down_ca.paa";
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscShortcutButtonMain\normal_ca.paa";
period = 0.5;
font = "RobotoCondensed";
size = GUI_TEXT_SIZE_LARGE;
sizeEx = GUI_TEXT_SIZE_LARGE;
text = "";
action = "";
class Attributes
{
font = "RobotoCondensed";
color = "#E5E5E5";
align = "left";
shadow = "false";
};
class AttributesImage
{
font = "RobotoCondensed";
color = "#E5E5E5";
align = "false";
};
};
class RscButtonEditor: RscShortcutButton
{
class ShortcutPos
{
left = 0;
top = 0;
w = 0;
h = 0;
};
class TextPos
{
left = 0;
top = ((GUI_GRID_HAbs / 20) - GUI_TEXT_SIZE_MEDIUM) / 2;
right = 0;
bottom = 0;
};
};
class RscIGUIShortcutButton: RscShortcutButton
{
w = 0.183825;
h = "0.0522876 * 0.7";
style = ST_CENTER;
class HitZone
{
left = 0.002;
top = "0.003 * 0.7";
right = 0.002;
bottom = "0.016 * 0.7";
};
class ShortcutPos
{
left = -0.006;
top = "-0.007 * 0.7";
w = 0;
h = "0.0522876 * 0.7";
};
class TextPos
{
left = 0;
top = "0.000 * 0.7";
right = 0;
bottom = "0.016 * 0.7";
};
class Attributes
{
font = "RobotoCondensed";
color = "#E5E5E5";
align = "center";
shadow = "true";
};
};
class RscGearShortcutButton: RscShortcutButton
{
w = 0.0392157;
h = 0.0522876;
style = ST_CENTER;
color[] = {1,1,1,1};
color2[] = {1,1,1,0.85};
colorBackground[] = {1,1,1,1};
colorbackground2[] = {1,1,1,0.85};
colorDisabled[] = {1,1,1,0.4};
class HitZone
{
left = 0;
top = 0;
right = 0;
bottom = 0;
};
class ShortcutPos
{
left = -0.006;
top = -0.007;
w = 0.0392157;
h = 0.0522876;
};
class TextPos
{
left = 0.003;
top = 0.001;
right = 0;
bottom = 0;
};
sizeEx = 0.1;
animTextureNormal = "\A3\ui_f\data\GUI\RscCommon\RscGearShortcutButton\normal_ca.paa";
animTextureDisabled = "\A3\ui_f\data\GUI\RscCommon\RscGearShortcutButton\disabled_ca.paa";
animTextureOver = "\A3\ui_f\data\GUI\RscCommon\RscGearShortcutButton\over_ca.paa";
animTextureFocused = "\A3\ui_f\data\GUI\RscCommon\RscGearShortcutButton\focus_ca.paa";
animTexturePressed = "\A3\ui_f\data\GUI\RscCommon\RscGearShortcutButton\down_ca.paa";
animTextureDefault = "\A3\ui_f\data\GUI\RscCommon\RscGearShortcutButton\normal_ca.paa";
class Attributes
{
font = "RobotoCondensed";
color = "#E5E5E5";
align = "center";
shadow = "false";
};
};
class RscButtonMenu: RscShortcutButton
{
idc = -1;
type = CT_SHORTCUTBUTTON;
style = ST_CENTER + ST_FRAME + ST_HUD_BACKGROUND;
default = 0;
shadow = 0;
x = 0;
y = 0;
w = 0.095589;
h = 0.039216;
animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
colorBackground[] = {0,0,0,0.8};
colorBackgroundFocused[] = {1,1,1,1};
colorBackground2[] = {0.75,0.75,0.75,1};
color[] = {1,1,1,1};
colorFocused[] = {0,0,0,1};
color2[] = {0,0,0,1};
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
textSecondary = "";
colorSecondary[] = {1,1,1,1};
colorFocusedSecondary[] = {0,0,0,1};
color2Secondary[] = {0,0,0,1};
colorDisabledSecondary[] = {1,1,1,0.25};
sizeExSecondary = GUI_TEXT_SIZE_MEDIUM;
fontSecondary = "PuristaLight";
period = 1.2;
periodFocus = 1.2;
periodOver = 1.2;
size = GUI_TEXT_SIZE_MEDIUM;
sizeEx = GUI_TEXT_SIZE_MEDIUM;
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {1,1,1,1};
tooltipColorShade[] = {0,0,0,0.65};
class TextPos
{
left = 0.25 * GUI_GRID_W;
top = (GUI_GRID_H - GUI_TEXT_SIZE_MEDIUM) / 2;
right = 0.005;
bottom = 0;
};
class Attributes
{
font = "PuristaLight";
color = "#E5E5E5";
align = "left";
shadow = "false";
};
class ShortcutPos
{
left = 5.25 * GUI_GRID_W;
top = 0;
w = 1 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
};
soundEnter[] =
{
"\A3\ui_f\data\sound\RscButtonMenu\soundEnter",
0.09,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButtonMenu\soundPush",
0.09,
1
};
soundClick[] =
{
"\A3\ui_f\data\sound\RscButtonMenu\soundClick",
0.09,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButtonMenu\soundEscape",
0.09,
1
};
};
class RscButtonMenuOK: RscButtonMenu
{
idc = 1;
shortcuts[] =
{
"0x00050000 + 0",
28,
57,
156
};
default = 1;
text = "OK";
soundPush[] =
{
"\A3\ui_f\data\sound\RscButtonMenuOK\soundPush",
0.09,
1
};
};
class RscButtonMenuCancel: RscButtonMenu
{
idc = 2;
shortcuts[] =
{
"0x00050000 + 1"
};
text = "Cancel";
};
class RscButtonMenuSteam: RscButtonMenu
{
colorBackground[] = {0.0313726,0.721569,0.917647,1};
textureNoShortcut = "\A3\Ui_f\data\GUI\RscCommon\RscButtonMenuSteam\steam_ca.paa";
class TextPos
{
left = 0.0325;
top = (GUI_GRID_H - GUI_TEXT_SIZE_MEDIUM) / 2;
right = 0.005;
bottom = 0;
};
class ShortcutPos
{
left = 0.005;
top = 0.005;
w = 0.0225;
h = 0.03;
};
};
class RscLoadingText: RscText
{
style = ST_CENTER;
x = 0.29412;
y = 0.666672;
w = 0.411768;
h = 0.039216;
sizeEx = GUI_TEXT_SIZE_MEDIUM;
colorText[] = {1,1,1,1};
};
class RscIGUIListBox: RscListBox
{
color[] = {1,1,1,1};
colorText[] = {1,1,1,1};
colorScrollbar[] = {0.95,0.95,0.95,1};
colorSelect[] = {0.95,0.95,0.95,1};
colorSelect2[] = {0.95,0.95,0.95,1};
colorSelectBackground[] = {0,0,0,0.4};
colorSelectBackground2[] = {0,0,0,1};
period = 0;
colorBackground[] = {0,0,0,0};
sizeEx = GUI_TEXT_SIZE_SMALL;
class ScrollBar: ScrollBar
{
};
};
class RscIGUIListNBox: RscListNBox
{
style = ST_MULTI;
shadow = 2;
color[] = {1,1,1,1};
colorText[] = {1,1,1,0.75};
colorScrollbar[] = {0.95,0.95,0.95,1};
colorSelect[] = {0.95,0.95,0.95,1};
colorSelect2[] = {0.95,0.95,0.95,1};
colorSelectBackground[] = {1,1,1,1};
colorSelectBackground2[] = {1,1,1,1};
period = 0;
colorBackground[] = {0,0,0,1};
columns[] = {0.1,0.7,0.1,0.1};
class ScrollBar: ScrollBar
{
};
};
class RscFrame
{
type = CT_STATIC;
idc = -1;
deletable = 0;
style = ST_FRAME;
shadow = 2;
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
font = "RobotoCondensed";
sizeEx = 0.02;
text = "";
x = 0;
y = 0;
w = 0.3;
h = 0.3;
};
class RscBackground: RscText
{
type = CT_STATIC;
IDC = -1;
style = ST_NO_RECT;
shadow = 0;
x = 0;
y = 0;
w = 1;
h = 1;
text = "";
ColorBackground[] = {0.48,0.5,0.35,1};
ColorText[] = {0.1,0.1,0.1,1};
font = "RobotoCondensed";
SizeEx = 1;
};
class RscBackgroundGUI: RscText
{
colorBackground[] = {0,0,0,0.5};
colorText[] = {1,1,1,1};
background = 1;
};
class RscBackgroundGUILeft: RscPicture
{
text = "A3\ui_f\data\gui\rsccommon\rscbackgroundgui\gradient_left_gs.paa";
colorText[] =
{
1,
1,
1,
"0.3*0"
};
colorBackground[] = {0,0,0,0};
background = 1;
};
class RscBackgroundGUIRight: RscPicture
{
text = "A3\ui_f\data\gui\rsccommon\rscbackgroundgui\gradient_right_gs.paa";
colorText[] =
{
0,
0,
0,
"0.4*0"
};
colorBackground[] = {0,0,0,0};
background = 1;
};
class RscBackgroundGUIBottom: RscPicture
{
colorText[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.13])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.54])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.21])",
0.8
};
text = "A3\ui_f\data\gui\rsccommon\rscshortcutbutton\background_ca.paa";
align = "bottom";
background = 1;
};
class RscBackgroundGUITop: RscText
{
colorBackground[] = {0,0,0,1};
align = "top";
moving = 1;
background = 1;
};
class RscBackgroundGUIDark: RscText
{
colorBackground[] = {0,0,0,0.2};
background = 1;
};
class RscBackgroundLogo: RscPictureKeepAspect
{
text = "\A3\Ui_f\data\Logos\arma3_splash_ca.paa";
align = "top";
background = 1;
x = safezoneX + safezoneW - (9 * (GUI_GRID_WAbs / 32));
y = safezoneY - 2 * (GUI_GRID_HAbs / 20);
w = (8 * (GUI_GRID_WAbs / 32));
h = (8 * (GUI_GRID_HAbs / 20));
};
class RscMapControlEmpty: RscMapControl
{
type = CT_MAP_MAIN;
ptsPerSquareSea = 1000;
ptsPerSquareTxt = 1000;
ptsPerSquareCLn = 1000;
ptsPerSquareExp = 1000;
ptsPerSquareCost = 1000;
ptsPerSquareFor = 1000;
ptsPerSquareForEdge = 1000;
ptsPerSquareRoad = 1000;
ptsPerSquareObj = 1000;
alphaFadeStartScale = 0;
alphaFadeEndScale = 0;
colorBackground[] = {1,1,1,1};
colorOutside[] = {1,1,1,1};
colorSea[] = {0,0,0,0};
colorForest[] = {0,0,0,0};
colorForestBorder[] = {0,0,0,0};
colorRocks[] = {0,0,0,0};
colorRocksBorder[] = {0,0,0,0};
colorLevels[] = {0,0,0,0};
colorMainCountlines[] = {0,0,0,0};
colorCountlines[] = {0,0,0,0};
colorMainCountlinesWater[] = {0,0,0,0};
colorCountlinesWater[] = {0,0,0,0};
colorPowerLines[] = {0,0,0,0};
colorRailWay[] = {0,0,0,0};
colorNames[] = {0,0,0,0};
colorInactive[] = {0,0,0,0};
colorGrid[] = {0,0,0,0};
colorGridMap[] = {0,0,0,0};
class Task: Task
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
iconCreated = "#(argb,8,8,3)color(0,0,0,0)";
iconCanceled = "#(argb,8,8,3)color(0,0,0,0)";
iconDone = "#(argb,8,8,3)color(0,0,0,0)";
iconFailed = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
colorCreated[] = {0,0,0,0};
colorCanceled[] = {0,0,0,0};
colorDone[] = {0,0,0,0};
colorFailed[] = {0,0,0,0};
size = 0;
};
class Waypoint: Waypoint
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class WaypointCompleted: WaypointCompleted
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class CustomMark: CustomMark
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Command: Command
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Bush: Bush
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Rock: Rock
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class SmallTree: SmallTree
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Tree: Tree
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class busstop: BusStop
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class fuelstation: Fuelstation
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class hospital: Hospital
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class church: Church
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class lighthouse: Lighthouse
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class power: power
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class powersolar: powersolar
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class powerwave: powerwave
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class powerwind: powerwind
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class quay: Quay
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class shipwreck: Shipwreck
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class transmitter: Transmitter
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class watertower: Watertower
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Bunker: Bunker
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Cross: Cross
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Fortress: Fortress
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Fountain: Fountain
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Chapel: Chapel
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Ruin: Ruin
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Stack: Stack
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Tourism: Tourism
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class ViewTower: ViewTower
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
};
class RscVignette: RscPicture
{
x = "safezoneXAbs";
y = "safezoneY";
w = "safezoneWAbs";
h = "safezoneH";
text = "\A3\ui_f\data\gui\rsccommon\rscvignette\vignette_gs.paa";
colortext[] = {0,0,0,0.3};
};
class CA_Mainback: RscPicture
{
x = 0.35;
y = 0.8;
w = 0.3;
h = 0.2;
text = "#(argb,8,8,3)color(0,0,0,0.5)";
colorText[] =
{
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
};
class CA_Back: CA_Mainback
{
x = 0.29;
y = 0.38;
w = 0.56;
h = 0.57;
colorText[] =
{
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
text = "#(argb,8,8,3)color(0,0,0,0.5)";
};
class CA_Title_Back: CA_Mainback
{
x = 0.014706;
y = 0;
w = 0.950743;
h = 0.058824;
text = "#(argb,8,8,3)color(0,0,0,0)";
colorText[] = {0.95,0.95,0.95,1};
};
class CA_Black_Back: CA_Mainback
{
x = "SafeZoneX - SafeZoneW";
y = "SafeZoneY - SafeZoneH";
w = "SafeZoneW * 4";
h = "SafeZoneH * 4";
text = "#(argb,8,8,3)color(0,0,0,1)";
colorText[] = {0,0,0,1};
color[] = {0,0,0,1};
colorBackground[] = {0,0,0,1};
};
class CA_Title: RscTitle
{
};
class CA_Logo: RscPictureKeepAspect
{
idc = 1220;
x = 0.638;
y = 0.333;
w = 0.25;
h = 0.08;
text = "#(argb,8,8,3)color(1,1,1,1)";
};
class CA_Logo_Small: CA_Logo
{
w = 0.2;
h = 0.0666;
};
class CA_RscButton: RscButton
{
idc = -1;
default = 0;
x = 0.843144;
y = 0.8;
w = 0.14706;
h = 0.039216;
borderSize = 0.009804;
color[] = {0,0,0,0};
colorActive[] = {0,0,0,0};
};
class CA_RscButton_dialog: CA_RscButton
{
x = 0.823536;
y = 0.85;
w = 0.198531;
borderSize = 0;
};
class CA_Ok: RscActiveText
{
idc = -1;
style = ST_MULTI + ST_TITLE_BAR;
default = 0;
x = 0.85;
y = 0.8;
w = 0.15;
h = 0.035;
text = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
colorActive[] = {0,0,0,0};
};
class CA_Ok_image: RscText
{
idc = -1;
x = 0.86;
y = 0.8;
w = 0.14;
h = 0.04;
text = "#(argb,8,8,3)color(1,1,1,0.9)";
style = ST_MULTI + ST_TITLE_BAR;
colortext[] = {1,1,1,0.8};
};
class CA_Ok_image2: RscText
{
idc = -1;
x = 0.85;
y = 0.8;
w = 0.01;
h = 0.04;
text = "#(argb,8,8,3)color(1,1,1,0.9)";
style = ST_MULTI + ST_TITLE_BAR;
colortext[] = {0,0,0,0.8};
};
class CA_Ok_text: RscText
{
sizeEx = GUI_TEXT_SIZE_SMALL;
idc = -1;
x = 0.86;
y = 0.8;
w = 0.14;
h = 0.04;
style = ST_LEFT;
colortext[] = {0,0,0,0.8};
};
class RscTextMulti: RscText
{
style = ST_MULTI;
};
class RscTreeSearch: RscTree
{
idcSearch = 645;
};
class RscVideo: RscPicture
{
autoplay = 1;
loops = 1;
};
class RscVideoKeepAspect: RscPictureKeepAspect
{
autoplay = 1;
loops = 1;
};
class RscActivePictureKeepAspect: RscActivePicture
{
style = ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
};
class RscEditMulti: RscEdit
{
style = ST_MULTI;
};
class RscMapSignalBackground: RscText
{
x = 12.5 * GUI_GRID_W + (safezoneX + (safezoneW - GUI_GRID_WAbs)/2);
y = 10 * GUI_GRID_H + (safezoneY + (safezoneH - GUI_GRID_HAbs)/2);
w = 15.5 * GUI_GRID_W;
h = 5 * GUI_GRID_H;
colorBackground[] = {0.1,0.1,0.1,0.8};
};
class RscMapSignalPicture: RscPicture
{
colorText[] =
{
"(profilenamespace getvariable ['IGUI_WARNING_RGB_R',0.8])",
"(profilenamespace getvariable ['IGUI_WARNING_RGB_G',0.5])",
"(profilenamespace getvariable ['IGUI_WARNING_RGB_B',0.0])",
"(profilenamespace getvariable ['IGUI_WARNING_RGB_A',0.8])"
};
text = "\A3\ui_f\data\map\diary\signal_ca.paa";
x = 19 * GUI_GRID_W + (safezoneX + (safezoneW - GUI_GRID_WAbs)/2);
y = 10.5 * GUI_GRID_H + (safezoneY + (safezoneH - GUI_GRID_HAbs)/2);
w = 2 * GUI_GRID_W;
h = 2 * GUI_GRID_H;
};
class RscMapSignalText: RscText
{
style = ST_CENTER;
colorText[] =
{
"(profilenamespace getvariable ['IGUI_WARNING_RGB_R',0.8])",
"(profilenamespace getvariable ['IGUI_WARNING_RGB_G',0.5])",
"(profilenamespace getvariable ['IGUI_WARNING_RGB_B',0.0])",
"(profilenamespace getvariable ['IGUI_WARNING_RGB_A',0.8])"
};
text = "Cannot connect to the positioning system.";
x = 13 * GUI_GRID_W + (safezoneX + (safezoneW - GUI_GRID_WAbs)/2);
y = 13.5 * GUI_GRID_H + (safezoneY + (safezoneH - GUI_GRID_HAbs)/2);
w = 14.5 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
sizeEx = 0.8 * GUI_GRID_H;
};
class RscColorPicker: RscControlsGroupNoScrollbars
{
idc = 2351;
x = -1;
y = -1;
w = 0;
h = 0;
class controls
{
};
};
class RscInterlacingScreen: RscPicture
{
text = "a3\ui_f\data\igui\rsctitles\interlacing\interlacing_ca.paa";
x = "safeZoneX";
y = "safeZoneY";
w = "safeZoneW";
h = "safeZoneH";
};
class RscFeedback: RscHTML
{
idc = 6455;
x = 1 * GUI_GRID_W + GUI_GRID_X;
y = "safezoneY";
w = 15 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
colorBackground[] = {0.67451,0.290196,0.290196,1};
colorLink[] = {1,1,1,1};
colorLinkActive[] = {1,1,1,1};
shadow = 0;
class P
{
font = "RobotoCondensedBold";
fontBold = "RobotoCondensedBold";
sizeEx = GUI_TEXT_SIZE_MEDIUM;
align = "center";
};
};
class RscTrafficLight: RscActiveText
{
style = ST_MULTI + ST_TITLE_BAR;
color[] = {1,1,1,0.7};
colorText[] = {1,1,1,0.7};
colorActive[] = {1,1,1,1};
text = "\A3\Ui_f\data\GUI\RscCommon\RscTrafficLight\TrafficLight_ca.paa";
tooltip = "You are running a modded version of the game. Click to see the list of active mods.";
x = SafezoneX + SafezoneW - (2 * GUI_GRID_W);
y = 23 * GUI_GRID_H + GUI_GRID_Y;
w = 1 * GUI_GRID_W;
h = 1 * GUI_GRID_H;
};
class RscButtonSearch: RscButton
{
idc = 646;
style = ST_CENTER + ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
text = "\a3\Ui_f\data\GUI\RscCommon\RscButtonSearch\search_start_ca.paa";
textSearch = "\a3\Ui_f\data\GUI\RscCommon\RscButtonSearch\search_end_ca.paa";
tooltip = "Search";
onButtonClick = "_display = ctrlparent (_this select 0);_ctrlSearch = _display displayctrl 645;_ctrlSearch ctrlsettext '';ctrlsetfocus _ctrlSearch;";
};
class RscIGUIText: RscText
{
sizeEx = GUI_TEXT_SIZE_SMALL;
colorText[] =
{
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
style = ST_LEFT;
};
class RscOpticsText: RscText
{
sizeEx = 0.048;
colorText[] = {0.95,0.95,0.95,1};
style = ST_LEFT;
h = 0.048;
};
class RscOpticsValue: RscOpticsText
{
fixedWidth = 1;
};
class RscIGUIValue: RscIGUIText
{
sizeEx = GUI_TEXT_SIZE_SMALL;
colorText[] =
{
"(profilenamespace getvariable ['IGUI_TEXT_RGB_R',0])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_G',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_B',1])",
"(profilenamespace getvariable ['IGUI_TEXT_RGB_A',0.8])"
};
style = ST_LEFT;
};
class RscButtonMenuMain: RscButtonMenu
{
size = "(pixelH * pixelGrid * 2)";
style = ST_FRAME + ST_HUD_BACKGROUND;
colorBackground[] = {1,1,1,0.75};
colorBackgroundFocused[] = {1,1,1,1};
colorBackground2[] = {1,1,1,1};
class Attributes
{
align = "left";
color = "#ffffff";
font = "PuristaLight";
};
class TextPos
{
left = "0.1 * 1.5 * (pixelW * pixelGrid * 2)";
top = "0.1 * 1.5 * (pixelH * pixelGrid * 2)";
right = "0.1 * 1.5 * (pixelW * pixelGrid * 2)";
bottom = "0.1 * 1.5 * (pixelH * pixelGrid * 2)";
};
animTextureNormal = "#(argb,8,8,3)color(0,0,0,1)";
animTextureDisabled = "#(argb,8,8,3)color(0,0,0,1)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(0,0,0,1)";
animTextureDefault = "#(argb,8,8,3)color(0,0,0,1)";
};
class RscButtonTestCentered: RscButton
{
style = ST_CENTER + ST_MULTI;
text = "Line 1\nLine 2";
shadow = 1;
x = 0;
y = 0;
w = "10 * (pixelW * pixelGrid * 2)";
h = "10 * (pixelH * pixelGrid * 2)";
};
class RscDisplaySingleMission_ChallengeOverviewGroup: RscControlsGroupNoHScrollbars
{
idc = 2302;
x = 17 * GUI_GRID_W + (safezoneX + (safezoneW - GUI_GRID_WAbs)/2);
y = SafezoneY + (18.4 * GUI_GRID_H) + (0.5 * (safezoneH - GUI_GRID_HAbs));
w = 22 * GUI_GRID_W;
h = 3.5 * GUI_GRID_H + (0.5 * (safezoneH - GUI_GRID_HAbs));
class controls
{
};
};
class RscDisplayDebriefing_RscTextMultiline: RscText
{
style = ST_MULTI + ST_NO_RECT;
};
class RscDisplayDebriefing_ListGroup: RscControlsGroupNoHScrollbars
{
idc = 21903;
x = 2.2 * GUI_GRID_W + (safezoneX + (safezoneW - GUI_GRID_WAbs)/2);
y = 8.9 * GUI_GRID_H + (safezoneY + (safezoneH - GUI_GRID_HAbs)/2);
w = 36.8 * GUI_GRID_W;
h = 12.2 * GUI_GRID_H;
class controls
{
};
};
class RscButtonArsenal: RscButton
{
style = ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
colorBackground[] = {0,0,0,0.8};
colorDisabled[] = {1,1,1,1};
};
class RscTextNoShadow: RscText
{
style = ST_CENTER;
shadow = 0;
};
class RscButtonNoColor: RscButton
{
colorBackground[] = {0,0,0,0};
colorText[] = {0,0,0,0};
colorBackgroundActive[] = {0,0,0,0};
colorFocused[] = {0,0,0,0};
text = "";
soundEnter[] =
{
"\A3\ui_f\data\sound\ReadOut\readoutClick",
0.5,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
soundClick[] =
{
"\A3\ui_f\data\sound\CfgNotifications\addItemOK",
0.5,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
};
class RscToolboxButton: RscToolbox
{
font = "RobotoCondensedLight";
color[] = {1,1,1,1};
colorTextSelect[] = {0,0,0,1};
colorSelectedBg[] = {1,1,1,1};
};
class ctrlDefault
{
access = 0;
idc = -1;
style = ST_LEFT;
default = 0;
show = 1;
fade = 0;
blinkingPeriod = 0;
deletable = 0;
x = 0;
y = 0;
w = 0;
h = 0;
tooltip = "";
tooltipMaxWidth = 0.5;
tooltipColorShade[] = {0,0,0,1};
tooltipColorText[] = {1,1,1,1};
tooltipColorBox[] = {0,0,0,0};
class ScrollBar
{
width = 0;
height = 0;
scrollSpeed = 0.06;
arrowEmpty = "\a3\3DEN\Data\Controls\ctrlDefault\arrowEmpty_ca.paa";
arrowFull = "\a3\3DEN\Data\Controls\ctrlDefault\arrowFull_ca.paa";
border = "\a3\3DEN\Data\Controls\ctrlDefault\border_ca.paa";
thumb = "\a3\3DEN\Data\Controls\ctrlDefault\thumb_ca.paa";
color[] = {1,1,1,1};
};
};
class ctrlDefaultText: ctrlDefault
{
sizeEx = "4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
font = "RobotoCondensedLight";
shadow = 1;
};
class ctrlDefaultButton: ctrlDefaultText
{
soundClick[] =
{
"\A3\ui_f\data\sound\RscButton\soundClick",
0.09,
1
};
soundEnter[] =
{
"\A3\ui_f\data\sound\RscButton\soundEnter",
0.09,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButton\soundEscape",
0.09,
1
};
};
class ctrlStatic: ctrlDefaultText
{
type = CT_STATIC;
colorBackground[] = {0,0,0,0};
text = "";
lineSpacing = 1;
fixedWidth = 0;
colorText[] = {1,1,1,1};
colorShadow[] = {0,0,0,1};
moving = 0;
autoplay = 0;
loops = 0;
tileW = 1;
tileH = 1;
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onVideoStopped = "";
};
class ctrlStaticPicture: ctrlStatic
{
style = ST_MULTI + ST_TITLE_BAR;
};
class ctrlStaticPictureKeepAspect: ctrlStaticPicture
{
style = ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
};
class ctrlStaticPictureTile: ctrlStatic
{
style = ST_MULTI + ST_HUD_BACKGROUND;
};
class ctrlStaticFrame: ctrlStatic
{
style = ST_FRAME;
};
class ctrlStaticLine: ctrlStatic
{
style = ST_MULTI + ST_TITLE_BAR + ST_HUD_BACKGROUND;
};
class ctrlStaticMulti: ctrlStatic
{
style = ST_MULTI + ST_NO_RECT;
};
class ctrlStaticBackground: ctrlStatic
{
colorBackground[] = {0.2,0.2,0.2,1};
};
class ctrlStaticOverlay: ctrlStatic
{
colorBackground[] = {0,0,0,0.5};
};
class ctrlStaticTitle: ctrlStatic
{
moving = 1;
colorBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorText[] = {1,1,1,1};
};
class ctrlStaticFooter: ctrlStatic
{
colorBackground[] = {0,0,0,0.3};
};
class ctrlStaticBackgroundDisable: ctrlStatic
{
x = -4;
y = -2;
w = 8;
h = 4;
colorBackground[] = {1,1,1,0.5};
};
class ctrlStaticBackgroundDisableTiles: ctrlStaticPictureTile
{
x = -4;
y = -2;
w = 8;
h = 4;
text = "\a3\3DEN\Data\Displays\Display3DENEditAttributes\backgroundDisable_ca.paa";
tileW = "8 / (32 * pixelW)";
tileH = "4 / (32 * pixelH)";
colorText[] = {1,1,1,0.05};
};
class ctrlButton: ctrlDefaultButton
{
type = CT_BUTTON;
style = ST_CENTER + ST_FRAME + ST_HUD_BACKGROUND;
colorBackground[] = {0,0,0,1};
colorBackgroundDisabled[] = {0,0,0,0.5};
colorBackgroundActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorFocused[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
font = "PuristaLight";
text = "";
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
borderSize = 0;
colorBorder[] = {0,0,0,0};
colorShadow[] = {0,0,0,0};
offsetX = 0;
offsetY = 0;
offsetPressedX = "pixelW";
offsetPressedY = "pixelH";
period = 0;
periodFocus = 2;
periodOver = 0.5;
class KeyHints
{
class A
{
key = "0x00050000 + 0";
hint = "KEY_XBOX_A";
};
};
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onButtonClick = "";
onButtonDown = "";
onButtonUp = "";
};
class ctrlButtonPicture: ctrlButton
{
style = ST_CENTER + ST_MULTI + ST_TITLE_BAR;
};
class ctrlButtonPictureKeepAspect: ctrlButton
{
style = ST_CENTER + ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
};
class ctrlButtonOK: ctrlButton
{
default = 1;
idc = 1;
text = "OK";
};
class ctrlButtonCancel: ctrlButton
{
idc = 2;
text = "Cancel";
};
class ctrlButtonClose: ctrlButtonCancel
{
text = "Close";
};
class ctrlButtonToolbar: ctrlButtonPictureKeepAspect
{
colorBackground[] = {0,0,0,0};
colorBackgroundDisabled[] = {0,0,0,0};
};
class ctrlButtonSearch: ctrlButton
{
style = ST_CENTER + ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
text = "\a3\3DEN\Data\Displays\Display3DEN\search_start_ca.paa";
textSearch = "\a3\3DEN\Data\Displays\Display3DEN\search_end_ca.paa";
tooltip = "Search";
};
class ctrlButtonExpandAll: ctrlButtonToolbar
{
style = ST_CENTER + ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
text = "\a3\3DEN\Data\Displays\Display3DEN\tree_expand_ca.paa";
tooltip = "Expand All";
};
class ctrlButtonCollapseAll: ctrlButtonToolbar
{
style = ST_CENTER + ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
text = "\a3\3DEN\Data\Displays\Display3DEN\tree_collapse_ca.paa";
tooltip = "Collapse All";
};
class ctrlButtonFilter: ctrlButton
{
colorBackground[] = {0,0,0,0};
colorBackgroundDisabled[] = {0,0,0,0};
colorBackgroundActive[] = {1,1,1,0.3};
colorFocused[] = {0,0,0,0};
};
class ctrlEdit: ctrlDefaultText
{
type = CT_EDIT;
colorBackground[] = {0,0,0,0.5};
text = "";
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
colorSelection[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
canModify = 1;
autocomplete = "";
onCanDestroy = "";
onDestroy = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
};
class ctrlEditMulti: ctrlEdit
{
style = ST_MULTI;
};
class ctrlSliderV: ctrlDefault
{
type = CT_SLIDER;
style = SL_VERT;
color[] = {0,0,0,1};
colorDisabled[] = {1,1,1,0.25};
colorActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
sliderRange[] = {0,1};
sliderPosition = 1;
lineSize = 0.1;
pageSize = 3;
class Title
{
idc = -1;
colorBase[] = {1,1,1,1};
colorActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
};
class Value
{
idc = -1;
format = "%.f";
type = CT_STATIC;
colorBase[] = {1,1,1,1};
colorActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
};
onCanDestroy = "";
onDestroy = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onSliderPosChanged = "";
};
class ctrlSliderH: ctrlSliderV
{
style = SL_HORZ;
};
class ctrlCombo: ctrlDefaultText
{
type = CT_COMBO;
style = ST_MULTI + ST_NO_RECT;
colorBackground[] = {0.05,0.05,0.05,1};
colorSelectBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
colorSelect[] = {0,0,0,1};
colorTextRight[] = {1,1,1,1};
colorSelectRight[] = {1,1,1,0.25};
colorSelect2Right[] = {1,1,1,1};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,0.25};
colorPictureRight[] = {1,1,1,1};
colorPictureRightSelected[] = {1,1,1,1};
colorPictureRightDisabled[] = {1,1,1,0.25};
arrowEmpty = "\a3\3DEN\Data\Controls\ctrlCombo\arrowEmpty_ca.paa";
arrowFull = "\a3\3DEN\Data\Controls\ctrlCombo\arrowFull_ca.paa";
wholeHeight = 12 * 5 * GRID_H;
maxHistoryDelay = 1;
soundExpand[] =
{
"\A3\ui_f\data\sound\RscCombo\soundExpand",
0.1,
1
};
soundCollapse[] =
{
"\A3\ui_f\data\sound\RscCombo\soundCollapse",
0.1,
1
};
soundSelect[] =
{
"\A3\ui_f\data\sound\RscCombo\soundSelect",
0.1,
1
};
class ComboScrollBar
{
width = 0;
height = 0;
scrollSpeed = 0.01;
arrowEmpty = "\a3\3DEN\Data\Controls\ctrlDefault\arrowEmpty_ca.paa";
arrowFull = "\a3\3DEN\Data\Controls\ctrlDefault\arrowFull_ca.paa";
border = "\a3\3DEN\Data\Controls\ctrlDefault\border_ca.paa";
thumb = "\a3\3DEN\Data\Controls\ctrlDefault\thumb_ca.paa";
color[] = {1,1,1,1};
};
onCanDestroy = "";
onDestroy = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onLBSelChanged = "";
};
class ctrlComboToolbar: ctrlCombo
{
colorBackground[] = {0.05,0.05,0.05,1};
colorSelectBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
arrowEmpty = "\a3\3DEN\Data\Controls\ctrlCombo\arrowEmptyToolbar_ca.paa";
arrowFull = "\a3\3DEN\Data\Controls\ctrlCombo\arrowEmptyToolbar_ca.paa";
wholeHeight = 12 * 5 * GRID_H;
};
class ctrlListbox: ctrlDefaultText
{
type = CT_LISTBOX;
style = LB_TEXTURES;
colorBackground[] = {0,0,0,0.5};
colorSelectBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorSelectBackground2[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorShadow[] = {0,0,0,0.5};
colorDisabled[] = {1,1,1,0.25};
colorText[] = {1,1,1,1};
colorSelect[] = {1,1,1,1};
colorSelect2[] = {1,1,1,1};
colorTextRight[] = {1,1,1,1};
colorSelectRight[] = {1,1,1,1};
colorSelect2Right[] = {1,1,1,1};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,0.25};
colorPictureRight[] = {1,1,1,1};
colorPictureRightSelected[] = {1,1,1,1};
colorPictureRightDisabled[] = {1,1,1,0.25};
period = 1;
rowHeight = "4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
itemSpacing = 0;
maxHistoryDelay = 1;
canDrag = 0;
soundSelect[] =
{
"\A3\ui_f\data\sound\RscListbox\soundSelect",
0.09,
1
};
class ListScrollBar: ScrollBar
{
};
onCanDestroy = "";
onDestroy = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onLBSelChanged = "";
onLBDblClick = "";
onLBDrag = "";
onLBDragging = "";
onLBDrop = "";
};
class ctrlToolbox: ctrlDefaultText
{
type = CT_TOOLBOX;
style = ST_CENTER;
colorBackground[] = {0,0,0,0.5};
colorText[] = {1,1,1,1};
colorTextSelect[] = {1,1,1,1};
rows = 1;
columns = 1;
strings[] = {};
values[] = {};
color[] = {1,0,1,1};
colorSelect[] = {0,0,0,0};
colorTextDisable[] = {0,0,0,0};
colorDisable[] = {0,0,0,0};
colorSelectedBg[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onToolBoxSelChanged = "";
};
class ctrlToolboxPicture: ctrlToolbox
{
style = ST_CENTER + ST_MULTI + ST_TITLE_BAR;
};
class ctrlToolboxPictureKeepAspect: ctrlToolbox
{
style = ST_CENTER + ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
};
class ctrlCheckboxes: ctrlDefaultText
{
type = CT_CHECKBOXES;
colorBackground[] = {0,0,0,0.5};
colorText[] = {1,1,1,1};
colorTextSelect[] = {1,1,1,1};
rows = 1;
columns = 1;
strings[] = {};
checked_strings[] = {};
color[] = {1,0,1,1};
colorSelect[] = {0,0,0,0};
colorTextDisable[] = {0,0,0,0};
colorDisable[] = {0,0,0,0};
colorSelectedBg[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onCheckBoxesSelChanged = "";
};
class ctrlCheckboxesCheckbox: ctrlCheckboxes
{
style = ST_MULTI + ST_TITLE_BAR;
strings[] =
{
"\a3\3DEN\Data\Controls\ctrlCheckbox\textureUnchecked_ca.paa"
};
checked_strings[] =
{
"\a3\3DEN\Data\Controls\ctrlCheckbox\textureChecked_ca.paa"
};
colorBackground[] = {0,0,0,0};
colorSelectedBg[] = {0,0,0,0};
};
class ctrlProgress: ctrlDefault
{
type = CT_PROGRESS;
texture = "#(argb,8,8,3)color(1,1,1,1)";
colorBar[] = {1,1,1,1};
colorFrame[] = {0,0,0,1};
onCanDestroy = "";
onDestroy = "";
};
class ctrlHTML: ctrlDefaultText
{
type = CT_HTML;
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
colorBold[] = {1,1,1,0.5};
colorLink[] = {1,1,1,1};
colorLinkActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorPicture[] = {1,1,1,1};
colorPictureBorder[] = {0,0,0,0};
colorPictureLink[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
prevPage = "\a3\3DEN\Data\Controls\CtrlHTML\prevPage_ca.paa";
nextPage = "\a3\3DEN\Data\Controls\CtrlHTML\nextPage_ca.paa";
filename = "";
cycleLinks = 0;
cycleAllLinks = 0;
class P
{
font = "RobotoCondensedLight";
fontBold = "RobotoCondensedBold";
sizeEx = "4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
};
class H1: P
{
sizeEx = "5.58 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
};
class H2: P
{
sizeEx = "4.86 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
};
class H3: P
{
};
class H4: P
{
};
class H5: P
{
};
class H6: P
{
font = "RobotoCondensedLight";
fontBold = "RobotoCondensedLight";
};
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onHTMLLink = "";
};
class ctrlActiveText: ctrlDefaultButton
{
type = CT_ACTIVETEXT;
text = "";
color[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
0.75
};
colorActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorDisabled[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onButtonClick = "";
onButtonDown = "";
onButtonUp = "";
};
class ctrlActivePicture: ctrlActiveText
{
style = ST_MULTI + ST_TITLE_BAR;
color[] = {1,1,1,1};
};
class ctrlActivePictureKeepAspect: ctrlActiveText
{
style = ST_MULTI + ST_TITLE_BAR + ST_KEEP_ASPECT_RATIO;
};
class ctrlTree: ctrlDefaultText
{
type = CT_TREE;
colorBorder[] = {0,0,0,1};
colorLines[] = {0,0,0,0};
colorBackground[] = {0,0,0,0};
colorSelect[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorMarked[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
0.5
};
colorMarkedSelected[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorText[] = {1,1,1,1};
colorSelectText[] = {1,1,1,1};
colorMarkedText[] = {1,1,1,1};
colorSearch[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,0.25};
colorPictureRight[] = {1,1,1,1};
colorPictureRightSelected[] = {1,1,1,1};
colorPictureRightDisabled[] = {1,1,1,0.25};
multiselectEnabled = 0;
expandOnDoubleclick = 1;
hiddenTexture = "\a3\3DEN\Data\Controls\ctrlTree\hiddenTexture_ca.paa";
expandedTexture = "\a3\3DEN\Data\Controls\ctrlTree\expandedTexture_ca.paa";
maxHistoryDelay = 1;
disableKeyboardSearch = 0;
class ScrollBar: ScrollBar
{
scrollSpeed = 0.05;
};
colorDisabled[] = {0,0,0,0};
colorArrow[] = {0,0,0,0};
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onTreeSelChanged = "";
onTreeLButtonDown = "";
onTreeDblClick = "";
onTreeExpanded = "";
onTreeCollapsed = "";
onTreeMouseExit = "";
};
class ctrlStructuredText: ctrlDefaultText
{
type = CT_STRUCTURED_TEXT;
colorBackground[] = {0,0,0,0};
size = "4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
text = "";
class Attributes
{
align = "left";
color = "#ffffff";
colorLink = "";
size = 1;
font = "RobotoCondensedLight";
};
onCanDestroy = "";
onDestroy = "";
};
class ctrlControlsGroup: ctrlDefault
{
type = CT_CONTROLS_GROUP;
style = ST_MULTI;
x = 0;
y = 0;
w = 1;
h = 1;
class VScrollBar: ScrollBar
{
width = 2 * GRID_W;
height = 0;
autoScrollEnabled = 0;
autoScrollDelay = 1;
autoScrollRewind = 1;
autoScrollSpeed = 1;
};
class HScrollBar: ScrollBar
{
width = 0;
height = 2 * GRID_H;
};
onCanDestroy = "";
onDestroy = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
};
class ctrlControlsGroupNoScrollbars: ctrlControlsGroup
{
class VScrollbar: VScrollBar
{
width = 0;
};
class HScrollbar: HScrollBar
{
height = 0;
};
};
class ctrlControlsGroupNoHScrollbars: ctrlControlsGroup
{
class HScrollbar: HScrollBar
{
height = 0;
};
};
class ctrlControlsGroupNoVScrollbars: ctrlControlsGroup
{
class VScrollbar: VScrollBar
{
width = 0;
};
};
class ctrlShortcutButton: ctrlDefaultButton
{
type = CT_SHORTCUTBUTTON;
style = ST_FRAME + ST_HUD_BACKGROUND;
colorBackground[] = {0,0,0,1};
colorBackground2[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorBackgroundFocused[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorBackgroundActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
text = "";
size = "4.86 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
shadow = 0;
color[] = {1,1,1,1};
color2[] = {1,1,1,1};
colorFocused[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
animTextureNormal = "#(argb,8,8,3)color(1,1,1,1)";
animTextureOver = "#(argb,8,8,3)color(1,1,1,1)";
animTexturePressed = "#(argb,8,8,3)color(1,1,1,1)";
animTextureFocused = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDisabled = "#(argb,8,8,3)color(1,1,1,1)";
animTextureDefault = "#(argb,8,8,3)color(1,1,1,1)";
period = 1;
periodFocus = 1;
periodOver = 0.5;
shortcuts[] =
{
"0x00050000 + 0",
28,
57,
156
};
textureNoShortcut = "#(argb,8,8,3)color(1,1,1,1)";
class Attributes
{
align = "center";
color = "#ffffff";
font = "PuristaLight";
shadow = 0;
};
class HitZone
{
left = 0;
top = 0;
right = 0;
bottom = 0;
};
class TextPos
{
left = 0;
top = 0;
right = 0;
bottom = 0;
};
class ShortcutPos
{
left = 0;
top = 0;
w = 0;
h = 0;
};
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onButtonClick = "";
onButtonDown = "";
onButtonUp = "";
};
class ctrlShortcutButtonOK: ctrlShortcutButton
{
default = 1;
idc = 1;
text = "OK";
};
class ctrlShortcutButtonCancel: ctrlShortcutButton
{
idc = 2;
text = "Cancel";
};
class ctrlShortcutButtonSteam: ctrlShortcutButton
{
colorBackground[] = {0.0313726,0.721569,0.917647,1};
textureNoShortcut = "\a3\3DEN\Data\Controls\CtrlShortcutButton\steam_ca.paa";
class TextPos
{
left = 1.5 * 5 * GRID_W;
top = 0;
right = 0;
bottom = 0;
};
class ShortcutPos
{
left = 0;
top = 0;
w = 5 * GRID_W;
h = 5 * GRID_H;
};
};
class ctrlXListbox: ctrlDefaultText
{
type = CT_XLISTBOX;
style = ST_CENTER + LB_TEXTURES + SL_HORZ;
color[] = {1,1,1,1};
colorActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorText[] = {1,1,1,1};
colorSelect[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorDisabled[] = {1,1,1,0.25};
colorPicture[] = {1,1,1,1};
cycle = 1;
arrowEmpty = "\a3\3DEN\Data\Controls\CtrlXSlider\arrowEmpty_ca.paa";
arrowFull = "\a3\3DEN\Data\Controls\CtrlXSlider\arrowFull_ca.paa";
border = "\a3\3DEN\Data\Controls\CtrlXSlider\border_ca.paa";
soundSelect[] =
{
"\A3\ui_f\data\sound\RscListbox\soundSelect",
0.09,
1
};
onCanDestroy = "";
onDestroy = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onLBSelChanged = "";
onLBDblClick = "";
};
class ctrlXSliderV: ctrlDefault
{
type = CT_XSLIDER;
style = SL_VERT;
color[] = {1,1,1,0.6};
colorActive[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
sliderRange[] = {0,1};
sliderPosition = 1;
lineSize = 0.1;
arrowEmpty = "\a3\3DEN\Data\Controls\CtrlXSlider\arrowEmpty_ca.paa";
arrowFull = "\a3\3DEN\Data\Controls\CtrlXSlider\arrowFull_ca.paa";
border = "\a3\3DEN\Data\Controls\CtrlXSlider\border_ca.paa";
thumb = "\a3\3DEN\Data\Controls\CtrlXSlider\thumb_ca.paa";
class Title
{
idc = -1;
colorBase[] = {1,1,1,1};
colorActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
};
class Value
{
idc = -1;
format = "%.f";
type = CT_STATIC;
colorBase[] = {1,1,1,1};
colorActive[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
};
onCanDestroy = "";
onDestroy = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onSliderPosChanged = "";
};
class ctrlXSliderH: ctrlXSliderV
{
style = SL_HORZ;
};
class ctrlMenu: ctrlDefaultText
{
type = 46;
font = "RobotoCondensedLight";
colorBorder[] = {0,0,0,0};
colorBackground[] = {0,0,0,1};
colorText[] = {1,1,1,1};
colorSelect[] = {0,0,0,1};
colorSelectBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorDisabled[] = {1,1,1,0.25};
colorPicture[] = {1,1,1,1};
colorPictureSelect[] = {0,0,0,1};
colorPictureDisabled[] = {1,1,1,0.5};
arrow = "\a3\3DEN\Data\Controls\ctrlMenu\arrow_ca.paa";
rowHeight = 0;
itemSpacingW = 0.01;
itemSpacingH = 0.01;
pictureCheckboxEnabled = "\a3\3DEN\Data\Controls\CtrlMenu\pictureCheckboxEnabled_ca.paa";
pictureCheckboxDisabled = "#(argb,8,8,3)color(0,0,0,0)";
pictureRadioEnabled = "\a3\3DEN\Data\Controls\CtrlMenu\pictureRadioEnabled_ca.paa";
pictureRadioDisabled = "#(argb,8,8,3)color(0,0,0,0)";
};
class ctrlMenuStrip: ctrlMenu
{
type = 47;
colorStripBackground[] = {0,0,0,1};
colorStripText[] = {1,1,1,1};
colorStripSelect[] = {0,0,0,1};
colorStripSelectBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorStripDisabled[] = {1,1,1,0.25};
};
class ctrlMap: ctrlDefault
{
type = CT_MAP_MAIN;
style = ST_MULTI + ST_TITLE_BAR;
x = "safezoneXAbs";
y = "safezoneY";
w = "safezoneWAbs";
h = "safezoneH";
sizeEx = 0.05;
font = "RobotoCondensedLight";
colorText[] = {0,0,0,1};
moveOnEdges = 1;
ptsPerSquareSea = 5;
ptsPerSquareTxt = 20;
ptsPerSquareCLn = 10;
ptsPerSquareExp = 10;
ptsPerSquareCost = 10;
ptsPerSquareFor = 9;
ptsPerSquareForEdge = 9;
ptsPerSquareRoad = 6;
ptsPerSquareObj = 9;
scaleMin = 0.0001;
scaleMax = 1;
scaleDefault = 0.16;
maxSatelliteAlpha = 0.85;
alphaFadeStartScale = 2;
alphaFadeEndScale = 2;
text = "#(argb,8,8,3)color(1,1,1,1)";
colorBackground[] = {0.969,0.957,0.949,1};
colorOutside[] = {0,0,0,1};
colorSea[] = {0.467,0.631,0.851,0.5};
colorForest[] = {0.624,0.78,0.388,0.5};
colorForestBorder[] = {0,0,0,0};
colorRocks[] = {0,0,0,0.3};
colorRocksBorder[] = {0,0,0,0};
colorLevels[] = {0.286,0.177,0.094,0.5};
colorMainCountlines[] = {0.572,0.354,0.188,0.5};
colorCountlines[] = {0.572,0.354,0.188,0.25};
colorMainCountlinesWater[] = {0.491,0.577,0.702,0.6};
colorCountlinesWater[] = {0.491,0.577,0.702,0.3};
colorPowerLines[] = {0.1,0.1,0.1,1};
colorRailWay[] = {0.8,0.2,0,1};
colorNames[] = {0.1,0.1,0.1,0.9};
colorInactive[] = {1,1,1,0.5};
colorTracks[] = {0.84,0.76,0.65,0.15};
colorTracksFill[] = {0.84,0.76,0.65,1};
colorRoads[] = {0.7,0.7,0.7,1};
colorRoadsFill[] = {1,1,1,1};
colorMainRoads[] = {0.9,0.5,0.3,1};
colorMainRoadsFill[] = {1,0.6,0.4,1};
colorTrails[] = {0.84,0.76,0.65,0.15};
colorTrailsFill[] = {0.84,0.76,0.65,0.65};
colorGrid[] = {0.1,0.1,0.1,0.6};
colorGridMap[] = {0.1,0.1,0.1,0.6};
fontLabel = "RobotoCondensedLight";
sizeExLabel = 0.05;
fontGrid = "TahomaB";
sizeExGrid = 0.02;
fontUnits = "TahomaB";
sizeExUnits = 0.05;
fontNames = "EtelkaNarrowMediumPro";
sizeExNames = 0.05;
fontInfo = "RobotoCondensedLight";
sizeExInfo = 0.05;
fontLevel = "TahomaB";
sizeExLevel = 0.02;
showCountourInterval = 1;
idcMarkerColor = -1;
idcMarkerIcon = -1;
textureComboBoxColor = "#(argb,8,8,3)color(1,1,1,1)";
showMarkers = "true";
class LineMarker
{
lineWidthThin = 0.008;
lineWidthThick = 0.014;
lineDistanceMin = 3e-005;
lineLengthMin = 5;
};
class Legend
{
x = 0.5;
y = 0.5;
w = 0.4;
h = 0.1;
color[] = {0,0,0,1};
colorBackground[] = {1,1,1,0.5};
font = "RobotoCondensedLight";
sizeEX = "3.96 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
};
class Task
{
icon = "\A3\ui_f\data\map\mapcontrol\taskIcon_CA.paa";
color[] = {1,1,1,1};
iconCreated = "\A3\ui_f\data\map\mapcontrol\taskIconCreated_CA.paa";
colorCreated[] = {1,1,0,1};
iconCanceled = "\A3\ui_f\data\map\mapcontrol\taskIconCanceled_CA.paa";
colorCanceled[] = {0.7,0.7,0.7,1};
iconDone = "\A3\ui_f\data\map\mapcontrol\taskIconDone_CA.paa";
colorDone[] = {0.7,1,0.3,1};
iconFailed = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_CA.paa";
colorFailed[] = {1,0.3,0.2,1};
size = 27;
importance = 1;
coefMin = 1;
coefMax = 1;
};
class ActiveMarker
{
color[] = {0,0,0,1};
size = 2;
};
class Waypoint
{
coefMax = 1;
coefMin = 1;
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa";
importance = 1;
size = 24;
};
class WaypointCompleted: Waypoint
{
icon = "\A3\ui_f\data\map\mapcontrol\waypointCompleted_ca.paa";
};
class CustomMark: Waypoint
{
icon = "\A3\ui_f\data\map\mapcontrol\custommark_ca.paa";
};
class Command: Waypoint
{
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\waypoint_ca.paa";
size = 18;
};
class Bush: Waypoint
{
coefMax = 4;
coefMin = 0.25;
color[] = {0.45,0.64,0.33,0.4};
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
importance = 0.007;
size = 7;
};
class SmallTree: Bush
{
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
importance = 0.36;
size = 12;
};
class Tree: SmallTree
{
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
importance = 0.72;
};
class Rock: SmallTree
{
color[] = {0.1,0.1,0.1,0.8};
icon = "\A3\ui_f\data\map\mapcontrol\rock_ca.paa";
importance = 0.3;
};
class BusStop: Bush
{
color[] = {0.45,0.64,0.33,0.4};
icon = "\A3\ui_f\data\map\mapcontrol\bush_ca.paa";
};
class FuelStation: Waypoint
{
coefMax = 1;
coefMin = 0.85;
color[] = {1,1,1,1};
icon = "\A3\ui_f\data\map\mapcontrol\fuelstation_CA.paa";
};
class Hospital: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\hospital_CA.paa";
};
class Church: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\church_CA.paa";
};
class Lighthouse: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\lighthouse_CA.paa";
};
class Power: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\power_CA.paa";
};
class PowerSolar: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\powersolar_CA.paa";
};
class PowerWave: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\powerwave_CA.paa";
};
class PowerWind: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\powerwind_CA.paa";
};
class Quay: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\quay_CA.paa";
};
class Transmitter: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\transmitter_CA.paa";
};
class Watertower: FuelStation
{
icon = "\A3\ui_f\data\map\mapcontrol\watertower_CA.paa";
};
class Cross: Waypoint
{
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\Cross_CA.paa";
};
class Chapel: Cross
{
icon = "\A3\ui_f\data\map\mapcontrol\Chapel_CA.paa";
};
class Shipwreck: Cross
{
icon = "\A3\ui_f\data\map\mapcontrol\Shipwreck_CA.paa";
};
class Bunker: Waypoint
{
coefMax = 4;
coefMin = 0.25;
color[] = {0,0,0,1};
icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa";
importance = 1.05;
size = 14;
};
class Fortress: Bunker
{
icon = "\A3\ui_f\data\map\mapcontrol\bunker_ca.paa";
importance = 1.6;
size = 16;
};
class Fountain: Bunker
{
icon = "\A3\ui_f\data\map\mapcontrol\fountain_ca.paa";
importance = 0.6;
size = 11;
};
class Ruin: Waypoint
{
coefMax = 4;
coefMin = 1;
icon = "\A3\ui_f\data\map\mapcontrol\ruin_ca.paa";
importance = 0.96;
size = 16;
};
class Stack: Waypoint
{
coefMax = 2;
coefMin = 0.4;
icon = "\A3\ui_f\data\map\mapcontrol\stack_ca.paa";
importance = 1.6;
size = 16;
};
class Tourism: Waypoint
{
coefMax = 4;
coefMin = 0.7;
icon = "\A3\ui_f\data\map\mapcontrol\tourism_ca.paa";
importance = 2.8;
size = 16;
};
class ViewTower: Waypoint
{
coefMax = 4;
coefMin = 0.5;
icon = "\A3\ui_f\data\map\mapcontrol\viewtower_ca.paa";
importance = 2;
size = 16;
};
onCanDestroy = "";
onDestroy = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onDraw = "";
};
class ctrlMapEmpty: ctrlMap
{
ptsPerSquareSea = 1000;
ptsPerSquareTxt = 1000;
ptsPerSquareCLn = 1000;
ptsPerSquareExp = 1000;
ptsPerSquareCost = 1000;
ptsPerSquareFor = 1000;
ptsPerSquareForEdge = 1000;
ptsPerSquareRoad = 1000;
ptsPerSquareObj = 1000;
alphaFadeStartScale = 0;
alphaFadeEndScale = 0;
colorBackground[] = {1,1,1,1};
colorOutside[] = {1,1,1,1};
colorSea[] = {0,0,0,0};
colorForest[] = {0,0,0,0};
colorForestBorder[] = {0,0,0,0};
colorRocks[] = {0,0,0,0};
colorRocksBorder[] = {0,0,0,0};
colorLevels[] = {0,0,0,0};
colorMainCountlines[] = {0,0,0,0};
colorCountlines[] = {0,0,0,0};
colorMainCountlinesWater[] = {0,0,0,0};
colorCountlinesWater[] = {0,0,0,0};
colorPowerLines[] = {0,0,0,0};
colorRailWay[] = {0,0,0,0};
colorNames[] = {0,0,0,0};
colorInactive[] = {0,0,0,0};
colorGrid[] = {0,0,0,0};
colorGridMap[] = {0,0,0,0};
class Task: Task
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
iconCreated = "#(argb,8,8,3)color(0,0,0,0)";
iconCanceled = "#(argb,8,8,3)color(0,0,0,0)";
iconDone = "#(argb,8,8,3)color(0,0,0,0)";
iconFailed = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
colorCreated[] = {0,0,0,0};
colorCanceled[] = {0,0,0,0};
colorDone[] = {0,0,0,0};
colorFailed[] = {0,0,0,0};
size = 0;
};
class Waypoint: Waypoint
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class WaypointCompleted: WaypointCompleted
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class CustomMark: CustomMark
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Command: Command
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Bush: Bush
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Rock: Rock
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class SmallTree: SmallTree
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Tree: Tree
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class busstop: BusStop
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class fuelstation: FuelStation
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class hospital: Hospital
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class church: Church
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class lighthouse: Lighthouse
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class power: Power
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class powersolar: PowerSolar
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class powerwave: PowerWave
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class powerwind: PowerWind
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class quay: Quay
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class shipwreck: Shipwreck
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class transmitter: Transmitter
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class watertower: Watertower
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Bunker: Bunker
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Cross: Cross
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Fortress: Fortress
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Fountain: Fountain
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Chapel: Chapel
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Ruin: Ruin
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Stack: Stack
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class Tourism: Tourism
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
class ViewTower: ViewTower
{
icon = "#(argb,8,8,3)color(0,0,0,0)";
color[] = {0,0,0,0};
size = 0;
};
};
class ctrlMapMain: ctrlMap
{
};
class ctrlListNBox: ctrlDefaultText
{
type = CT_LISTNBOX;
style = ST_MULTI;
colorSelectBackground[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorSelectBackground2[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorText[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
colorSelect[] = {1,1,1,1};
colorSelect2[] = {1,1,1,1};
colorShadow[] = {0,0,0,0.5};
colorPicture[] = {1,1,1,1};
colorPictureSelected[] = {1,1,1,1};
colorPictureDisabled[] = {1,1,1,0.25};
columns[] = {0};
drawSideArrows = 0;
idcLeft = -1;
idcRight = -1;
period = 1;
disableOverflow = 0;
rowHeight = "4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
maxHistoryDelay = 1;
soundSelect[] =
{
"\A3\ui_f\data\sound\RscListbox\soundSelect",
0.09,
1
};
class ListScrollBar: ScrollBar
{
};
onCanDestroy = "";
onDestroy = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onLBSelChanged = "";
onLBDblClick = "";
};
class ctrlCheckbox: ctrlDefault
{
type = CT_CHECKBOX;
checked = 0;
color[] = {1,1,1,0.7};
colorFocused[] = {1,1,1,1};
colorHover[] = {1,1,1,1};
colorPressed[] = {1,1,1,1};
colorDisabled[] = {1,1,1,0.25};
colorBackground[] = {0,0,0,0};
colorBackgroundFocused[] = {0,0,0,0};
colorBackgroundHover[] = {0,0,0,0};
colorBackgroundPressed[] = {0,0,0,0};
colorBackgroundDisabled[] = {0,0,0,0};
textureChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureChecked_ca.paa";
textureUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureUnchecked_ca.paa";
textureFocusedChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureChecked_ca.paa";
textureFocusedUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureUnchecked_ca.paa";
textureHoverChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureChecked_ca.paa";
textureHoverUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureUnchecked_ca.paa";
texturePressedChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureChecked_ca.paa";
texturePressedUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureUnchecked_ca.paa";
textureDisabledChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureChecked_ca.paa";
textureDisabledUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\textureUnchecked_ca.paa";
soundClick[] =
{
"\A3\ui_f\data\sound\RscButton\soundClick",
0.09,
1
};
soundEnter[] =
{
"\A3\ui_f\data\sound\RscButton\soundEnter",
0.09,
1
};
soundPush[] =
{
"\A3\ui_f\data\sound\RscButton\soundPush",
0.09,
1
};
soundEscape[] =
{
"\A3\ui_f\data\sound\RscButton\soundEscape",
0.09,
1
};
onCanDestroy = "";
onDestroy = "";
onMouseEnter = "";
onMouseExit = "";
onSetFocus = "";
onKillFocus = "";
onKeyDown = "";
onKeyUp = "";
onMouseButtonDown = "";
onMouseButtonUp = "";
onMouseButtonClick = "";
onMouseButtonDblClick = "";
onMouseZChanged = "";
onMouseMoving = "";
onMouseHolding = "";
onCheckedChanged = "";
};
class ctrlCheckboxToolbar: ctrlCheckbox
{
color[] = {1,1,1,1};
colorBackgroundHover[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
colorBackgroundPressed[] =
{
"(profilenamespace getvariable ['GUI_BCG_RGB_R',0.77])",
"(profilenamespace getvariable ['GUI_BCG_RGB_G',0.51])",
"(profilenamespace getvariable ['GUI_BCG_RGB_B',0.08])",
1
};
};
class ctrlCheckboxBaseline: ctrlCheckbox
{
textureChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureChecked_ca.paa";
textureUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureUnchecked_ca.paa";
textureFocusedChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureChecked_ca.paa";
textureFocusedUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureUnchecked_ca.paa";
textureHoverChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureChecked_ca.paa";
textureHoverUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureUnchecked_ca.paa";
texturePressedChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureChecked_ca.paa";
texturePressedUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureUnchecked_ca.paa";
textureDisabledChecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureChecked_ca.paa";
textureDisabledUnchecked = "\a3\3DEN\Data\Controls\ctrlCheckbox\baseline_textureUnchecked_ca.paa";
};
| [
"[email protected]"
] | |
797fb357043740b447c7607b9a3f0f514864f529 | 5b13ae06f550d0d33674b3223d7b014100748729 | /statement.h | d38346619a30bdc570468454b6583f721f41db69 | [] | no_license | ElliotJiang426/Mini-BASIC | 1957e4a5c3e5e568c1d76658b6c63f2104d6b697 | b7b56af97bc56a1d74ae12dc60d8629636d2c6dc | refs/heads/master | 2023-01-19T19:07:45.464462 | 2020-11-26T06:45:26 | 2020-11-26T06:45:26 | 316,144,967 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,454 | h | #ifndef STATEMENT_H
#define STATEMENT_H
#include <QString>
#include <QMap>
#include "expression.h"
class statement
{
public:
statement(const QString &s, QMap<QString, int> &VarList);
virtual ~statement();
virtual void run();
void checkVariable(QString var);
protected:
QString *stmt;
QMap<QString, int> *varlist;
};
class letstmt : public statement
{
public:
letstmt(const QString &s, QMap<QString, int> &VarList): statement(s, VarList){}
~letstmt();
void run();
private:
compondExp *cpdexp;
};
class printstmt : public statement
{
public:
printstmt(const QString &s, QMap<QString, int> &VarList): statement(s, VarList){}
void run();
QString *var;
QString *value;
};
class inputstmt : public statement
{
public:
inputstmt(const QString &s, QMap<QString, int> &VarList): statement(s, VarList){}
void run();
QString name;
};
class gotostmt : public statement
{
public:
gotostmt(const QString &s, QMap<QString, int> &Varlist): statement(s, Varlist){}
void run();
constantExp *cstexp;
int value;
};
class ifstmt : public statement
{
public:
ifstmt(const QString &s, QMap<QString, int> &Varlist): statement(s, Varlist){gotonum = -1;}
void run();
int gotonum;
};
class funcstmt: public statement
{
public:
funcstmt(const QString &s, QMap<QString, int> &Varlist): statement(s, Varlist){}
void run();
QString funcname;
};
#endif // STATEMENT_H
| [
"[email protected]"
] | |
dd43f1fe0646f8f899d2f51ecc6ddc1e744c52eb | ba4196ce39324607ce523be70a173e8ba5c70d87 | /Database2/main.cpp | be91c2b8f0da5f6c4587e5a1b92357c03eb9a8e3 | [] | no_license | ConnerTenn/Interconnect | c8b9c046e19fd404e94d7b0d9d9cfefae41840bb | 92b2e1523e082ef08902144f9feb5647e31b097b | refs/heads/master | 2020-03-14T19:22:46.396117 | 2019-03-22T16:39:46 | 2019-03-22T16:39:46 | 131,759,953 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 912 | cpp |
#include "Interconnect.h"
#include "Database.h"
#include <sstream>
#include <algorithm>
#include <iterator>
std::vector<std::string> Delimit(std::string text)
{
std::istringstream iss(text);
/*std::vector<std::string> tokens;
std::copy(std::istream_iterator<std::string>(iss),
std::istream_iterator<std::string>(),
std::back_inserter(tokens));*/
return/*std::vector<std::string> tokens*/{std::istream_iterator<std::string>{iss}, std::istream_iterator<std::string>{}};
//return tokens;
}
int main()
{
Database database;
u64 n = database.AddNode("Hello World");
u64 n2 = database.AddNode("Hello!", {n});
u64 l = database.AddLink("Hi",n, 1);
std::cout << "\n";
database.Print(1);
database.Print(n);
database.Print(l);
database.Print(n2);
database.RemoveElem(n);
database.RemoveElem(n2);
database.RemoveElem(l);
std::cout << "\n";
database.Print(1);
database.Print(l);
return 0;
}
| [
"[email protected]"
] | |
4696c2c2ea6dbc97481a54252c43c791617bd96e | 08b8cf38e1936e8cec27f84af0d3727321cec9c4 | /data/crawl/squid/hunk_7448.cpp | afddbd00a554d4b834524fb764f2be08ae0da027 | [] | no_license | ccdxc/logSurvey | eaf28e9c2d6307140b17986d5c05106d1fd8e943 | 6b80226e1667c1e0760ab39160893ee19b0e9fb1 | refs/heads/master | 2022-01-07T21:31:55.446839 | 2018-04-21T14:12:43 | 2018-04-21T14:12:43 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 337 | cpp | /* log convert handler */
/* call for each line in file, use fileWalk routine */
static int
-logReadHandler(int fd_unused, char *buf, int size_unused, log_read_data_t * data)
+logReadHandler(int fd_unused, const char *buf, int size_unused, log_read_data_t *data)
{
storeAppendPrintf(data->sentry, "{%s}\n", buf);
return 0;
| [
"[email protected]"
] | |
ed26b0d50d4473ecd4eec4620e1fc6147691e056 | ddd72895f76e1f469ffc90318ffb937694a64551 | /Source/WebKit2/UIProcess/WebMediaPlaybackTargetPickerProxy.cpp | 6adfde6536c9b70dac6cc6a41475b1d86de0f3d6 | [] | no_license | SamuelHuang0212/webkit | b6753d7f19a5aedffb17c1d2d8bf2d8862e28685 | 5d1a7f978db62c7a58f6b485fb38a079dba52ad2 | refs/heads/master | 2023-02-28T02:55:25.791774 | 2015-03-19T08:27:27 | 2015-03-19T08:27:27 | 32,516,994 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,138 | cpp | /*
* Copyright (C) 2015 Apple Inc. 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.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 "config.h"
#include "WebMediaPlaybackTargetPickerProxy.h"
#if ENABLE(WIRELESS_PLAYBACK_TARGET)
namespace WebKit {
WebMediaPlaybackTargetPickerProxy::WebMediaPlaybackTargetPickerProxy(Client& client)
: m_client(&client)
{
}
WebMediaPlaybackTargetPickerProxy::~WebMediaPlaybackTargetPickerProxy()
{
m_client = nullptr;
}
void WebMediaPlaybackTargetPickerProxy::showPlaybackTargetPicker(const WebCore::FloatRect&, bool)
{
ASSERT_NOT_REACHED();
return;
}
void WebMediaPlaybackTargetPickerProxy::startingMonitoringPlaybackTargets()
{
ASSERT_NOT_REACHED();
return;
}
void WebMediaPlaybackTargetPickerProxy::stopMonitoringPlaybackTargets()
{
ASSERT_NOT_REACHED();
return;
}
} // namespace WebKit
#endif // ENABLE(WIRELESS_PLAYBACK_TARGET)
| [
"[email protected]@268f45cc-cd09-0410-ab3c-d52691b4dbfc"
] | [email protected]@268f45cc-cd09-0410-ab3c-d52691b4dbfc |
9714afffb5218085a66cd631adeb24e7b37328bb | cc1d60d7a55dce35e02f0f901c1fb0f0c8ecba87 | /src/bluelime.cpp | ad5e3680f7b610912bb12accb6e65950aab6e624 | [] | no_license | WSID/BlueLime | b147a7809824bd292017fd2d7d37102549742943 | 010d9bd0f331ee1dfcdca96138c1500e4fff11cc | refs/heads/master | 2020-12-30T07:21:50.152318 | 2020-07-27T13:30:01 | 2020-07-27T13:30:01 | 238,907,014 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,956 | cpp |
#include <cstdint>
#include <utility>
#include "app_auth.hpp"
#include "bluelime.hpp"
// ChatListPage -> ChatPage -> StickerPage
// ^- AuthPage
template <typename T, void (T::*function)(Evas_Object*)>
class mf_2_cb {
public:
static void callback (void *data, Evas_Object *obj, void *einfo) {
T* self = (T*)data;
(self->*function)(obj);
}
};
app::app ()
{
part_client.run_poller();
create_base_gui ();
part_auth = std::make_unique<app_auth> (this, part_client);
}
app::~ app () {
}
// Callback for application lifecycle
void app::control(app_control_h app_control) {}
void app::pause () {}
void app::resume () {}
// Callback for UI application events
void app::ui_lang_changed (app_event_info_h event_info) {
/*APP_EVENT_LANGUAGE_CHANGED*/
char *locale = NULL;
system_settings_get_value_string(SYSTEM_SETTINGS_KEY_LOCALE_LANGUAGE, &locale);
elm_language_set(locale);
free(locale);
return;
}
void app::ui_orient_changed (app_event_info_h event_info) {}
void app::ui_region_changed (app_event_info_h event_info) {}
void app::ui_low_battery (app_event_info_h event_info) {}
void app::ui_low_memory (app_event_info_h event_info) {}
void app::create_base_gui () {
win = elm_win_util_standard_add(PACKAGE, PACKAGE);
elm_win_autodel_set(win, true);
evas_object_smart_callback_add (win, "delete,request",
&mf_2_cb<app, &app::on_win_delete_request>::callback, this);
eext_object_event_callback_add (win, EEXT_CALLBACK_BACK,
&mf_2_cb<app, &app::on_win_back>::callback, this);
/* Conformant */
/* Create and initialize elm_conformant.
elm_conformant is mandatory for base gui to have proper size
when indicator or virtual keypad is visible. */
conform = elm_conformant_add(win);
elm_win_indicator_mode_set(win, ELM_WIN_INDICATOR_SHOW);
elm_win_indicator_opacity_set(win, ELM_WIN_INDICATOR_OPAQUE);
evas_object_size_hint_weight_set(conform, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
elm_win_resize_object_add(win, conform);
evas_object_show(conform);
/* Naviframe */
naviframe = elm_naviframe_add(conform);
elm_object_content_set(conform, naviframe);
circle_surface = eext_circle_surface_naviframe_add (naviframe);
/* Page 1 */
chat_list_page = std::make_shared <ChatListPage> (part_client, naviframe, circle_surface);
elm_naviframe_item_push(naviframe, NULL, NULL, NULL, chat_list_page->chat_genlist, "empty");
/* Show window after base gui is set up */
evas_object_show(win);
}
// Callback functions for windows
void app::on_win_delete_request(Evas_Object *obj) {
ui_app_exit();
}
void app::on_win_back (Evas_Object *obj) {
elm_win_lower (win);
}
int
main(int argc, char *argv[])
{
app *ap = nullptr;
int ret = 0;
ui_app_lifecycle_callback_s event_callback = {0,};
app_event_handler_h handlers[5] = {NULL, };
event_callback.create = [] (void *data) {
data = (void*) new app();
return true;
};
event_callback.terminate = [] (void *data) {
if (data != nullptr) {
delete (app*)data;
data = nullptr;
}
};
event_callback.pause = [] (void *data) {
static_cast<app*>(data)->pause();
};
event_callback.resume = [] (void *data) {
static_cast<app*>(data)->resume();
};
event_callback.app_control = [] (app_control_h control, void *data) {
static_cast<app*>(data)->control (control);
};
ui_app_add_event_handler(
&handlers[APP_EVENT_LOW_BATTERY],
APP_EVENT_LOW_BATTERY,
[] (app_event_info_h event_info, void *data) {
static_cast<app*>(data)->ui_low_battery(event_info);
}, &ap);
ui_app_add_event_handler(
&handlers[APP_EVENT_LOW_MEMORY],
APP_EVENT_LOW_MEMORY,
[] (app_event_info_h event_info, void *data) {
static_cast<app*>(data)->ui_low_memory(event_info);
}, &ap);
ui_app_add_event_handler(
&handlers[APP_EVENT_DEVICE_ORIENTATION_CHANGED],
APP_EVENT_DEVICE_ORIENTATION_CHANGED,
[] (app_event_info_h event_info, void *data) {
static_cast<app*>(data)->ui_orient_changed(event_info);
}, &ap);
ui_app_add_event_handler(
&handlers[APP_EVENT_LANGUAGE_CHANGED],
APP_EVENT_LANGUAGE_CHANGED,
[] (app_event_info_h event_info, void *data) {
static_cast<app*>(data)->ui_lang_changed(event_info);
}, &ap);
ui_app_add_event_handler(
&handlers[APP_EVENT_REGION_FORMAT_CHANGED],
APP_EVENT_REGION_FORMAT_CHANGED,
[] (app_event_info_h event_info, void *data) {
static_cast<app*>(data)->ui_region_changed(event_info);
}, &ap);
ret = ui_app_main(argc, argv, &event_callback, &ap);
if (ret != APP_ERROR_NONE) {
dlog_print(DLOG_ERROR, LOG_TAG, "app_main() is failed. err = %d", ret);
}
return ret;
}
| [
"[email protected]"
] | |
3a21be11bea0ce82196be3b73ed0621156894156 | 69344229656b6a6e5b28e090ae760530f48ff7d9 | /modules/pvDatabase/src/pvAccess/monitorFactory.cpp | 62b411c1c6240d3f0fd2c111f1757bb6634bf2d7 | [
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"MIT"
] | permissive | tnakaicode/EpicsInstall | dafd27ac92f916ff2b70da5bfda2c1070e680b14 | 98cc9fbdd888debff7fe980fa288186a0e9099ed | refs/heads/master | 2020-04-11T16:10:52.784405 | 2018-12-15T09:52:06 | 2018-12-15T09:52:06 | 161,915,330 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 13,615 | cpp | /* monitorFactory.cpp */
/**
* Copyright - See the COPYRIGHT that is included with this distribution.
* EPICS pvData is distributed subject to a Software License Agreement found
* in file LICENSE that is included with this distribution.
*/
/**
* @author Marty Kraimer
* @date 2013.04
*/
#include <sstream>
#include <epicsGuard.h>
#include <pv/thread.h>
#include <pv/bitSetUtil.h>
#include <pv/timeStamp.h>
#define epicsExportSharedSymbols
#include <pv/channelProviderLocal.h>
using namespace epics::pvData;
using namespace epics::pvAccess;
using namespace epics::pvCopy;
using std::tr1::static_pointer_cast;
using std::cout;
using std::endl;
using std::string;
namespace epics { namespace pvDatabase {
class MonitorLocal;
typedef std::tr1::shared_ptr<MonitorLocal> MonitorLocalPtr;
static MonitorPtr nullMonitor;
static MonitorElementPtr NULLMonitorElement;
static Status failedToCreateMonitorStatus(
Status::STATUSTYPE_ERROR,"failed to create monitor");
static Status alreadyStartedStatus(Status::STATUSTYPE_ERROR,"already started");
static Status notStartedStatus(Status::STATUSTYPE_ERROR,"not started");
static Status deletedStatus(Status::STATUSTYPE_ERROR,"record is deleted");
class MonitorElementQueue;
typedef std::tr1::shared_ptr<MonitorElementQueue> MonitorElementQueuePtr;
class MonitorElementQueue
{
private:
MonitorElementPtrArray elements;
// TODO use size_t instead
int size;
int numberFree;
int numberUsed;
int nextGetFree;
int nextSetUsed;
int nextGetUsed;
int nextReleaseUsed;
public:
POINTER_DEFINITIONS(MonitorElementQueue);
MonitorElementQueue(std::vector<MonitorElementPtr> monitorElementArray)
: elements(monitorElementArray),
size(monitorElementArray.size()),
numberFree(size),
numberUsed(0),
nextGetFree(0),
nextSetUsed(0),
nextGetUsed(0),
nextReleaseUsed(0)
{
}
virtual ~MonitorElementQueue() {}
void clear()
{
numberFree = size;
numberUsed = 0;
nextGetFree = 0;
nextSetUsed = 0;
nextGetUsed = 0;
nextReleaseUsed = 0;
}
MonitorElementPtr getFree()
{
if(numberFree==0) return MonitorElementPtr();
numberFree--;
int ind = nextGetFree;
MonitorElementPtr queueElement = elements[nextGetFree++];
if(nextGetFree>=size) nextGetFree = 0;
return elements[ind];
}
void setUsed(MonitorElementPtr const &element)
{
if(element!=elements[nextSetUsed++]) {
throw std::logic_error("not correct queueElement");
}
numberUsed++;
if(nextSetUsed>=size) nextSetUsed = 0;
}
MonitorElementPtr getUsed()
{
if(numberUsed==0) return MonitorElementPtr();
int ind = nextGetUsed;
MonitorElementPtr queueElement = elements[nextGetUsed++];
if(nextGetUsed>=size) nextGetUsed = 0;
return elements[ind];
}
void releaseUsed(MonitorElementPtr const &element)
{
if(element!=elements[nextReleaseUsed++]) {
throw std::logic_error(
"not queueElement returned by last call to getUsed");
}
if(nextReleaseUsed>=size) nextReleaseUsed = 0;
numberUsed--;
numberFree++;
}
};
typedef std::tr1::shared_ptr<MonitorRequester> MonitorRequesterPtr;
class MonitorLocal :
public Monitor,
public PVListener,
public std::tr1::enable_shared_from_this<MonitorLocal>
{
enum MonitorState {idle,active,deleted};
public:
POINTER_DEFINITIONS(MonitorLocal);
virtual ~MonitorLocal();
virtual Status start();
virtual Status stop();
virtual MonitorElementPtr poll();
virtual void destroy() EPICS_DEPRECATED {};
virtual void detach(PVRecordPtr const & pvRecord){}
virtual void release(MonitorElementPtr const & monitorElement);
virtual void dataPut(PVRecordFieldPtr const & pvRecordField);
virtual void dataPut(
PVRecordStructurePtr const & requested,
PVRecordFieldPtr const & pvRecordField);
virtual void beginGroupPut(PVRecordPtr const & pvRecord);
virtual void endGroupPut(PVRecordPtr const & pvRecord);
virtual void unlisten(PVRecordPtr const & pvRecord);
MonitorElementPtr getActiveElement();
void releaseActiveElement();
bool init(PVStructurePtr const & pvRequest);
MonitorLocal(
MonitorRequester::shared_pointer const & channelMonitorRequester,
PVRecordPtr const &pvRecord);
PVCopyPtr getPVCopy() { return pvCopy;}
private:
MonitorLocalPtr getPtrSelf()
{
return shared_from_this();
}
MonitorRequester::weak_pointer monitorRequester;
PVRecordPtr pvRecord;
MonitorState state;
PVCopyPtr pvCopy;
MonitorElementQueuePtr queue;
MonitorElementPtr activeElement;
bool isGroupPut;
bool dataChanged;
Mutex mutex;
Mutex queueMutex;
};
MonitorLocal::MonitorLocal(
MonitorRequester::shared_pointer const & channelMonitorRequester,
PVRecordPtr const &pvRecord)
: monitorRequester(channelMonitorRequester),
pvRecord(pvRecord),
state(idle),
isGroupPut(false),
dataChanged(false)
{
}
MonitorLocal::~MonitorLocal()
{
if(pvRecord->getTraceLevel()>0)
{
cout << "MonitorLocal::~MonitorLocal()" << endl;
}
}
Status MonitorLocal::start()
{
if(pvRecord->getTraceLevel()>0)
{
cout << "MonitorLocal::start state " << state << endl;
}
{
Lock xx(mutex);
if(state==active) return alreadyStartedStatus;
if(state==deleted) return deletedStatus;
}
pvRecord->addListener(getPtrSelf(),pvCopy);
epicsGuard <PVRecord> guard(*pvRecord);
Lock xx(mutex);
state = active;
queue->clear();
isGroupPut = false;
activeElement = queue->getFree();
activeElement->changedBitSet->clear();
activeElement->overrunBitSet->clear();
activeElement->changedBitSet->set(0);
releaseActiveElement();
return Status::Ok;
}
Status MonitorLocal::stop()
{
if(pvRecord->getTraceLevel()>0){
cout << "MonitorLocal::stop state " << state << endl;
}
{
Lock xx(mutex);
if(state==idle) return notStartedStatus;
if(state==deleted) return deletedStatus;
state = idle;
}
pvRecord->removeListener(getPtrSelf(),pvCopy);
return Status::Ok;
}
MonitorElementPtr MonitorLocal::poll()
{
if(pvRecord->getTraceLevel()>1)
{
cout << "MonitorLocal::poll state " << state << endl;
}
{
Lock xx(queueMutex);
if(state!=active) return NULLMonitorElement;
return queue->getUsed();
}
}
void MonitorLocal::release(MonitorElementPtr const & monitorElement)
{
if(pvRecord->getTraceLevel()>1)
{
cout << "MonitorLocal::release state " << state << endl;
}
{
Lock xx(queueMutex);
if(state!=active) return;
queue->releaseUsed(monitorElement);
}
}
void MonitorLocal::releaseActiveElement()
{
if(pvRecord->getTraceLevel()>1)
{
cout << "MonitorLocal::releaseActiveElement state " << state << endl;
}
{
Lock xx(queueMutex);
if(state!=active) return;
bool result = pvCopy->updateCopyFromBitSet(activeElement->pvStructurePtr,activeElement->changedBitSet);
if(!result) return;
MonitorElementPtr newActive = queue->getFree();
if(!newActive) return;
BitSetUtil::compress(activeElement->changedBitSet,activeElement->pvStructurePtr);
BitSetUtil::compress(activeElement->overrunBitSet,activeElement->pvStructurePtr);
queue->setUsed(activeElement);
activeElement = newActive;
activeElement->changedBitSet->clear();
activeElement->overrunBitSet->clear();
}
MonitorRequesterPtr requester = monitorRequester.lock();
if(!requester) return;
requester->monitorEvent(getPtrSelf());
return;
}
void MonitorLocal::dataPut(PVRecordFieldPtr const & pvRecordField)
{
if(pvRecord->getTraceLevel()>1)
{
cout << "PVCopyMonitor::dataPut(pvRecordField)" << endl;
}
if(state!=active) return;
{
Lock xx(mutex);
size_t offset = pvCopy->getCopyOffset(pvRecordField->getPVField());
BitSetPtr const &changedBitSet = activeElement->changedBitSet;
BitSetPtr const &overrunBitSet = activeElement->overrunBitSet;
bool isSet = changedBitSet->get(offset);
changedBitSet->set(offset);
if(isSet) overrunBitSet->set(offset);
dataChanged = true;
}
if(!isGroupPut) {
releaseActiveElement();
dataChanged = false;
}
}
void MonitorLocal::dataPut(
PVRecordStructurePtr const & requested,
PVRecordFieldPtr const & pvRecordField)
{
if(pvRecord->getTraceLevel()>1)
{
cout << "PVCopyMonitor::dataPut(requested,pvRecordField)" << endl;
}
if(state!=active) return;
{
Lock xx(mutex);
BitSetPtr const &changedBitSet = activeElement->changedBitSet;
BitSetPtr const &overrunBitSet = activeElement->overrunBitSet;
size_t offsetCopyRequested = pvCopy->getCopyOffset(
requested->getPVField());
size_t offset = offsetCopyRequested
+ (pvRecordField->getPVField()->getFieldOffset()
- requested->getPVField()->getFieldOffset());
bool isSet = changedBitSet->get(offset);
changedBitSet->set(offset);
if(isSet) overrunBitSet->set(offset);
dataChanged = true;
}
if(!isGroupPut) {
releaseActiveElement();
dataChanged = false;
}
}
void MonitorLocal::beginGroupPut(PVRecordPtr const & pvRecord)
{
if(pvRecord->getTraceLevel()>1)
{
cout << "PVCopyMonitor::beginGroupPut()" << endl;
}
if(state!=active) return;
{
Lock xx(mutex);
isGroupPut = true;
dataChanged = false;
}
}
void MonitorLocal::endGroupPut(PVRecordPtr const & pvRecord)
{
if(pvRecord->getTraceLevel()>1)
{
cout << "PVCopyMonitor::endGroupPut dataChanged " << dataChanged << endl;
}
if(state!=active) return;
{
Lock xx(mutex);
isGroupPut = false;
}
if(dataChanged) {
dataChanged = false;
releaseActiveElement();
}
}
void MonitorLocal::unlisten(PVRecordPtr const & pvRecord)
{
if(pvRecord->getTraceLevel()>1)
{
cout << "PVCopyMonitor::unlisten\n";
}
{
Lock xx(mutex);
state = deleted;
}
MonitorRequesterPtr requester = monitorRequester.lock();
if(requester) {
if(pvRecord->getTraceLevel()>1)
{
cout << "PVCopyMonitor::unlisten calling requester->unlisten\n";
}
requester->unlisten(getPtrSelf());
}
}
bool MonitorLocal::init(PVStructurePtr const & pvRequest)
{
PVFieldPtr pvField;
size_t queueSize = 2;
PVStructurePtr pvOptions = pvRequest->getSubField<PVStructure>("record._options");
MonitorRequesterPtr requester = monitorRequester.lock();
if(!requester) return false;
if(pvOptions) {
PVStringPtr pvString = pvOptions->getSubField<PVString>("queueSize");
if(pvString) {
try {
int32 size;
std::stringstream ss;
ss << pvString->get();
ss >> size;
queueSize = size;
} catch (...) {
requester->message("queueSize " +pvString->get() + " illegal",errorMessage);
return false;
}
}
}
pvField = pvRequest->getSubField("field");
if(!pvField) {
pvCopy = PVCopy::create(
pvRecord->getPVRecordStructure()->getPVStructure(),
pvRequest,"");
if(!pvCopy) {
requester->message("illegal pvRequest",errorMessage);
return false;
}
} else {
if(pvField->getField()->getType()!=structure) {
requester->message("illegal pvRequest",errorMessage);
return false;
}
pvCopy = PVCopy::create(
pvRecord->getPVRecordStructure()->getPVStructure(),
pvRequest,"field");
if(!pvCopy) {
requester->message("illegal pvRequest",errorMessage);
return false;
}
}
if(queueSize<2) queueSize = 2;
std::vector<MonitorElementPtr> monitorElementArray;
monitorElementArray.reserve(queueSize);
for(size_t i=0; i<queueSize; i++) {
PVStructurePtr pvStructure = pvCopy->createPVStructure();
MonitorElementPtr monitorElement(
new MonitorElement(pvStructure));
monitorElementArray.push_back(monitorElement);
}
queue = MonitorElementQueuePtr(new MonitorElementQueue(monitorElementArray));
requester->monitorConnect(
Status::Ok,
getPtrSelf(),
pvCopy->getStructure());
return true;
}
MonitorPtr createMonitorLocal(
PVRecordPtr const & pvRecord,
MonitorRequester::shared_pointer const & monitorRequester,
PVStructurePtr const & pvRequest)
{
MonitorLocalPtr monitor(new MonitorLocal(
monitorRequester,pvRecord));
bool result = monitor->init(pvRequest);
if(!result) {
MonitorPtr monitor;
StructureConstPtr structure;
monitorRequester->monitorConnect(
failedToCreateMonitorStatus,monitor,structure);
return nullMonitor;
}
if(pvRecord->getTraceLevel()>0)
{
cout << "MonitorFactory::createMonitor"
<< " recordName " << pvRecord->getRecordName() << endl;
}
return monitor;
}
}}
| [
"[email protected]"
] | |
b3def9818688197b9a6832bd0625f1da02c348e2 | 096e862f59cf0d2acf0ce05578f913a148cc653d | /code/apps/Messaging/jni/GifTranscoder.cpp | 0e8398243b66592ba74ed0e975f8076748ba0317 | [] | no_license | Phenix-Collection/Android-6.0-packages | e2ba7f7950c5df258c86032f8fbdff42d2dfc26a | ac1a67c36f90013ac1de82309f84bd215d5fdca9 | refs/heads/master | 2021-10-10T20:52:24.087442 | 2017-05-27T05:52:42 | 2017-05-27T05:52:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 22,883 | cpp | /*
* Copyright (C) 2015 The Android Open Source Project
*
* 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 <jni.h>
#include <time.h>
#include <stdio.h>
#include <memory>
#include <vector>
#include <android/log.h>
#include "GifTranscoder.h"
#define SQUARE(a) (a)*(a)
// GIF does not support partial transparency, so our alpha channels are always 0x0 or 0xff.
static const ColorARGB TRANSPARENT = 0x0;
#define ALPHA(color) (((color) >> 24) & 0xff)
#define RED(color) (((color) >> 16) & 0xff)
#define GREEN(color) (((color) >> 8) & 0xff)
#define BLUE(color) (((color) >> 0) & 0xff)
#define MAKE_COLOR_ARGB(a, r, g, b) \
((a) << 24 | (r) << 16 | (g) << 8 | (b))
#define MAX_COLOR_DISTANCE 255 * 255 * 255
#define TAG "GifTranscoder.cpp"
#define LOGD_ENABLED 0
#if LOGD_ENABLED
#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, TAG, __VA_ARGS__))
#else
#define LOGD(...) ((void)0)
#endif
#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, TAG, __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, TAG, __VA_ARGS__))
#define LOGE(...) ((void)__android_log_print(ANDROID_LOG_ERROR, TAG, __VA_ARGS__))
// This macro expects the assertion to pass, but logs a FATAL if not.
#define ASSERT(cond, ...) \
( (__builtin_expect((cond) == 0, 0)) \
? ((void)__android_log_assert(#cond, TAG, ## __VA_ARGS__)) \
: (void) 0 )
#define ASSERT_ENABLED 1
namespace {
// Current time in milliseconds since Unix epoch.
double now(void) {
struct timespec res;
clock_gettime(CLOCK_REALTIME, &res);
return 1000.0 * res.tv_sec + (double) res.tv_nsec / 1e6;
}
// Gets the pixel at position (x,y) from a buffer that uses row-major order to store an image with
// the specified width.
template <typename T>
T* getPixel(T* buffer, int width, int x, int y) {
return buffer + (y * width + x);
}
} // namespace
int GifTranscoder::transcode(const char* pathIn, const char* pathOut) {
int error;
double t0;
GifFileType* gifIn;
GifFileType* gifOut;
// Automatically closes the GIF files when this method returns
GifFilesCloser closer;
gifIn = DGifOpenFileName(pathIn, &error);
if (gifIn) {
closer.setGifIn(gifIn);
LOGD("Opened input GIF: %s", pathIn);
} else {
LOGE("Could not open input GIF: %s, error = %d", pathIn, error);
return GIF_ERROR;
}
gifOut = EGifOpenFileName(pathOut, false, &error);
if (gifOut) {
closer.setGifOut(gifOut);
LOGD("Opened output GIF: %s", pathOut);
} else {
LOGE("Could not open output GIF: %s, error = %d", pathOut, error);
return GIF_ERROR;
}
t0 = now();
if (resizeBoxFilter(gifIn, gifOut)) {
LOGD("Resized GIF in %.2f ms", now() - t0);
} else {
LOGE("Could not resize GIF");
return GIF_ERROR;
}
return GIF_OK;
}
bool GifTranscoder::resizeBoxFilter(GifFileType* gifIn, GifFileType* gifOut) {
ASSERT(gifIn != NULL, "gifIn cannot be NULL");
ASSERT(gifOut != NULL, "gifOut cannot be NULL");
if (gifIn->SWidth < 0 || gifIn->SHeight < 0) {
LOGE("Input GIF has invalid size: %d x %d", gifIn->SWidth, gifIn->SHeight);
return false;
}
// Output GIF will be 50% the size of the original.
if (EGifPutScreenDesc(gifOut,
gifIn->SWidth / 2,
gifIn->SHeight / 2,
gifIn->SColorResolution,
gifIn->SBackGroundColor,
gifIn->SColorMap) == GIF_ERROR) {
LOGE("Could not write screen descriptor");
return false;
}
LOGD("Wrote screen descriptor");
// Index of the current image.
int imageIndex = 0;
// Transparent color of the current image.
int transparentColor = NO_TRANSPARENT_COLOR;
// Buffer for reading raw images from the input GIF.
std::vector<GifByteType> srcBuffer(gifIn->SWidth * gifIn->SHeight);
// Buffer for rendering images from the input GIF.
std::unique_ptr<ColorARGB[]> renderBuffer(new ColorARGB[gifIn->SWidth * gifIn->SHeight]);
// Buffer for writing new images to output GIF (one row at a time).
std::unique_ptr<GifByteType[]> dstRowBuffer(new GifByteType[gifOut->SWidth]);
// Many GIFs use DISPOSE_DO_NOT to make images draw on top of previous images. They can also
// use DISPOSE_BACKGROUND to clear the last image region before drawing the next one. We need
// to keep track of the disposal mode as we go along to properly render the GIF.
int disposalMode = DISPOSAL_UNSPECIFIED;
int prevImageDisposalMode = DISPOSAL_UNSPECIFIED;
GifImageDesc prevImageDimens;
// Background color (applies to entire GIF).
ColorARGB bgColor = TRANSPARENT;
GifRecordType recordType;
do {
if (DGifGetRecordType(gifIn, &recordType) == GIF_ERROR) {
LOGE("Could not get record type");
return false;
}
LOGD("Read record type: %d", recordType);
switch (recordType) {
case IMAGE_DESC_RECORD_TYPE: {
if (DGifGetImageDesc(gifIn) == GIF_ERROR) {
LOGE("Could not read image descriptor (%d)", imageIndex);
return false;
}
// Sanity-check the current image position.
if (gifIn->Image.Left < 0 ||
gifIn->Image.Top < 0 ||
gifIn->Image.Left + gifIn->Image.Width > gifIn->SWidth ||
gifIn->Image.Top + gifIn->Image.Height > gifIn->SHeight) {
LOGE("GIF image extends beyond logical screen");
return false;
}
// Write the new image descriptor.
if (EGifPutImageDesc(gifOut,
0, // Left
0, // Top
gifOut->SWidth,
gifOut->SHeight,
false, // Interlace
gifIn->Image.ColorMap) == GIF_ERROR) {
LOGE("Could not write image descriptor (%d)", imageIndex);
return false;
}
// Read the image from the input GIF. The buffer is already initialized to the
// size of the GIF, which is usually equal to the size of all the images inside it.
// If not, the call to resize below ensures that the buffer is the right size.
srcBuffer.resize(gifIn->Image.Width * gifIn->Image.Height);
if (readImage(gifIn, srcBuffer.data()) == false) {
LOGE("Could not read image data (%d)", imageIndex);
return false;
}
LOGD("Read image data (%d)", imageIndex);
// Render the image from the input GIF.
if (renderImage(gifIn,
srcBuffer.data(),
imageIndex,
transparentColor,
renderBuffer.get(),
bgColor,
prevImageDimens,
prevImageDisposalMode) == false) {
LOGE("Could not render %d", imageIndex);
return false;
}
LOGD("Rendered image (%d)", imageIndex);
// Generate the image in the output GIF.
for (int y = 0; y < gifOut->SHeight; y++) {
for (int x = 0; x < gifOut->SWidth; x++) {
const GifByteType dstColorIndex = computeNewColorIndex(
gifIn, transparentColor, renderBuffer.get(), x, y);
*(dstRowBuffer.get() + x) = dstColorIndex;
}
if (EGifPutLine(gifOut, dstRowBuffer.get(), gifOut->SWidth) == GIF_ERROR) {
LOGE("Could not write raster data (%d)", imageIndex);
return false;
}
}
LOGD("Wrote raster data (%d)", imageIndex);
// Save the disposal mode for rendering the next image.
// We only support DISPOSE_DO_NOT and DISPOSE_BACKGROUND.
prevImageDisposalMode = disposalMode;
if (prevImageDisposalMode == DISPOSAL_UNSPECIFIED) {
prevImageDisposalMode = DISPOSE_DO_NOT;
} else if (prevImageDisposalMode == DISPOSE_PREVIOUS) {
prevImageDisposalMode = DISPOSE_BACKGROUND;
}
if (prevImageDisposalMode == DISPOSE_BACKGROUND) {
prevImageDimens.Left = gifIn->Image.Left;
prevImageDimens.Top = gifIn->Image.Top;
prevImageDimens.Width = gifIn->Image.Width;
prevImageDimens.Height = gifIn->Image.Height;
}
if (gifOut->Image.ColorMap) {
GifFreeMapObject(gifOut->Image.ColorMap);
gifOut->Image.ColorMap = NULL;
}
imageIndex++;
} break;
case EXTENSION_RECORD_TYPE: {
int extCode;
GifByteType* ext;
if (DGifGetExtension(gifIn, &extCode, &ext) == GIF_ERROR) {
LOGE("Could not read extension block");
return false;
}
LOGD("Read extension block, code: %d", extCode);
if (extCode == GRAPHICS_EXT_FUNC_CODE) {
GraphicsControlBlock gcb;
if (DGifExtensionToGCB(ext[0], ext + 1, &gcb) == GIF_ERROR) {
LOGE("Could not interpret GCB extension");
return false;
}
transparentColor = gcb.TransparentColor;
// This logic for setting the background color based on the first GCB
// doesn't quite match the GIF spec, but empirically it seems to work and it
// matches what libframesequence (Rastermill) does.
if (imageIndex == 0 && gifIn->SColorMap) {
if (gcb.TransparentColor == NO_TRANSPARENT_COLOR) {
if (gifIn->SBackGroundColor < 0 ||
gifIn->SBackGroundColor >= gifIn->SColorMap->ColorCount) {
LOGE("SBackGroundColor overflow");
return false;
}
GifColorType bgColorIndex =
gifIn->SColorMap->Colors[gifIn->SBackGroundColor];
bgColor = gifColorToColorARGB(bgColorIndex);
LOGD("Set background color based on first GCB");
}
}
// Record the original disposal mode and then update it.
disposalMode = gcb.DisposalMode;
gcb.DisposalMode = DISPOSE_BACKGROUND;
EGifGCBToExtension(&gcb, ext + 1);
}
if (EGifPutExtensionLeader(gifOut, extCode) == GIF_ERROR) {
LOGE("Could not write extension leader");
return false;
}
if (EGifPutExtensionBlock(gifOut, ext[0], ext + 1) == GIF_ERROR) {
LOGE("Could not write extension block");
return false;
}
LOGD("Wrote extension block");
while (ext != NULL) {
if (DGifGetExtensionNext(gifIn, &ext) == GIF_ERROR) {
LOGE("Could not read extension continuation");
return false;
}
if (ext != NULL) {
LOGD("Read extension continuation");
if (EGifPutExtensionBlock(gifOut, ext[0], ext + 1) == GIF_ERROR) {
LOGE("Could not write extension continuation");
return false;
}
LOGD("Wrote extension continuation");
}
}
if (EGifPutExtensionTrailer(gifOut) == GIF_ERROR) {
LOGE("Could not write extension trailer");
return false;
}
} break;
}
} while (recordType != TERMINATE_RECORD_TYPE);
LOGD("No more records");
return true;
}
bool GifTranscoder::readImage(GifFileType* gifIn, GifByteType* rasterBits) {
if (gifIn->Image.Interlace) {
int interlacedOffset[] = { 0, 4, 2, 1 };
int interlacedJumps[] = { 8, 8, 4, 2 };
// Need to perform 4 passes on the image
for (int i = 0; i < 4; i++) {
for (int j = interlacedOffset[i]; j < gifIn->Image.Height; j += interlacedJumps[i]) {
if (DGifGetLine(gifIn,
rasterBits + j * gifIn->Image.Width,
gifIn->Image.Width) == GIF_ERROR) {
LOGE("Could not read interlaced raster data");
return false;
}
}
}
} else {
if (DGifGetLine(gifIn, rasterBits, gifIn->Image.Width * gifIn->Image.Height) == GIF_ERROR) {
LOGE("Could not read raster data");
return false;
}
}
return true;
}
bool GifTranscoder::renderImage(GifFileType* gifIn,
GifByteType* rasterBits,
int imageIndex,
int transparentColorIndex,
ColorARGB* renderBuffer,
ColorARGB bgColor,
GifImageDesc prevImageDimens,
int prevImageDisposalMode) {
ASSERT(imageIndex < gifIn->ImageCount,
"Image index %d is out of bounds (count=%d)", imageIndex, gifIn->ImageCount);
ColorMapObject* colorMap = getColorMap(gifIn);
if (colorMap == NULL) {
LOGE("No GIF color map found");
return false;
}
// Clear all or part of the background, before drawing the first image and maybe before drawing
// subsequent images (depending on the DisposalMode).
if (imageIndex == 0) {
fillRect(renderBuffer, gifIn->SWidth, gifIn->SHeight,
0, 0, gifIn->SWidth, gifIn->SHeight, bgColor);
} else if (prevImageDisposalMode == DISPOSE_BACKGROUND) {
fillRect(renderBuffer, gifIn->SWidth, gifIn->SHeight,
prevImageDimens.Left, prevImageDimens.Top,
prevImageDimens.Width, prevImageDimens.Height, TRANSPARENT);
}
// Paint this image onto the canvas
for (int y = 0; y < gifIn->Image.Height; y++) {
for (int x = 0; x < gifIn->Image.Width; x++) {
GifByteType colorIndex = *getPixel(rasterBits, gifIn->Image.Width, x, y);
if (colorIndex >= colorMap->ColorCount) {
LOGE("Color Index %d is out of bounds (count=%d)", colorIndex,
colorMap->ColorCount);
return false;
}
// This image may be smaller than the GIF's "logical screen"
int renderX = x + gifIn->Image.Left;
int renderY = y + gifIn->Image.Top;
// Skip drawing transparent pixels if this image renders on top of the last one
if (imageIndex > 0 && prevImageDisposalMode == DISPOSE_DO_NOT &&
colorIndex == transparentColorIndex) {
continue;
}
ColorARGB* renderPixel = getPixel(renderBuffer, gifIn->SWidth, renderX, renderY);
*renderPixel = getColorARGB(colorMap, transparentColorIndex, colorIndex);
}
}
return true;
}
void GifTranscoder::fillRect(ColorARGB* renderBuffer,
int imageWidth,
int imageHeight,
int left,
int top,
int width,
int height,
ColorARGB color) {
ASSERT(left + width <= imageWidth, "Rectangle is outside image bounds");
ASSERT(top + height <= imageHeight, "Rectangle is outside image bounds");
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++) {
ColorARGB* renderPixel = getPixel(renderBuffer, imageWidth, x + left, y + top);
*renderPixel = color;
}
}
}
GifByteType GifTranscoder::computeNewColorIndex(GifFileType* gifIn,
int transparentColorIndex,
ColorARGB* renderBuffer,
int x,
int y) {
ColorMapObject* colorMap = getColorMap(gifIn);
// Compute the average color of 4 adjacent pixels from the input image.
ColorARGB c1 = *getPixel(renderBuffer, gifIn->SWidth, x * 2, y * 2);
ColorARGB c2 = *getPixel(renderBuffer, gifIn->SWidth, x * 2 + 1, y * 2);
ColorARGB c3 = *getPixel(renderBuffer, gifIn->SWidth, x * 2, y * 2 + 1);
ColorARGB c4 = *getPixel(renderBuffer, gifIn->SWidth, x * 2 + 1, y * 2 + 1);
ColorARGB avgColor = computeAverage(c1, c2, c3, c4);
// Search the color map for the best match.
return findBestColor(colorMap, transparentColorIndex, avgColor);
}
ColorARGB GifTranscoder::computeAverage(ColorARGB c1, ColorARGB c2, ColorARGB c3, ColorARGB c4) {
char avgAlpha = (char)(((int) ALPHA(c1) + (int) ALPHA(c2) +
(int) ALPHA(c3) + (int) ALPHA(c4)) / 4);
char avgRed = (char)(((int) RED(c1) + (int) RED(c2) +
(int) RED(c3) + (int) RED(c4)) / 4);
char avgGreen = (char)(((int) GREEN(c1) + (int) GREEN(c2) +
(int) GREEN(c3) + (int) GREEN(c4)) / 4);
char avgBlue = (char)(((int) BLUE(c1) + (int) BLUE(c2) +
(int) BLUE(c3) + (int) BLUE(c4)) / 4);
return MAKE_COLOR_ARGB(avgAlpha, avgRed, avgGreen, avgBlue);
}
GifByteType GifTranscoder::findBestColor(ColorMapObject* colorMap, int transparentColorIndex,
ColorARGB targetColor) {
// Return the transparent color if the average alpha is zero.
char alpha = ALPHA(targetColor);
if (alpha == 0 && transparentColorIndex != NO_TRANSPARENT_COLOR) {
return transparentColorIndex;
}
GifByteType closestColorIndex = 0;
int closestColorDistance = MAX_COLOR_DISTANCE;
for (int i = 0; i < colorMap->ColorCount; i++) {
// Skip the transparent color (we've already eliminated that option).
if (i == transparentColorIndex) {
continue;
}
ColorARGB indexedColor = gifColorToColorARGB(colorMap->Colors[i]);
int distance = computeDistance(targetColor, indexedColor);
if (distance < closestColorDistance) {
closestColorIndex = i;
closestColorDistance = distance;
}
}
return closestColorIndex;
}
int GifTranscoder::computeDistance(ColorARGB c1, ColorARGB c2) {
return SQUARE(RED(c1) - RED(c2)) +
SQUARE(GREEN(c1) - GREEN(c2)) +
SQUARE(BLUE(c1) - BLUE(c2));
}
ColorMapObject* GifTranscoder::getColorMap(GifFileType* gifIn) {
if (gifIn->Image.ColorMap) {
return gifIn->Image.ColorMap;
}
return gifIn->SColorMap;
}
ColorARGB GifTranscoder::getColorARGB(ColorMapObject* colorMap, int transparentColorIndex,
GifByteType colorIndex) {
if (colorIndex == transparentColorIndex) {
return TRANSPARENT;
}
return gifColorToColorARGB(colorMap->Colors[colorIndex]);
}
ColorARGB GifTranscoder::gifColorToColorARGB(const GifColorType& color) {
return MAKE_COLOR_ARGB(0xff, color.Red, color.Green, color.Blue);
}
GifFilesCloser::~GifFilesCloser() {
if (mGifIn) {
DGifCloseFile(mGifIn);
mGifIn = NULL;
}
if (mGifOut) {
EGifCloseFile(mGifOut);
mGifOut = NULL;
}
}
void GifFilesCloser::setGifIn(GifFileType* gifIn) {
ASSERT(mGifIn == NULL, "mGifIn is already set");
mGifIn = gifIn;
}
void GifFilesCloser::releaseGifIn() {
ASSERT(mGifIn != NULL, "mGifIn is already NULL");
mGifIn = NULL;
}
void GifFilesCloser::setGifOut(GifFileType* gifOut) {
ASSERT(mGifOut == NULL, "mGifOut is already set");
mGifOut = gifOut;
}
void GifFilesCloser::releaseGifOut() {
ASSERT(mGifOut != NULL, "mGifOut is already NULL");
mGifOut = NULL;
}
// JNI stuff
jboolean transcode(JNIEnv* env, jobject clazz, jstring filePath, jstring outFilePath) {
const char* pathIn = env->GetStringUTFChars(filePath, JNI_FALSE);
const char* pathOut = env->GetStringUTFChars(outFilePath, JNI_FALSE);
GifTranscoder transcoder;
int gifCode = transcoder.transcode(pathIn, pathOut);
env->ReleaseStringUTFChars(filePath, pathIn);
env->ReleaseStringUTFChars(outFilePath, pathOut);
return (gifCode == GIF_OK);
}
const char *kClassPathName = "com/android/messaging/util/GifTranscoder";
JNINativeMethod kMethods[] = {
{ "transcodeInternal", "(Ljava/lang/String;Ljava/lang/String;)Z", (void*)transcode },
};
int registerNativeMethods(JNIEnv* env, const char* className,
JNINativeMethod* gMethods, int numMethods) {
jclass clazz = env->FindClass(className);
if (clazz == NULL) {
return JNI_FALSE;
}
if (env->RegisterNatives(clazz, gMethods, numMethods) < 0) {
return JNI_FALSE;
}
return JNI_TRUE;
}
jint JNI_OnLoad(JavaVM* vm, void* reserved) {
JNIEnv* env;
if (vm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6) != JNI_OK) {
return -1;
}
if (!registerNativeMethods(env, kClassPathName,
kMethods, sizeof(kMethods) / sizeof(kMethods[0]))) {
return -1;
}
return JNI_VERSION_1_6;
}
| [
"[email protected]"
] | |
122b56f41c17b448f513acc20c92d9a9b64120a5 | 2e1ebd29553dfadb053190ff750713022f9d7444 | /src/parkingslot.h | 15858a1ddbb68e86232ddb41380dcf8508b2f47c | [
"MIT"
] | permissive | FanapSoft/FANAP-IoT-ExampleProject1 | 0e59b1e0086ab47ab9f9acd7d0360284351b90ca | 2ae86048de929fc6b04260ed3115f272a192d27c | refs/heads/master | 2020-04-25T02:23:44.715525 | 2019-05-04T13:29:43 | 2019-05-04T13:29:43 | 172,437,628 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,352 | h | #ifndef _PARKING_SLOT_H_
#define _PARKING_SLOT_H_
#include "ledblinker.h"
#include "sensorcontroller.h"
#include "periodicjob.h"
#include <ArduinoJson.h>
#include "fanaccess.h"
typedef bool (*mqtt_client_pub_t)(const char *, const char *);
class ParkingSlot
{
public:
enum LedState
{
ON,
OFF,
BLINK1,
BLINK2
};
void init(char *device_id, char *enc_key, bool enc_en, int led_pin, int sensor_io,
int sensor_low_thershold, int sensor_high_threshold);
void set_mqtt_publish_access(mqtt_client_pub_t pub_func);
bool process_received_message(char * topic, char * payload, int msg_size);
void handle();
int get_sensor_state()
{
return sensor.get_current_state();
}
int get_sensor_last_value()
{
return sensor.last_sensor_value;
}
void create_send_report();
void apply_key_value_cmd(JsonPair cmd);
FanAccess device;
private:
LedState led_state;
int led_update_time; // ToDo: Replace it with actual time
int sensor_changed_time; // ToDo: Replace it with actual time
LedBlinker blinker;
SensorController sensor;
PeriodicJob report_job;
void set_led(LedState state);
void cmd_led(const char * cmd);
bool send_current_state_to_platform();
const char * get_str_led_state();
};
#endif | [
"[email protected]"
] | |
03d23ffe7dc8509a88fa0d512cf96659d82d8f26 | 4f90a6392ac8f531a7961bfa6b64e70d0e9ee75e | /src/02_flow/star_printer.ex.cpp | 007c614dfea88dc199c151000dc7706413e75201 | [] | no_license | lostsquirrel/cpp_learning | 0c012ae7056704f251e78d73128300a392e9b013 | 75f0871966f93a9d54943530d536bb62bebbbef4 | refs/heads/master | 2021-01-10T07:35:06.761097 | 2019-01-29T13:49:12 | 2019-01-29T13:49:12 | 49,369,022 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,464 | cpp | #include <iostream>
using namespace std;
/*
2.1 使用循环结构打印下述图形,打印行数n由用户输入。图中每行事实上包括两部分,中间间隔空格字符数m也由用户输入。
* *********
*** *******
***** *****
******* ***
********* *
解题思路:
输入为行数, 需要计算
1. 每行开始的空格数 (行数 - 行号)
2. 每行第一组 * 数 (行号 * 2 - 1), 和第二组*数 (行数 - (行号 - 1)) * 2 - 1
因为有明确边界,递增 使用for
*/
int main() {
int line, n, m;
cout << "请输入打印行数: ";
cin >> n;
cout << "请输入隔空格字符数: ";
cin >> m;
for (line = 1; line <= n; line++) {
int j;
// 打印开始空
for (j = 0; j < (n - line); j++) {
cout << " ";
}
// 打印前部*
for (j = 0; j < (line * 2 -1); j++) {
cout << "*";
}
// 打印中间空
for (j = 0; j < m; j++) {
cout << " ";
}
// 打印后部*
for (j = 0; j < ((n - (line - 1)) * 2 - 1); j ++) {
cout << "*";
}
// 换行
cout << endl;
}
return 0;
}
/*
测试用例:
-1 -1
------------
0 0
----------------------------
1 1
* *
------------------
3 3
* *****
*** ***
***** *
----------------------
请输入打印行数: 5
请输入隔空格字符数: 5
* *********
*** *******
***** *****
******* ***
********* *
*/
| [
"[email protected]"
] | |
42a925e0bc32c17e7435b2f8856206b84e4b3f87 | 8a3fce9fb893696b8e408703b62fa452feec65c5 | /业余时间学习笔记/MemPool/MemPool/MemFactory.h | a47423136e5fee2e24c1b42d84ff6fc916d44f51 | [] | no_license | win18216001/tpgame | bb4e8b1a2f19b92ecce14a7477ce30a470faecda | d877dd51a924f1d628959c5ab638c34a671b39b2 | refs/heads/master | 2021-04-12T04:51:47.882699 | 2011-03-08T10:04:55 | 2011-03-08T10:04:55 | 42,728,291 | 0 | 2 | null | null | null | null | GB18030 | C++ | false | false | 1,582 | h |
#pragma once
#include "Pool\BlockPool.h"
#include "Pool\HeapPool.h"
#include "Pool\SamllObjAllocator.h"
#include "Pool\DynamicPool.h"
#include "Factory.h"
#include <set>
#include <map>
using namespace std;
class CMemFactory
{
typedef void* (SmallObjAllocator::*AllocMem)();
typedef bool (SmallObjAllocator::*Destory)(void*);
typedef std::set<void*> SetMap;
typedef std::map<long,DynamicPool* > DynamicMap;
public:
CMemFactory();
void Init();
~CMemFactory()
{
if(m_factory)
{
delete m_factory;
m_factory = NULL;
}
};
void* Alloc(unsigned long size);
void Free(void* pAddr, unsigned long size = 0);
template< class T >
T * Alloc(unsigned long lSize)
{
void* ptMem = Alloc(lSize);
if( !ptMem) return NULL;
T * pt = new(ptMem)T ;
return pt;
}
DEFINE_CALL_CON(1);
DEFINE_CALL_CON(2);
DEFINE_CALL_CON(3);
DEFINE_CALL_CON(4);
DEFINE_CALL_CON(5);
DEFINE_CALL_CON(6);
DEFINE_CALL_CON(7);
DEFINE_CALL_CON(8);
DEFINE_CALL_CON(9);
DEFINE_CALL_CON(10);
template <class T>
void FreeObj( T * pt , unsigned long size = 0)
{
if( !pt ) return ;
pt->~T();
Free(pt,size);
}
int Index(unsigned long size);
void Print()
{
m_factory->Print();
}
private:
/// 二种分配方式
//BlockPool m_Block;
//HeapPool m_Heap;
Factory<long,SmallObjAllocator*,AllocMem,Destory>* m_factory;
DynamicMap m_dynamic;
AllocMem m_alloc ;
Destory m_destory;
Dynamic m_mapList;
}; | [
"[email protected]"
] | |
e10fae006943fe9e6c8afbc76d5311327663717b | e413e4020617f2645f7f3ed89ec698183c17e919 | /fregl/maciej_seg/fnsl3d_filter.cxx | b9992898433e217dc8afbb8245755ae6ea5e3464 | [] | no_license | YanXuHappygela/Farsight-latest | 5c349421b75262f89352cc05093c04d3d6dfb9b0 | 021b1766dc69138dcd64a5f834fdb558bc558a27 | refs/heads/master | 2020-04-24T13:28:25.601628 | 2014-09-30T18:51:29 | 2014-09-30T18:51:29 | 24,650,739 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,725 | cxx | /*=========================================================================
Copyright 2009 Rensselaer Polytechnic Institute
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 "fnsl3d_filter.h"
#include "itkImageFileWriter.h"
#include "itkRescaleIntensityImageFilter.h"
#include "itkImageFileReader.h"
#include "itkImageSeriesReader.h"
#include "itkCastImageFilter.h"
#include "itkObject.h"
//: Constructor
fnsl3d_filter::
fnsl3d_filter()
{
}
//: Destructor
fnsl3d_filter::
~fnsl3d_filter()
{
}
/** @biref fitlers image using a median filter and then opens image
* @param img ITK pointer to image
* @param radius radius to use as the kernel for filtering
* @return ITK image pointer to filtered image
*/
// Code directly out of Maciej implemenation
fnsl3d_filter::ImageType::Pointer
fnsl3d_filter::
median_open_image(ImageType::Pointer img,int radius)
{
//set neighborhood
ImageType::SizeType miIndexRadius;
miIndexRadius[0] = radius; // radius along x
miIndexRadius[1] = radius; // radius along y
miIndexRadius[2] = 0; // radius along z
MedianFilterType::Pointer f_med = MedianFilterType::New();
//set radius and input
f_med->SetRadius( miIndexRadius );
f_med->SetInput( img );
OpenFilterType::Pointer f_open = OpenFilterType::New();
StructuringElementType structuringElement;
structuringElement.SetRadius( radius );
structuringElement.CreateStructuringElement();
f_open->SetKernel( structuringElement );
//connect open to medium filter
f_open->SetInput( f_med->GetOutput() );
try
{
f_open->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception in OpenFilter: " << e << std::endl;
exit(0);
}
return f_open->GetOutput();
}
/** @brief calculates the max,min,mean and std of the image
* @param image ITK image pointer to input image
* @param max maximum value of image
* @param min minimum value of image
* @param mean mean value of image
* @param std standard deviation of image
* @param std_flag set true if std needs to be calculated
*/
// Code directly out of Maciej implemenation
void
fnsl3d_filter::
get_min_max_mean_std(ImageType::Pointer image, double &max, double &min,
double &mean, double &std, bool std_flag)
{
//create iterator for image
ConstIteratorType cit( image, image->GetRequestedRegion() );
double count=0.0;
max=0;
min=0;
bool init = true;
mean=0.0;
std=0.0;
//iterate throught image and finds min max
for ( cit.GoToBegin(); !cit.IsAtEnd(); ++cit )
{
double i=cit.Get();
if(init)
{
max=i;
min=i;
init = false;
}
if(i>max)
max=i;
if(i<min)
min=i;
mean+=i;
count++;
}
mean/=count;
//calculate std
if(std_flag)
{
for ( cit.GoToBegin(); !cit.IsAtEnd(); ++cit )
{
double i=cit.Get();
std+=(i-mean)*(i-mean);
}
std/=count;
std=sqrt(std);
}
}
/** @brief filters the image using a morphological gradient filter
* uses an open and erode filter to get morphological gradient
* @param img ITK image pointer to input image
* @param radius size of filtering kernel
* @return ITK pointer to the morphological gradient of image
*/
fnsl3d_filter::ImageType::Pointer
fnsl3d_filter::
morph_gradient(ImageType::Pointer img,int radius)
{
//create filters
ErodeFilterType::Pointer f_erode = ErodeFilterType::New();
DilateFilterType::Pointer f_dilate = DilateFilterType::New();
OpenFilterType::Pointer f_open = OpenFilterType::New();
SubFilterType::Pointer f_sub = SubFilterType::New();
StructuringElementType structuringElement;
structuringElement.SetRadius( radius );
structuringElement.CreateStructuringElement();
//set kernel
f_erode->SetKernel( structuringElement );
f_dilate->SetKernel( structuringElement );
f_open->SetKernel( structuringElement );
//connect open to medium filter
f_open->SetInput( img );
//connect open to erode and dilate
f_erode->SetInput( f_open->GetOutput() );
f_dilate->SetInput( f_open->GetOutput() );
//set inputs of substract filter for morphological gradient
//(dilation-erosion=morphological gradient)
f_sub->SetInput1( f_dilate->GetOutput() );
f_sub->SetInput2( f_erode->GetOutput() );
try
{
f_sub->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception in SubFilter: " << e << std::endl;
exit(0);
}
return f_sub->GetOutput();
}
/** @brief thresholds the image and then calculates the distance map
* @param img ITK image pointer to input image
* @param hor number of horizontal windows for thresholding
* @param ver number of vertical windows for thresholding
* @param dep number of depth windows for thresholding
* @param param parameter used in calculating the threshold value
* @return ITK image pointer to filtered image
*/
fnsl3d_filter::ImageType::Pointer
fnsl3d_filter::
threshold_distance_map(ImageType::Pointer img,int hor,int ver,int dep,
double param)
{
//create temp image
ImageType::Pointer im_thresh = ImageType::New();
im_thresh->SetRegions(region_);
im_thresh->CopyInformation( img );
im_thresh->Allocate();
int dsize=0;
for(int k=0;k<dep;k++) {
int vsize=0;
for(int j=0;j<ver;j++) {
int hsize=0;
for(int i=0;i<hor;i++) {
//divide up the regions into a grid for processing
ImageType::IndexType start;
start[0] = hsize;
start[1] = vsize;
start[2] = dsize;
ImageType::SizeType size;
size[0] =(image_size_[0] - hsize)/(hor - i);
size[1] =(image_size_[1] - vsize)/(ver - j);
size[2] =(image_size_[2] - dsize)/(dep - k);
//set the desired region
ImageType::RegionType desiredRegion;
desiredRegion.SetSize( size );
desiredRegion.SetIndex( start );
//create region of interest filter
RegionFilterType::Pointer f_region = RegionFilterType::New();
//set the region of the filter and update filter
f_region->SetRegionOfInterest( desiredRegion );
f_region->SetInput( img );
try
{
f_region->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception in RegionFilter: " << e << std::endl;
exit(0);
}
//create binary threshold filter
ThreshFilterType::Pointer f_thresh = ThreshFilterType::New();
//set the binary output
const PixelType outsideValue = 0;
const PixelType insideValue = 255;
f_thresh->SetOutsideValue( outsideValue );
f_thresh->SetInsideValue( insideValue );
double max, min, mean,std;
//get the min max mean and std
get_min_max_mean_std(f_region->GetOutput(),max,min,mean,std,true);
//set the threshold
PixelType lowerThreshold = 0;
PixelType upperThreshold = mean + param*std;
if( upperThreshold < 1 )
upperThreshold = 1;
else if( upperThreshold > 254 )
upperThreshold = 254;
f_thresh->SetLowerThreshold( lowerThreshold );
f_thresh->SetUpperThreshold( upperThreshold );
//update
f_thresh->SetInput(f_region->GetOutput());
try
{
f_thresh->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception in ThreshFilter: " << e << std::endl;
exit(0);
}
//create iterators
IteratorType it( im_thresh,desiredRegion );
ConstIndexIteratorType ciit( f_thresh->GetOutput(),
f_thresh->GetOutput()->GetLargestPossibleRegion() );
//save into image
for ( ciit.GoToBegin(),it.GoToBegin(); !ciit.IsAtEnd();
++ciit, ++it)
{
it.Set(ciit.Get());
//save miIndex if pixel is background
if(ciit.Get() == 255)
vIndex_.push_back(it.GetIndex());
}
hsize+=image_size_[0]/hor;
}
vsize+=image_size_[1]/ver;
}
dsize+=image_size_[2]/dep;
}
/*
//save_image( im_thresh, "thred_image.tif");
typedef itk::Image< unsigned char, 3 > InputImageType;
typedef itk::Image< float, 3 > tempImageType;
typedef itk::DanielssonDistanceMapImageFilter<
InputImageType, tempImageType > F_Type;
typedef itk::ImageSeriesReader< InputImageType > ReaderType;
ReaderType::Pointer reader = ReaderType::New();
reader->AddFileName( "thred_image.tif" );
reader->AddFileName( "thred_image.tif" );
reader->AddFileName( "thred_image.tif" );
F_Type::Pointer f_daniel = F_Type::New();
f_daniel->InputIsBinaryOn();
f_daniel->SetInput(reader->GetOutput());
*/
/*
typedef itk::Image< unsigned char, 3 > InputImageType;
typedef itk::CastImageFilter< ImageType, ImageType> CastFilterType;
CastFilterType::Pointer castFilter = CastFilterType::New();
castFilter->SetInput( im_thresh );
typedef itk::DanielssonDistanceMapImageFilter<
ImageType, ImageType > F_Type;
F_Type::Pointer f_daniel = F_Type::New();
f_daniel->InputIsBinaryOn();
f_daniel->SetInput(castFilter->GetOutput());
*/
// Please note: DanielFilter cannot handle image volume of one slice.
DanielFilterType::Pointer f_daniel = DanielFilterType::New();
//update
f_daniel->InputIsBinaryOn();
f_daniel->SetInput(im_thresh);
try
{
f_daniel->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception in DanielFiltere: " << e << std::endl;
exit(0);
}
return f_daniel->GetOutput();
}
/** @brief inverts the distance image and then combines with morphological gradient
* @param imgDaniel ITK image pointer to distance image
* @param imgMorphGrad ITK image pointer to morphological gradient image
* @param sigma sigma for gaussian filter
* @return ITK image pointer to filtered image
*/
fnsl3d_filter::ImageType::Pointer
fnsl3d_filter::
combine_invert_distance(ImageType::Pointer imgDaniel,
ImageType::Pointer imgMorphGrad,
double sigma)
{
double max, min, mean,std;
//calculate the max and min
get_min_max_mean_std(imgMorphGrad,max,min,mean,std,false);
IteratorType it_dan(imgDaniel,imgDaniel->GetLargestPossibleRegion());
ConstIteratorType cit_morph(imgMorphGrad,imgMorphGrad->GetLargestPossibleRegion());
int i;
//calculate normalized gradient and save the gradient into temp image
for (i=0, it_dan.GoToBegin(),cit_morph.GoToBegin(); !cit_morph.IsAtEnd();
++it_dan, ++cit_morph,i++)
{
it_dan.Set(it_dan.Get() * exp( (max-cit_morph.Get() ) / (max-min) ));
}
GaussFilterType::Pointer f_gauss = GaussFilterType::New();
//set the variance and update
f_gauss->SetVariance(sigma);
f_gauss->SetInput(imgDaniel);
try
{
f_gauss->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception in GaussFilter: " << e << std::endl;
exit(0);
}
//get max to invert image
get_min_max_mean_std(f_gauss->GetOutput(),max,min,mean,std,false);
//invert distnace
IteratorType it_gauss(f_gauss->GetOutput(),f_gauss->GetOutput()->GetLargestPossibleRegion());
for(it_gauss.GoToBegin();!it_gauss.IsAtEnd();++it_gauss)
{
it_gauss.Set( max - it_gauss.Get() );
}
IndexIteratorType iit_gauss( f_gauss->GetOutput(), f_gauss->GetOutput()->GetLargestPossibleRegion() );
//force background to be 255
iit_gauss.GoToBegin();
for (unsigned int i=0;i<vIndex_.size();i++)
{
iit_gauss.SetIndex(vIndex_[i]);
iit_gauss.Set(255);
}
return f_gauss->GetOutput();
}
/** @brief prefilter the images and save all neccessary temp images
* @param img grayscale image
*/
void
fnsl3d_filter::
run_filter(InputImageType::Pointer img, int rad_med, int rad_grad,
int gridX, int gridY, double paramT, double sigma )
{
/*
//load green channel
mOutputImageType::Pointer point = load_channel(crsName,crsPath,crsType,
crStart,crEnd,crWidth);
*/
region_ = img->GetLargestPossibleRegion();
ImageType::SizeType im_size = region_.GetSize();
image_size_[0] = im_size[0];
image_size_[1] = im_size[1];
image_size_[2] = im_size[2];
typedef itk::CastImageFilter<fnsl3d_filter::InputImageType,
ImageType> castFilterType;
castFilterType::Pointer caster = castFilterType::New();
caster->SetInput(img);
imgpIntenisty_ = caster->GetOutput();
std::cout << "Median Filter" << std::endl;
ImageType::Pointer im_thresh = median_open_image(imgpIntenisty_, rad_med);
//create temp image
/*
ImageType::Pointer im_thresh = ImageType::New();
im_thresh->SetRegions(region_);
im_thresh->CopyInformation( point );
im_thresh->Allocate();
ConstIteratorType cit( point,point->GetLargestPossibleRegion() );
IteratorType it( im_thresh,im_thresh->GetLargestPossibleRegion() );
//save into temp image
for ( cit.GoToBegin(),it.GoToBegin(); !cit.IsAtEnd(); ++cit,++it)
{
it.Set( cit.Get() );
}
*/
std::cout << "Threshold" << std::endl;
ImageType::Pointer im_thrd_dst_map =
threshold_distance_map(im_thresh, gridX, gridY, 1 , paramT);
std::cout << "Morphing" << std::endl;
imgpGradient_ = morph_gradient(im_thresh, rad_grad);
std::cout << "Inverting" << std::endl;
imgpFilt_ = combine_invert_distance(im_thrd_dst_map, imgpGradient_ , sigma);
// temp code for debugging
/*
save_image( imgpIntenisty_, "intensity_image.tif");
save_image( im_thrd_dst_map, "thrd_dst_map.tif");
save_image( imgpGradient_, "Gradient_image.tif");
save_image( imgpFilt_, "Filt_image.tif");
*/
}
/** @brief saves the image to a file
* @param img ITK image pointer to input image
* @param file file name of image
*/
void
fnsl3d_filter::
save_image(ImageType::Pointer img, std::string file)
{
typedef float PixelType;
typedef itk::Image<PixelType, 3> ImageType;
typedef unsigned char WritePixelType;
typedef itk::Image< WritePixelType, 3 > WriteImageType;
typedef itk::RescaleIntensityImageFilter< ImageType,
WriteImageType > RescalerFilterType;
typedef itk::ImageFileWriter< WriteImageType > WriterType;
RescalerFilterType::Pointer f_scaler_file = RescalerFilterType::New();
WriterType::Pointer writer = WriterType::New();
writer->SetFileName( file.c_str() );
f_scaler_file->SetOutputMaximum( 255 );
f_scaler_file->SetOutputMinimum( 0 );
f_scaler_file->SetInput(img);
writer->SetInput( f_scaler_file->GetOutput() );
try
{
writer->Update();
}
catch (itk::ExceptionObject & e)
{
std::cerr << "Exception in Writer: " << e << std::endl;
exit(0);
}
}
int*
fnsl3d_filter::
get_size()
{
return image_size_;
}
| [
"[email protected]"
] | |
5edccd12ca0d3f55ab9955dd3d031d73bebf1518 | 76fab692584ca8fbe0a2b4cb25fa186412844ef1 | /src/caffe/util/util_img.cpp | a3e71353ad748a81c5d783206e3652daa5338940 | [
"BSD-2-Clause"
] | permissive | xiaolonw/caffe-3dnormal_joint_past | 2191df64c9090ea9e466755b0a74620505b88748 | 4af389ec527fff308750408ee67bd70a36bad206 | refs/heads/master | 2020-05-15T03:56:06.291278 | 2015-08-31T23:29:57 | 2015-08-31T23:29:57 | 34,825,297 | 0 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 7,749 | cpp |
/**
* developed by zhujin
*/
#include <google/protobuf/text_format.h>
#include <google/protobuf/io/zero_copy_stream_impl.h>
#include <google/protobuf/io/coded_stream.h>
#include <cmath>
#include "caffe/common.hpp"
#include "caffe/util/util_img.hpp"
#include "caffe/proto/caffe.pb.h"
#include "caffe/util/im2col.hpp"
namespace caffe {
//y
template <typename Dtype>
void BiLinearResizeMat_cpu(const Dtype* src, const int src_height, const int src_width,
Dtype* dst, const int dst_height, const int dst_width)
{
const Dtype scale_w = src_width / (Dtype)dst_width;
const Dtype scale_h = src_height / (Dtype)dst_height;
Dtype* dst_data = dst;
const Dtype* src_data = src;
int loop_n = dst_height * dst_width;
for(int i=0 ; i< loop_n; i++)
{
int dst_h = i /dst_width;
Dtype fh = dst_h * scale_h;
int src_h ;
if(typeid(Dtype).name() == typeid(double).name() )
{
src_h = floor(fh);
}
else
{
src_h = floorf(fh);
}
fh -= src_h;
const Dtype w_h0 = std::abs((Dtype)1.0 - fh);
const Dtype w_h1 = std::abs(fh);
const int dst_offset_1 = dst_h * dst_width;
const int src_offset_1 = src_h * src_width;
int dst_w = i %dst_width;
Dtype fw = dst_w * scale_w;
int src_w ;//= floor(fw);
if(typeid(Dtype).name() == typeid(double).name() )
{
src_w = floor(fw);
}
else
{
src_w = floorf(fw);
}
fw -= src_w;
const Dtype w_w0 = std::abs((Dtype)1.0 - fw);
const Dtype w_w1 = std::abs(fw);
const int dst_idx = dst_offset_1 + dst_w;
dst_data[dst_idx] = 0;
const int src_idx = src_offset_1 + src_w;
dst_data[dst_idx] += (w_h0 * w_w0 * src_data[src_idx]);
if (src_w + 1 < src_width)
dst_data[dst_idx] += (w_h0 * w_w1 * src_data[src_idx + 1]);
if (src_h + 1 < src_height)
dst_data[dst_idx] += (w_h1 * w_w0 * src_data[src_idx + src_width]);
if (src_w + 1 < src_width && src_h + 1 < src_height)
dst_data[dst_idx] += (w_h1 * w_w1 * src_data[src_idx + src_width + 1]);
}
}
template void BiLinearResizeMat_cpu(const float* src, const int src_height, const int src_width,
float* dst, const int dst_height, const int dst_width);
template void BiLinearResizeMat_cpu(const double* src, const int src_height, const int src_width,
double* dst, const int dst_height, const int dst_width);
//y
template <typename Dtype>
void GetBiLinearResizeMatRules_cpu( const int src_height, const int src_width,
const int dst_height, const int dst_width,
Dtype* loc1, Dtype* weight1, Dtype* loc2, Dtype* weight2,
Dtype* loc3, Dtype* weight3, Dtype* loc4, Dtype* weight4)
{
const Dtype scale_w = src_width / (Dtype)dst_width;
const Dtype scale_h = src_height / (Dtype)dst_height;
int loop_n = dst_height * dst_width;
caffe::caffe_set(loop_n,(Dtype)0,loc1);
caffe::caffe_set(loop_n,(Dtype)0,loc2);
caffe::caffe_set(loop_n,(Dtype)0,loc4);
caffe::caffe_set(loop_n,(Dtype)0,loc3);
caffe::caffe_set(loop_n,(Dtype)0,weight1);
caffe::caffe_set(loop_n,(Dtype)0,weight2);
caffe::caffe_set(loop_n,(Dtype)0,weight3);
caffe::caffe_set(loop_n,(Dtype)0,weight4);
for(int i=0 ; i< loop_n; i++)
{
int dst_h = i /dst_width;
Dtype fh = dst_h * scale_h;
int src_h ;
if(typeid(Dtype).name() == typeid(double).name())
src_h = floor(fh);
else
src_h = floorf(fh);
fh -= src_h;
const Dtype w_h0 = std::abs((Dtype)1.0 - fh);
const Dtype w_h1 = std::abs(fh);
const int dst_offset_1 = dst_h * dst_width;
const int src_offset_1 = src_h * src_width;
int dst_w = i %dst_width;
Dtype fw = dst_w * scale_w;
int src_w ;
if(typeid(Dtype).name() == typeid(double).name())
src_w = floor(fw);
else
src_w = floorf(fw);
fw -= src_w;
const Dtype w_w0 = std::abs((Dtype)1.0 - fw);
const Dtype w_w1 = std::abs(fw);
const int dst_idx = dst_offset_1 + dst_w;
// dst_data[dst_idx] = 0;
const int src_idx = src_offset_1 + src_w;
loc1[dst_idx] = static_cast<Dtype>(src_idx);
weight1[dst_idx] = w_h0 * w_w0;
if (src_w + 1 < src_width)
{
loc2[dst_idx] = static_cast<Dtype>(src_idx + 1);
weight2[dst_idx] = w_h0 * w_w1;
// dst_data[dst_idx] += (w_h0 * w_w1 * src_data[src_idx + 1]);
}
if (src_h + 1 < src_height)
{
// dst_data[dst_idx] += (w_h1 * w_w0 * src_data[src_idx + src_width]);
weight3[dst_idx] = w_h1 * w_w0;
loc3[dst_idx] = static_cast<Dtype>(src_idx + src_width);
}
if (src_w + 1 < src_width && src_h + 1 < src_height)
{
loc4[dst_idx] = static_cast<Dtype>(src_idx + src_width + 1);
weight4[dst_idx] = w_h1 * w_w1;
// dst_data[dst_idx] += (w_h1 * w_w1 * src_data[src_idx + src_width + 1]);
}
}
}
template void GetBiLinearResizeMatRules_cpu( const int src_height, const int src_width,
const int dst_height, const int dst_width,
float* loc1, float* weight1, float* loc2, float* weight2,
float* loc3, float* weight3, float* loc4, float* weight4);
template void GetBiLinearResizeMatRules_cpu( const int src_height, const int src_width,
const int dst_height, const int dst_width,
double* loc1, double* weight1, double* loc2, double* weight2,
double* loc3, double* weight3, double* loc4, double* weight4);
//y
template <typename Dtype>
void ResizeBlob_cpu(const Blob<Dtype>* src, const int src_n, const int src_c,
Blob<Dtype>* dst, const int dst_n, const int dst_c) {
const int src_channels = src->channels();
const int src_height = src->height();
const int src_width = src->width();
const int src_offset = (src_n * src_channels + src_c) * src_height * src_width;
const int dst_channels = dst->channels();
const int dst_height = dst->height();
const int dst_width = dst->width();
const int dst_offset = (dst_n * dst_channels + dst_c) * dst_height * dst_width;
const Dtype* src_data = &(src->cpu_data()[src_offset]);
Dtype* dst_data = &(dst->mutable_cpu_data()[dst_offset]);
BiLinearResizeMat_cpu(src_data, src_height, src_width,
dst_data, dst_height, dst_width);
}
template void ResizeBlob_cpu(const Blob<float>* src, const int src_n, const int src_c,
Blob<float>* dst, const int dst_n, const int dst_c);
template void ResizeBlob_cpu(const Blob<double>* src, const int src_n, const int src_c,
Blob<double>* dst, const int dst_n, const int dst_c);
template <typename Dtype>
void ResizeBlob_cpu(const Blob<Dtype>* src,Blob<Dtype>* dst)
{
CHECK(src->num() == dst->num())<<"src->num() == dst->num()";
CHECK(src->channels() == dst->channels())<< "src->channels() == dst->channels()";
for(int n=0;n< src->num();++n)
{
for(int c=0; c < src->channels() ; ++c)
{
ResizeBlob_cpu(src,n,c,dst,n,c);
}
}
}
template void ResizeBlob_cpu(const Blob<float>* src,Blob<float>* dst);
template void ResizeBlob_cpu(const Blob<double>* src,Blob<double>* dst);
template <typename Dtype>
void ResizeBlob_cpu(const Blob<Dtype>* src,Blob<Dtype>* dst,
Blob<Dtype>* loc1, Blob<Dtype>* loc2, Blob<Dtype>* loc3, Blob<Dtype>* loc4){
CHECK(src->num() == dst->num())<<"src->num() == dst->num()";
CHECK(src->channels() == dst->channels())<< "src->channels() == dst->channels()";
GetBiLinearResizeMatRules_cpu( src->height(),src->width(),
dst->height(), dst->width(),
loc1->mutable_cpu_data(), loc1->mutable_cpu_diff(), loc2->mutable_cpu_data(), loc2->mutable_cpu_diff(),
loc3->mutable_cpu_data(), loc3->mutable_cpu_diff(), loc4->mutable_cpu_data(), loc4->mutable_cpu_diff());
for(int n=0;n< src->num();++n)
{
for(int c=0; c < src->channels() ; ++c)
{
ResizeBlob_cpu(src,n,c,dst,n,c);
}
}
}
template void ResizeBlob_cpu(const Blob<float>* src,Blob<float>* dst,
Blob<float>* loc1, Blob<float>* loc2, Blob<float>* loc3, Blob<float>* loc4);
template void ResizeBlob_cpu(const Blob<double>* src,Blob<double>* dst,
Blob<double>* loc1, Blob<double>* loc2, Blob<double>* loc3, Blob<double>* loc4);
}
// namespace caffe
| [
"dragon123@dragon123-M51AC.(none)"
] | dragon123@dragon123-M51AC.(none) |
551353c05eb07149c15746658dbed0b5a7bc90ff | 172ad4de767ceeba7fbebddedc5fc9b4fa3a27a5 | /SDLGame/SDLGame/Vector2D.h | e39018ad4d2f0d3ff196aa9940d5cc207a31c142 | [] | no_license | hyeyoon156/Git2 | e2ef56799d36c025d952d9a5a53fc48a61d2e346 | bd487273b5898bff3afe7722951386303dee2a6d | refs/heads/master | 2020-04-05T06:50:08.797434 | 2018-12-16T14:58:01 | 2018-12-16T14:58:01 | 156,653,157 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 1,353 | h | #pragma once
#include<math.h>
//#include "SDLGameObject.h" << 얘때문에 교수님이 해결못한거 나온거임
class Vector2D
{
public:
Vector2D(float x, float y) : m_x(x), m_y(y) {}
float getX() { return m_x; }
float getY() { return m_y; }
void setX(float x) { m_x = x; }
void setY(float y) { m_y = y; }
Vector2D operator+(const Vector2D& v2) const
{
return Vector2D(m_x + v2.m_x, m_y + v2.m_y);
}
friend Vector2D& operator+=(Vector2D& v1, const Vector2D& v2)
{
v1.m_x += v2.m_x;
v1.m_y += v2.m_y;
return v1;
}
Vector2D operator*(float scalar)
{
return Vector2D(m_x * scalar, m_y * scalar);
}
Vector2D& operator*=(float scalar)
{
m_x *= scalar;
m_y *= scalar;
return *this;
}
Vector2D operator-(const Vector2D& v2) const
{
return Vector2D(m_x - v2.m_x, m_y - v2.m_y);
}
friend Vector2D& operator-=(Vector2D& v1, const Vector2D& v2)
{
v1.m_x -= v2.m_x;
v1.m_y -= v2.m_y;
return v1;
}
Vector2D operator/(float scalar)
{
return Vector2D(m_x / scalar, m_y / scalar);
}
Vector2D& operator/=(float scalar)
{
m_x /= scalar;
m_y /= scalar;
return *this;
}
float length() { return sqrt(m_x * m_x + m_y * m_y); }
void normalize()
{
float l = length();
if (l > 0) // we never want to attempt to divide by 0
{
(*this) *= 1 / l;
}
}
private:
float m_x;
float m_y;
};
| [
"[email protected]"
] | |
bbe0a63131cd1f6025bc444ce78a66687f3b99aa | b75f0c6e8e2c4caf895eb094eb48ae6913c3d2a1 | /feature_extractor/llvm/lib/ir_pass/BuiltinFeature.h | 0ebdf18b5e73d35c618f54b2216c8d3be925dfbf | [
"Unlicense"
] | permissive | ssrg-vt/aira | 0a76f84588b3dcf512256a79c60e2cecae51afa4 | 96a830480d1ed8317e0175a10d950d7991fb2bb7 | refs/heads/master | 2021-05-12T17:15:34.098162 | 2018-01-11T02:51:11 | 2018-01-11T02:51:11 | 117,041,015 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 876 | h | /*****************************************************************************/
/* BuiltinFeature class */
/* */
/* This class counts the number of instrinsic function calls in the function.*/
/*****************************************************************************/
#ifndef _BUILTIN_FEATURE_H
#define _BUILTIN_FEATURE_H
#include "IRFeature.h"
class BuiltinFeature : public IRFeature {
public:
BuiltinFeature();
virtual void clear();
virtual void collect(llvm::Instruction& instr, double bb_count);
virtual void print(std::ostream& stream);
private:
unsigned long builtins;
unsigned long vec_builtins;
static const char* builtin_names[];
bool findIn(std::string& first, std::string& second);
};
#endif /* _BUILTIN_FEATURE_H */
| [
"[email protected]"
] | |
1b5e6689f091727d061441003522bb52fed1dbea | e1e2512c2b76f26221ff0768bb54dc9e55f3b056 | /differential_privacy/base/logging.cc | fbf8cebcab0070740ee0b7cf95d3ec629cf9d12a | [
"Apache-2.0"
] | permissive | chinmayshah99/differential-privacy | e0874aecc36d0f64ada0d8882496c25c9370b930 | 98231e038b554ad1c8736c2f0dd6342642f5eb10 | refs/heads/master | 2021-06-23T22:28:41.703965 | 2019-11-29T13:46:03 | 2019-11-29T13:46:03 | 224,471,875 | 1 | 0 | Apache-2.0 | 2019-11-27T16:24:42 | 2019-11-27T16:24:41 | null | UTF-8 | C++ | false | false | 7,361 | cc | //
// Copyright 2019 Google LLC
// Copyright 2018 ZetaSQL Authors
//
// 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 "differential_privacy/base/logging.h"
#include <errno.h>
#include <fcntl.h>
#include <libgen.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
#include <cctype>
#include <cstdio>
#include <cstdlib>
#include <ctime>
#include <sstream>
#include <string>
#include "absl/base/attributes.h"
namespace differential_privacy {
namespace base {
constexpr char kDefaultDirectory[] = "/tmp/";
namespace {
// The logging directory.
ABSL_CONST_INIT std::string *log_file_directory = nullptr;
// The log filename.
ABSL_CONST_INIT std::string *log_basename = nullptr;
// The VLOG level, only VLOG with level equal to or below this level is logged.
ABSL_CONST_INIT int vlog_level = 0;
const char *GetBasename(const char *file_path) {
const char *slash = strrchr(file_path, '/');
return slash ? slash + 1 : file_path;
}
bool set_log_basename(const std::string &filename) {
if (log_basename || filename.empty()) {
return false;
}
log_basename = new std::string(filename);
return true;
}
std::string get_log_basename() {
if (!log_basename || log_basename->empty()) {
return "zetasql";
}
return *log_basename;
}
bool EnsureDirectoryExists(const char *path) {
struct stat dirStat;
if (stat(path, &dirStat)) {
if (errno != ENOENT) {
return false;
}
if (mkdir(path, 0766)) {
return false;
}
} else if (!S_ISDIR(dirStat.st_mode)) {
return false;
}
return true;
}
// Sets the log directory, as specified when initialized. This
// is only set once. Any request to reset it will return false.
//
// log_directory: log file directory.
//
// Returns true if and only if the log directory is set successfully.
bool set_log_directory(const std::string &log_directory) {
std::string tmp_directory = log_directory;
if (tmp_directory.empty()) {
tmp_directory = kDefaultDirectory;
}
if (log_file_directory || !EnsureDirectoryExists(tmp_directory.c_str())) {
return false;
}
if (tmp_directory.back() == '/') {
log_file_directory = new std::string(tmp_directory);
} else {
log_file_directory = new std::string(tmp_directory + "/");
}
return true;
}
// Sets the verbosity threshold for VLOG. A VLOG command with a level greater
// than this will be ignored.
//
// level: verbosity threshold for VLOG to be set. A VLOG command with
// level less than or equal to this will be logged.
void set_vlog_level(int level) { vlog_level = level; }
} // namespace
std::string get_log_directory() {
if (!log_file_directory) {
return kDefaultDirectory;
}
return *log_file_directory;
}
int get_vlog_level() { return vlog_level; }
bool InitLogging(const char *directory, const char *file_name, int level) {
set_vlog_level(level);
std::string log_directory = directory ? std::string(directory) : "";
if (!set_log_directory(log_directory)) {
return false;
}
const char *binary_name = GetBasename(file_name);
if (!set_log_basename(binary_name)) {
return false;
}
std::string log_path = get_log_directory() + get_log_basename();
if (access(log_path.c_str(), F_OK) == 0 &&
access(log_path.c_str(), W_OK) != 0) {
return false;
}
return true;
}
CheckOpMessageBuilder::CheckOpMessageBuilder(const char *exprtext)
: stream_(new std::ostringstream) {
*stream_ << exprtext << " (";
}
CheckOpMessageBuilder::~CheckOpMessageBuilder() { delete stream_; }
std::ostream *CheckOpMessageBuilder::ForVar2() {
*stream_ << " vs. ";
return stream_;
}
std::string *CheckOpMessageBuilder::NewString() { // NOLINT
*stream_ << ")";
return new std::string(stream_->str());
}
template <>
void MakeCheckOpValueString(std::ostream *os, const char &v) {
if (v >= 32 && v <= 126) {
(*os) << "'" << v << "'";
} else {
(*os) << "char value " << static_cast<int16_t>(v);
}
}
template <>
void MakeCheckOpValueString(std::ostream *os, const signed char &v) {
if (v >= 32 && v <= 126) {
(*os) << "'" << v << "'";
} else {
(*os) << "signed char value " << static_cast<int16_t>(v);
}
}
template <>
void MakeCheckOpValueString(std::ostream *os, const unsigned char &v) {
if (v >= 32 && v <= 126) {
(*os) << "'" << v << "'";
} else {
(*os) << "unsigned char value " << static_cast<uint16_t>(v);
}
}
template <>
void MakeCheckOpValueString(std::ostream *os, const std::nullptr_t &v) {
(*os) << "nullptr";
}
namespace logging_internal {
LogMessage::LogMessage(const char *file, int line)
: LogMessage(file, line, absl::LogSeverity::kInfo) {}
LogMessage::LogMessage(const char *file, int line, const std::string &result)
: LogMessage(file, line, absl::LogSeverity::kFatal) {
stream() << "Check failed: " << result << " ";
}
static constexpr const char *LogSeverityNames[4] = {"INFO", "WARNING", "ERROR",
"FATAL"};
LogMessage::LogMessage(const char *file, int line, absl::LogSeverity severity)
: severity_(severity) {
const char *filename = GetBasename(file);
// Write a prefix into the log message, including local date/time, severity
// level, filename, and line number.
struct timespec time_stamp;
clock_gettime(CLOCK_REALTIME, &time_stamp);
constexpr int kTimeMessageSize = 22;
char buffer[kTimeMessageSize];
strftime(buffer, kTimeMessageSize, "%Y-%m-%d %H:%M:%S ",
localtime(&time_stamp.tv_sec));
stream() << buffer;
stream() << LogSeverityNames[static_cast<int>(severity)] << " "
<< filename << " : " << line << " : ";
}
LogMessage::~LogMessage() {
Flush();
// if FATAL occurs, abort.
if (severity_ == absl::LogSeverity::kFatal) {
abort();
}
}
void LogMessage::SendToLog(const std::string &message_text) {
std::string log_path = get_log_directory() + get_log_basename();
FILE *file = fopen(log_path.c_str(), "ab");
if (file) {
if (fprintf(file, "%s", message_text.c_str()) > 0) {
if (message_text.back() != '\n') {
fprintf(file, "\n");
}
} else {
fprintf(stderr, "Failed to write to log file : %s! [%s]\n",
log_path.c_str(), strerror(errno));
}
fclose(file);
} else {
fprintf(stderr, "Failed to open log file : %s! [%s]\n",
log_path.c_str(), strerror(errno));
}
if (severity_ >= absl::LogSeverity::kError) {
fprintf(stderr, "%s\n", message_text.c_str());
fflush(stderr);
}
printf("%s\n", message_text.c_str());
fflush(stdout);
}
void LogMessage::Flush() {
std::string message_text = stream_.str();
SendToLog(message_text);
stream_.clear();
}
LogMessageFatal::~LogMessageFatal() {
Flush();
abort();
}
} // namespace logging_internal
} // namespace base
} // namespace differential_privacy
| [
"[email protected]"
] | |
8716ee20b8f1162f5f3ebfab1fc50c0f443fb6f7 | 924de80dab7907fdb03ab1cafeea6e399d9759c6 | /PROJECTS/GAMES/RUN3D/CODE/GAMEPLAY/PLAYER/MODIFIER/R3D_PLAYER_MODIFIER.h | b3389ebcdaf861d9c1b9f24f53fa0cf62cc1f1e8 | [] | no_license | x-tox-man/xengine | 866fd44d79207c71c6ad2709a66496d392ec0f6d | 81b9445795422969848acfffde59136e1eb66fbe | refs/heads/master | 2021-04-29T10:39:43.257184 | 2020-10-25T10:48:54 | 2020-10-25T10:48:54 | 77,837,329 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 999 | h | //
// R3D_PLAYER_MODIFIER.hpp
// Run3d
//
// Created by Christophe Bernard on 7/01/18.
// Copyright © 2018 IGZ. All rights reserved.
//
#ifndef R3D_PLAYER_MODIFIER_hpp
#define R3D_PLAYER_MODIFIER_hpp
#include "CORE_HELPERS_CLASS.h"
#include "CORE_HELPERS_IDENTIFIER.h"
class R3D_PLAYER;
XS_CLASS_BEGIN( R3D_PLAYER_MODIFIER )
R3D_PLAYER_MODIFIER();
inline void SetValue( float value ) { ModifierValue = value; }
inline float GetValue() { return ModifierValue; }
void Apply( R3D_PLAYER * player );
void Discard( R3D_PLAYER * player );
static CORE_HELPERS_IDENTIFIER
MaxSpeedModifier,
HorsePowerModifier,
FuelCapacityModifier,
WeaponReloadTimeModifier,
GravityModifier,
MassModifier,
SteeringModifier,
ExperienceGainModifier,
BrakeModifier;
private:
float
ModifierValue;
CORE_HELPERS_IDENTIFIER
ModifierIdentifier;
XS_CLASS_END
#endif /* R3D_PLAYER_MODIFIER_hpp */
| [
"[email protected]"
] | |
794457477acef6622f4e970986d73ed4174bb56a | 48f96d940dcd0c507d5ce121a74653bc053cd2e1 | /include/colby/image_factory.hpp | 67a0ea05596fb6f0065078149d935a5eeb955733 | [] | no_license | jordan-heemskerk/colby | f19e7397f33d30ecc53e16bc101440fb52de0e11 | a5fd2cb82c1ea2d104217fad68fc809f1b5783d0 | refs/heads/master | 2021-01-17T17:46:12.640585 | 2017-03-03T04:19:30 | 2017-03-03T04:19:30 | 83,109,117 | 1 | 0 | null | 2017-03-03T04:19:31 | 2017-02-25T05:35:02 | C++ | UTF-8 | C++ | false | false | 687 | hpp | /**
* \file
*/
#pragma once
#include <opencv2/core/mat.hpp>
namespace colby {
/**
* Allows a cv::Mat to be produced lazily.
*/
class image_factory {
public:
image_factory () = default;
image_factory (const image_factory &) = delete;
image_factory (image_factory &&) = delete;
image_factory & operator = (const image_factory &) = delete;
image_factory & operator = (image_factory &&) = delete;
/**
* Allows derived classes to be cleaned up
* through pointer or reference to base.
*/
virtual ~image_factory () noexcept;
/**
* Lazily produces a cv::Mat representing
* an image.
*
* \return
* The generated cv::Mat.
*/
virtual cv::Mat image () = 0;
};
}
| [
"[email protected]"
] | |
98b418b6d52d6836189fb729f37ee0aaece18c5a | e4712a49882e0bfb1161cd13d92c3838f0fb728e | /xla/service/cpu/elemental_ir_emitter.h | 8d2efb0fce4a54a3bf59cae43a685ad3b0352553 | [
"Apache-2.0"
] | permissive | openxla/xla | 3605841f552913cc7f690d80b0d32dd2fb2a0aae | c4a1e32cb7389075628da38e209e61ad9218ebd4 | refs/heads/main | 2023-08-31T01:43:32.128042 | 2023-08-30T23:14:14 | 2023-08-30T23:16:33 | 523,007,292 | 1,496 | 173 | Apache-2.0 | 2023-09-14T21:42:02 | 2022-08-09T15:30:01 | C++ | UTF-8 | C++ | false | false | 2,315 | h | /* Copyright 2017 The TensorFlow Authors. 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.
==============================================================================*/
#ifndef XLA_SERVICE_CPU_ELEMENTAL_IR_EMITTER_H_
#define XLA_SERVICE_CPU_ELEMENTAL_IR_EMITTER_H_
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Module.h"
#include "llvm/IR/Value.h"
#include "xla/hlo/ir/hlo_instruction.h"
#include "xla/service/cpu/ir_emitter.h"
#include "xla/service/elemental_ir_emitter.h"
#include "xla/statusor.h"
namespace xla {
namespace cpu {
class CpuElementalIrEmitter : public ElementalIrEmitter {
public:
CpuElementalIrEmitter(const HloModuleConfig& module_config,
IrEmitter* ir_emitter, llvm::Module* module)
: ElementalIrEmitter(module, ir_emitter->b()),
hlo_module_config_(module_config),
ir_emitter_(ir_emitter) {}
protected:
StatusOr<llvm::Value*> EmitAtan2(PrimitiveType prim_type, llvm::Value* lhs,
llvm::Value* rhs,
absl::string_view name) override;
StatusOr<llvm::Value*> EmitTanh(PrimitiveType prim_type,
llvm::Value* value) override;
StatusOr<std::vector<llvm::Value*>> EmitThreadLocalCall(
const HloComputation& callee, absl::Span<llvm::Value* const> parameters,
absl::string_view name, bool is_reducer) override {
return ir_emitter_->EmitThreadLocalCall(callee, parameters, name,
is_reducer);
}
bool fast_min_max() override {
return hlo_module_config_.debug_options().xla_cpu_enable_fast_min_max();
}
const HloModuleConfig& hlo_module_config_;
IrEmitter* ir_emitter_;
};
} // namespace cpu
} // namespace xla
#endif // XLA_SERVICE_CPU_ELEMENTAL_IR_EMITTER_H_
| [
"[email protected]"
] | |
301f84d6766e738bc3430711c73313bf3044cd5d | 6ca72a0692000a45b65c936dcc004a23060a8555 | /ArmorRepair.cpp | b48974c5636f54800bf937c2fb08c2132358d79a | [] | no_license | chefinDan/modoc_warrior_rpg | f956c984352b27d8a08081300fa683008de4db31 | be552e247b60a137ed90a42cb4b80cc47be1b33a | refs/heads/master | 2020-09-30T06:56:51.571980 | 2019-12-10T23:18:20 | 2019-12-10T23:18:20 | 227,233,632 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 307 | cpp | #include "Item.hpp"
ArmorRepair::ArmorRepair(std::string name, std::string description, int numOfUses, int levelReq)
{
this->name = name;
this->description = description;
this->numOfUses = numOfUses;
this->levelReq = levelReq;
}
ArmorRepair::~ArmorRepair()
{
}
void ArmorRepair::useItem()
{
}
| [
"[email protected]"
] | |
8be47ba35df8937b623b3a3fc32e2600e4983c14 | 2d361696ad060b82065ee116685aa4bb93d0b701 | /include/objmgr/impl/tse_info_object.hpp | 168f08008fc9c70fb8cb238c0c78348ff12d1785 | [
"LicenseRef-scancode-public-domain"
] | permissive | AaronNGray/GenomeWorkbench | 5151714257ce73bdfb57aec47ea3c02f941602e0 | 7156b83ec589e0de8f7b0a85699d2a657f3e1c47 | refs/heads/master | 2022-11-16T12:45:40.377330 | 2020-07-10T00:54:19 | 2020-07-10T00:54:19 | 278,501,064 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 6,940 | hpp | #ifndef OBJECTS_OBJMGR_IMPL___TSE_INFO_OBJECT__HPP
#define OBJECTS_OBJMGR_IMPL___TSE_INFO_OBJECT__HPP
/* $Id: tse_info_object.hpp 516051 2016-10-07 15:16:44Z vasilche $
* ===========================================================================
*
* PUBLIC DOMAIN NOTICE
* National Center for Biotechnology Information
*
* This software/database is a "United States Government Work" under the
* terms of the United States Copyright Act. It was written as part of
* the author's official duties as a United States Government employee and
* thus cannot be copyrighted. This software/database is freely available
* to the public for use. The National Library of Medicine and the U.S.
* Government have not placed any restriction on its use or reproduction.
*
* Although all reasonable efforts have been taken to ensure the accuracy
* and reliability of the software and data, the NLM and the U.S.
* Government do not and cannot warrant the performance or results that
* may be obtained by using this software or data. The NLM and the U.S.
* Government disclaim all warranties, express or implied, including
* warranties of performance, merchantability or fitness for any particular
* purpose.
*
* Please cite the author in any work or product based on this material.
*
* ===========================================================================
*
* Author: Aleksey Grichenko, Eugene Vasilchenko
*
* File Description:
* Bioseq info for data source
*
*/
#include <corelib/ncbiobj.hpp>
#include <objmgr/bio_object_id.hpp>
BEGIN_NCBI_SCOPE
BEGIN_SCOPE(objects)
class CDataSource;
class CTSE_Info;
class CSeq_entry;
class CSeq_entry_Info;
class CSeq_annot;
class CSeq_annot_Info;
class CSeq_descr;
////////////////////////////////////////////////////////////////////
//
// CTSE_Info_Object::
//
// Structure to keep bioseq's parent seq-entry along with the list
// of seq-id synonyms for the bioseq.
//
class NCBI_XOBJMGR_EXPORT CTSE_Info_Object : public CObject
{
public:
typedef map<CConstRef<CObject>, CRef<CObject> > TObjectCopyMap;
// 'ctors
CTSE_Info_Object(void);
CTSE_Info_Object(const CTSE_Info_Object& src, TObjectCopyMap* copy_map);
virtual ~CTSE_Info_Object(void);
// Get unique bio object id
virtual const CBioObjectId& GetBioObjectId(void) const;
virtual void SetBioObjectId(const CBioObjectId& id);
// info tree
bool HasDataSource(void) const;
CDataSource& GetDataSource(void) const;
bool HasTSE_Info(void) const;
bool BelongsToTSE_Info(const CTSE_Info& tse) const;
const CTSE_Info& GetTSE_Info(void) const;
CTSE_Info& GetTSE_Info(void);
bool HasParent_Info(void) const;
const CTSE_Info_Object& GetBaseParent_Info(void) const;
CTSE_Info_Object& GetBaseParent_Info(void);
// info tree initialization
void x_DSAttach(CDataSource& ds);
void x_DSDetach(CDataSource& ds);
virtual void x_DSAttachContents(CDataSource& ds);
virtual void x_DSDetachContents(CDataSource& ds);
void x_TSEAttach(CTSE_Info& tse);
void x_TSEDetach(CTSE_Info& tse);
virtual void x_TSEAttachContents(CTSE_Info& tse);
virtual void x_TSEDetachContents(CTSE_Info& tse);
// index support
bool x_DirtyAnnotIndex(void) const;
void x_SetDirtyAnnotIndex(void);
void x_SetParentDirtyAnnotIndex(void);
void x_ResetDirtyAnnotIndex(void);
virtual void x_SetDirtyAnnotIndexNoParent(void);
virtual void x_ResetDirtyAnnotIndexNoParent(void);
void x_UpdateAnnotIndex(CTSE_Info& tse);
virtual void x_UpdateAnnotIndexContents(CTSE_Info& tse);
enum ENeedUpdateAux {
/// number of bits for fields
kNeedUpdate_bits = 8
};
enum ENeedUpdate {
/// all fields of this object
fNeedUpdate_this = (1<<kNeedUpdate_bits)-1,
/// all fields of children objects
fNeedUpdate_children = fNeedUpdate_this<<kNeedUpdate_bits,
/// specific fields of this object
fNeedUpdate_descr = 1<<0, //< descr of this object
fNeedUpdate_annot = 1<<1, //< annot of this object
fNeedUpdate_seq_data = 1<<2, //< seq-data of this object
fNeedUpdate_core = 1<<3, //< core
fNeedUpdate_assembly = 1<<4, //< assembly of this object
fNeedUpdate_bioseq = 1<<5, //< whole bioseq
/// specific fields of children
fNeedUpdate_children_descr = fNeedUpdate_descr <<kNeedUpdate_bits,
fNeedUpdate_children_annot = fNeedUpdate_annot <<kNeedUpdate_bits,
fNeedUpdate_children_seq_data = fNeedUpdate_seq_data<<kNeedUpdate_bits,
fNeedUpdate_children_core = fNeedUpdate_core <<kNeedUpdate_bits,
fNeedUpdate_children_assembly = fNeedUpdate_assembly<<kNeedUpdate_bits,
fNeedUpdate_children_bioseq = fNeedUpdate_bioseq <<kNeedUpdate_bits
};
typedef int TNeedUpdateFlags;
bool x_NeedUpdate(ENeedUpdate flag) const;
void x_SetNeedUpdate(TNeedUpdateFlags flags);
virtual void x_SetNeedUpdateParent(TNeedUpdateFlags flags);
void x_Update(TNeedUpdateFlags flags) const;
virtual void x_DoUpdate(TNeedUpdateFlags flags);
void x_UpdateComplete(void) const;
void x_UpdateCore(void) const;
typedef int TChunkId;
typedef vector<TChunkId> TChunkIds;
void x_LoadChunk(TChunkId chunk_id) const;
void x_LoadChunks(const TChunkIds& chunk_ids) const;
virtual string GetDescription(void) const;
protected:
void x_BaseParentAttach(CTSE_Info_Object& parent);
void x_BaseParentDetach(CTSE_Info_Object& parent);
void x_AttachObject(CTSE_Info_Object& object);
void x_DetachObject(CTSE_Info_Object& object);
private:
CTSE_Info_Object(const CTSE_Info_Object&);
CTSE_Info_Object& operator=(const CTSE_Info_Object&);
// Owner TSE info
CTSE_Info* m_TSE_Info;
CTSE_Info_Object* m_Parent_Info;
bool m_DirtyAnnotIndex;
TNeedUpdateFlags m_NeedUpdateFlags;
CBioObjectId m_UniqueId;
};
/////////////////////////////////////////////////////////////////////
//
// Inline methods
//
/////////////////////////////////////////////////////////////////////
inline
bool CTSE_Info_Object::HasTSE_Info(void) const
{
return m_TSE_Info != 0;
}
inline
bool CTSE_Info_Object::BelongsToTSE_Info(const CTSE_Info& tse) const
{
return m_TSE_Info == &tse;
}
inline
bool CTSE_Info_Object::HasParent_Info(void) const
{
return m_Parent_Info != 0;
}
inline
bool CTSE_Info_Object::x_DirtyAnnotIndex(void) const
{
return m_DirtyAnnotIndex;
}
inline
bool CTSE_Info_Object::x_NeedUpdate(ENeedUpdate flag) const
{
return (m_NeedUpdateFlags & flag) != 0;
}
END_SCOPE(objects)
END_NCBI_SCOPE
#endif//OBJECTS_OBJMGR_IMPL___TSE_INFO_OBJECT__HPP
| [
"[email protected]"
] | |
92d58b75df73cbcbcd36f6881899e392cd54a453 | 0de3e2babaeee4f19ff1691852c923549e19b611 | /C Files/C_PROGS/STR_AX.CPP | 415ef33515cd3add3e247ccf6ef7de857bec938f | [] | no_license | SepehrSalim/MS-Multiprocessor-DB | 76f3d7cd895aa4513eaa5371b7970e0614f90aac | 2d7abab832d796a4041c5604ee55890cd96b5674 | refs/heads/master | 2020-04-19T23:30:12.360895 | 2019-01-31T10:24:14 | 2019-01-31T10:24:14 | 168,497,700 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 349 | cpp | #include <stdio.h>
#include <string.h>
void inv (char * s)
{
int i, j, max;
char temp;
max = strlen (s);
j = max - 1;
for (i = 0; i < max / 2; i ++, j --) {
temp = s [i];
s [i] = s [j];
s [j] = temp;
}
}
void main (void)
{
char str [80];
puts ("Enter a String ::: ");
gets (str);
inv (str);
puts ("Inverse ::: ");
puts (str);
} | [
"[email protected]"
] | |
e19fcabf753c7c933d204d03003f8980d9893b0f | 052a6f91f17570566312880b85b9e18a57edde63 | /include/AD/hash/chash2.h | dc87ba4dbc61db95b1e11923d0ad07b54cf01fcd | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-public-domain"
] | permissive | zjhmale/prop | 749b606675e37e4e47aba8ebe2111faf4c418d34 | a24efadede84821353cb7de6626a0bd437800125 | refs/heads/master | 2020-09-08T15:04:34.737510 | 2009-01-01T20:35:59 | 2009-01-01T20:35:59 | 221,167,123 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 14,731 | h | //////////////////////////////////////////////////////////////////////////////
// NOTICE:
//
// ADLib, Prop and their related set of tools and documentation are in the
// public domain. The author(s) of this software reserve no copyrights on
// the source code and any code generated using the tools. You are encouraged
// to use ADLib and Prop to develop software, in both academic and commercial
// settings, and are free to incorporate any part of ADLib and Prop into
// your programs.
//
// Although you are under no obligation to do so, we strongly recommend that
// you give away all software developed using our tools.
//
// We also ask that credit be given to us when ADLib and/or Prop are used in
// your programs, and that this notice be preserved intact in all the source
// code.
//
// This software is still under development and we welcome any suggestions
// and help from the users.
//
// Allen Leung
// 1994
//////////////////////////////////////////////////////////////////////////////
#ifndef coalesced_hashing_based_hash_table2_h
#define coalesced_hashing_based_hash_table2_h
////////////////////////////////////////////////////////////////////////////
// Class CHashTable2 implements a hash table using coaleased hashing
// scheme\cite{Algorithms}; i.e. collisions are resolved by chaining
// within the hash array.
////////////////////////////////////////////////////////////////////////////
#include <AD/generic/ordering.h>
////////////////////////////////////////////////////////////////////////////
// Class |CHashTable| is parameterized with the class of the
// key and the class of the value. Furthermore, the functions
// unsigned int hash(const K&); and
// Bool equal(const K&, const K&);
// must be defined by the client that uses this template.
////////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
class CHashTable2 {
K * keys; // the array of keys
V * values; // the array of values
int * chain; // collision chain + status
int table_size; // size of the array
int elem_count; // number of elements
double max_load_ratio; // maximum load ratio (> 0 && < 1)
double growth_ratio; // amount to grow when expanding
int max_load; // maximum elements before resizing
int next_free; // next free cell to use
////////////////////////////////////////////////////////////////////
// Implementation note: the array |chain| performs two functions:
// one is to mark the current entry as used, and secondly,
// to provide a link to the next collided key. Interpretation
// is as follows:
// (1) chain[i] == 0 means the entry is unused
// (2) chain[i] == -1 means the entry is used
// (3) chain[i] > 0 means the entry is used; furthermore,
// the next entry within the chain is
// chain[i]-1;
////////////////////////////////////////////////////////////////////
public:
////////////////////////////////////////////////////////////////////
// Constructor and destructor
////////////////////////////////////////////////////////////////////
CHashTable2( int initial_size = 32,
double max_load_ratio = 0.80,
double growth_ratio = 2.0
);
~CHashTable2();
////////////////////////////////////////////////////////////////////
// Assignment
////////////////////////////////////////////////////////////////////
void operator = (const CHashTable2&);
////////////////////////////////////////////////////////////////////
// Selectors
////////////////////////////////////////////////////////////////////
inline int capacity() const { return table_size; } // current capacity
inline int size() const { return elem_count; } // number of elements
inline Bool is_empty() const { return elem_count == 0; }
inline Bool is_full() const { return elem_count == table_size; }
inline Bool contains(const K& k) const { return lookup(k) != 0; }
inline const V& operator [] (const K& k) const { return value(lookup(k)); }
inline V& operator [] (const K& k) { return value(lookup(k)); }
////////////////////////////////////////////////////////////////////
// Insertion and deletion.
////////////////////////////////////////////////////////////////////
void clear(); // clears out the hash table
Ix lookup(const K&) const; // lookup entry by key
Ix insert(const K&, const V&); // insert a new entry
Bool remove(const K&); // remove an old entry
////////////////////////////////////////////////////////////////////
// Iteration:
// first() start the iteration
// next() get index to the next element; or 0 if none
// key() get the key on index
// value() get the value on index
// Implementation note: Ix's are represented internally as 1-based
// array index.
////////////////////////////////////////////////////////////////////
inline Ix first() const { return find_next(0); }
inline Ix next(Ix i) const { return find_next((int)i); }
inline const K& key(Ix i) const { return keys[(int)i-1]; }
inline const V& value(Ix i) const { return values[(int)i-1]; }
inline V& value(Ix i) { return values[(int)i-1]; }
////////////////////////////////////////////////////////////////////
// Resizing
////////////////////////////////////////////////////////////////////
void resize(size_t new_size = 0);
private:
////////////////////////////////////////////////////////////////////
// Addition implementation methods
////////////////////////////////////////////////////////////////////
inline Ix find_next(int i) const; // locate the next used entry
};
//////////////////////////////////////////////////////////////////////////
// Implementation of the template methods
// Note: we actual do not keep a free list per se, as in the textbook
// version. Instead, when a new cell is needed we'll just scan for one
// linearly. Although asymtotically the time complexity for insertion
// will increase(especially with heavily loaded tables), I think this
// is still usable in practice since the loop is tight. Furthermore,
// keeping a free list requires the ability to delete any element
// from the list, which is hard to do efficiently unless a doubly linked
// list is used(which would increase the memory requirement).
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// Locate the next used cell; called by the iterator functions
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
inline Ix CHashTable2<K,V,C>::find_next(register int i) const
{ while (i < table_size) if (chain[i++]) return (Ix)i;
return (Ix)0;
}
//////////////////////////////////////////////////////////////////////////
// Create a new table.
// Implementation note: each end of each chain of the buckets are
// linked to the next. This makes it possible to find the next entry
// during iteration quickly.
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
CHashTable2<K,V,C>::CHashTable2
(int size, double maximum_load_ratio, double growth)
: keys(new K [size]), values(new V [size]),
chain(new int [size]),
table_size(size)
{ clear();
if (maximum_load_ratio > 1.0 || maximum_load_ratio <= 0.1)
max_load_ratio = 1.0;
else
max_load_ratio = maximum_load_ratio;
if (growth <= 1.2 || growth >= 5.0) growth_ratio = 2.0;
else growth_ratio = growth;
max_load = (int)(max_load_ratio * size);
}
//////////////////////////////////////////////////////////////////////////
// Destroy a table
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
CHashTable2<K,V,C>::~CHashTable2()
{ delete [] keys; delete [] values; delete [] chain; }
//////////////////////////////////////////////////////////////////////////
// Assignment
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
void CHashTable2<K,V,C>::operator = (const CHashTable2<K,V,C>& t)
{ if (this != &t) {
delete [] keys; delete [] values; delete [] chain;
elem_count = t.elem_count;
table_size = t.table_size;
keys = new K [table_size];
values = new V [table_size];
chain = new int [table_size];
next_free = t.next_free;
for (int i = 0; i < table_size; i++) {
if (chain[i] = t.chain[i]) {
keys[i] = t.keys[i]; values[i] = t.values[i];
}
}
}
}
//////////////////////////////////////////////////////////////////////////
// Clear a table: We'll mark all entries as unused.
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
void CHashTable2<K,V,C>::clear()
{ next_free = 0; elem_count = 0;
for (int i = table_size - 1; i >= 0; i--) chain[i] = 0;
}
//////////////////////////////////////////////////////////////////////////
// Lookup an entry by key; if the entry is not found, return (Ix)0.
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
Ix CHashTable2<K,V,C>::lookup(const K& key) const
{ register unsigned int i = C::hash(key) % table_size;
for (;;) {
int s = chain[i];
if (s == 0) return (Ix)0; // empty cell located
if (C::equal(key,keys[i])) return (Ix)(i+1); // found entry
if (s == -1) return (Ix)0; // end of chain located
i = s-1; // try next element
}
}
//////////////////////////////////////////////////////////////////////////
// Insert a new entry; there are two different cases of behavior:
// (1) If the key doesn't already exists, new key/value pair will be
// inserted into the table.
// (2) If the key already exists, then the old value will be overwritten
// by the new value.
// Also, if the number of elements have exceeded the maximum load,
// the table will be automatically resized.
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
Ix CHashTable2<K,V,C>::insert(const K& key, const V& value)
{
/////////////////////////////////////////////////////////////////////
// Make sure we have at least one unused cell.
/////////////////////////////////////////////////////////////////////
if (elem_count >= max_load) resize();
unsigned int i = C::hash(key) % table_size;
for (;;) {
int s = chain[i];
if (s == 0) break;
if (C::equal(key,keys[i])) { values[i] = value; return (Ix)(i+1); }
if (s == -1) {
///////////////////////////////////////////////////////////////
// Got to the end of a chain, we'll find a free cell to use.
///////////////////////////////////////////////////////////////
s = i;
for (i = next_free; chain[i]; ) if (++i == table_size) i = 0;
next_free = i; chain[s] = i+1;
break;
}
i = s-1;
}
keys[i] = key; values[i] = value; elem_count++; chain[i] = -1;
return (Ix)(i+1);
}
//////////////////////////////////////////////////////////////////////////
// Resizing the hash table. All entries are completed rehashed.
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
void CHashTable2<K,V,C>::resize(size_t new_size)
{ if (new_size <= elem_count)
new_size = (int)(table_size * growth_ratio);
int * new_chain = new int [ new_size ];
K * new_keys = new K [ new_size ];
V * new_values = new V [ new_size ];
//////////////////////////////////////////////////////////////////
// Rehash all used cells one by one. Notice that since all keys
// are unique, we don't have to do any comparison.
//////////////////////////////////////////////////////////////////
int i;
for (i = new_size - 1; i >= 0; i--) new_chain[i] = 0;
next_free = 0;
for (i = 0; i < table_size; i++) {
if (chain[i]) {
int j = C::hash(keys[i]) % new_size;
for (;;) {
int s = new_chain[j];
if (s == 0) break;
if (s == -1) {
s = j;
for (j = next_free; new_chain[j]; ) if (++j = new_size) j = 0;
next_free = j; new_chain[s] = j+1;
break;
}
j = s-1;
}
new_chain[j] = -1; new_keys[j] = keys[i]; new_values[j] = values[i];
}
}
delete [] keys; delete [] values; delete [] chain;
keys = new_keys; values = new_values; chain = new_chain;
table_size = new_size;
max_load = (int)(max_load_ratio * table_size);
}
//////////////////////////////////////////////////////////////////////////
// Remove an entry from the table; there are two different cases:
// (1) If the key exists within the table, the key/value pair will be
// removed; otherwise
// (2) The table will be unaltered.
// If the removal operation successfully deletes the entry,
// we'll also return true to the client.
//////////////////////////////////////////////////////////////////////////
template <class K, class V, class C>
Bool CHashTable2<K,V,C>::remove(const K& key)
{ unsigned int i = C::hash(key) % table_size;
int last = -1;
for (;;) {
int s = chain[i];
if (s == 0) return false;
if (C::equal(key,keys[i])) {
if (last >= 0) chain[last] = chain[s-1];
elem_count--; chain[i] = 0; next_free = i; return true;
}
if (s == -1) return false;
last = i;
i = s-1;
}
}
#endif
| [
"[email protected]"
] | |
ea34408fca355d584cbeca0adc5556af29ee6b83 | a54641e3dfb7ed714eedd911759adcb508bf6d92 | /Source/UEShooter/BTTask_FindWaypoint.h | 6db573eb0a74aaedb60dcf206ac0342a834925b0 | [] | no_license | vermisean/UEShooter | 6a19518af380e9c97b8595b33cdafbb559e2b99a | 619b7bc7c5119d593524714b3dc469d107f51314 | refs/heads/master | 2020-03-19T03:43:58.856689 | 2018-06-22T21:55:34 | 2018-06-22T21:55:34 | 135,756,418 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 451 | h | // Copyright Sean Duffy 2018
//
#pragma once
#include "CoreMinimal.h"
#include "BehaviorTree/Tasks/BTTask_BlackboardBase.h"
#include "BTTask_FindWaypoint.generated.h"
/**
* Blackboard Task - Find next waypoint
*/
UCLASS()
class UESHOOTER_API UBTTask_FindWaypoint : public UBTTask_BlackboardBase
{
GENERATED_BODY()
virtual EBTNodeResult::Type ExecuteTask(UBehaviorTreeComponent& OwnerComp, uint8* NodeMemory) override;
};
| [
"[email protected]"
] | |
022c6cfe4a718c4fc1c601d3427ebd016cb773b5 | 650a6d889f09665b34151f7056a5258e760cfceb | /src/initialisation.h | 9886d7c307472d695c74e315a6ee1e61046eb79d | [] | no_license | MathieuDenglos/metro-network-database | 473f819164e04dc5717c4b436e0165f612b1d889 | 749fcf0b659ea65a05a94ccb67e1db763ac72c0e | refs/heads/master | 2023-03-07T19:06:07.505245 | 2021-02-15T21:43:28 | 2021-02-15T21:43:28 | 326,741,607 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 894 | h | #ifndef INITIALISATION_H
#define INITIALISATION_H
#include "constants_includes.h"
namespace INI
{
/**
* @brief connect to the database using the informations entered in constants_includes.h
*
* @param driver Driver necessary to connect
* @param con Used to execute the prepared statements
* @param stmt Used to communicate with the database
*/
void connection(sql::mysql::MySQL_Driver **driver,
sql::Connection **con,
sql::Statement **stmt);
/**
* @brief Make sure that the database and all the tables are created
*
* @param con Used to execute the prepared statements
* @param stmt Used to communicate with the database
*/
void verify_tables_existence(sql::Connection **con,
sql::Statement *stmt);
} // namespace INI
#endif //INITIALISATION_H
| [
"[email protected]"
] | |
71a20cb996b6a7e43faa48ac7410642566687009 | 560007417f0f94a02d5a0eb07accfe0e60dc97dd | /project/iteration1/src/obstacle.h | e5f84a2226086b7fab0d0a183adb868f3767c9d0 | [] | no_license | goelx029/Robot-Game-Simulator | e93e92810234ef6cc8cdc09ae123c0d270af555e | e127c530fbecd78164528ce52b71432d78f62c13 | refs/heads/master | 2021-05-05T06:26:36.696137 | 2018-01-24T18:00:02 | 2018-01-24T18:00:02 | 118,800,427 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,210 | h | /**
* @file obstacle.h
*
* @copyright 2017 3081 Staff, All rights reserved.
*/
#ifndef SRC_OBSTACLE_H_
#define SRC_OBSTACLE_H_
/*******************************************************************************
* Includes
******************************************************************************/
#include <string>
#include "src/arena_immobile_entity.h"
/*******************************************************************************
* Namespaces
******************************************************************************/
NAMESPACE_BEGIN(csci3081);
/*******************************************************************************
* Class Definitions
******************************************************************************/
/**
* @brief The main class for all the obstacles in the arena.
*
*/
class Obstacle: public ArenaImmobileEntity {
public:
Obstacle(double radius, const Position& pos,
const csci3081::Color col);
std::string name(void) const {
return "Obstacle" + std::to_string(id_);
}
private:
static uint next_id_;
int id_;
};
NAMESPACE_END(csci3081);
#endif /* SRC_OBSTACLE_H_ */
| [
"[email protected]"
] | |
75295cea87175d9d95f06db11363d46d32b09df4 | 7e0ec0e32282307dd5bf051602cc6c2ea268452c | /src/rads/maps/ricker_cpp.h | 827b5b98ebcf71bc64d3c22740d53d8810105fe8 | [] | no_license | caosuomo/rads | 03a31936715da2a9131a73ae80304680c5c3db7e | 71cab0d6f0711cfab67e8277e1e025b0fc2d8346 | refs/heads/master | 2021-01-20T10:18:58.222894 | 2018-05-24T02:18:58 | 2018-05-24T02:18:58 | 1,039,029 | 1 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 209 | h | #include "mapper.h"
class RickerMapper : public Mapper
{
// fitness ('r') and dispersal ('d')
enum param { r=0, d=1 };
public:
RickerMapper();
IPoint map_point( const IPoint &v ) const;
};
| [
"[email protected]"
] | |
07a8679c9e1441d40e885e21bdd5dadd61237b6d | 2531d95303fc98010fe1841783a5810bdfb42faf | /pugl/pugl_cairo.hpp | f31201e44d5da3afa885fa91c5927c3c732854e4 | [
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-mit-taylor-variant"
] | permissive | coltox/pugl | 4808061b4641b950c9338949dc7fbb086100cfd3 | 5695cb527b16ac622789e6f77b45f7fd52332829 | refs/heads/master | 2021-06-13T23:23:30.962620 | 2020-04-08T15:22:32 | 2020-04-08T15:22:32 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,258 | hpp | /*
Copyright 2012-2020 David Robillard <http://drobilla.net>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
/**
@file pugl_cairo.hpp Declaration of Cairo backend accessor for C++.
*/
#ifndef PUGL_PUGL_CAIRO_HPP
#define PUGL_PUGL_CAIRO_HPP
#include "pugl/pugl.h"
#include "pugl/pugl_cairo.h"
namespace pugl {
/**
@defgroup cairoxx Cairo
Cairo graphics support.
@ingroup pugl_cxx
@{
*/
/// @copydoc puglCairoBackend
static inline const PuglBackend*
cairoBackend()
{
return puglCairoBackend();
}
/**
@}
*/
} // namespace pugl
#endif // PUGL_PUGL_CAIRO_HPP
| [
"[email protected]"
] | |
cce1a9f9b7f6f262251888302cf0fe99ecbe25af | 588142a878994e36c7f91070c86e8e41e8a29824 | /interface/uaplotter1.h | 5a045693c5b3dbc2def1bc9133370c57fd02cf22 | [] | no_license | dsosnov/uaplotter1 | 189a4f4505b9d51053454d21c3072d9e856d80ba | e86651ea30f2aafab317e4e7124dda81ad8ad528 | refs/heads/master | 2021-01-23T12:25:19.866524 | 2018-08-04T11:32:19 | 2018-08-04T22:31:23 | 93,156,295 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 7,447 | h | #ifndef UAPLOTTER1_H
#define UAPLOTTER1_H
#include "uabase.h"
#include "uamc.h"
#include "uacmsevtinfo.h"
#include "uatracking.h"
#include "uapf.h"
#include "uacalo.h"
#include "uacastor.h"
#include "uaforward.h"
#include "uat2.h"
#include "uarp.h"
#include "TChain.h"
#include "TFile.h"
#include "TString.h"
class uaplotter1: public uabase {
public:
uaplotter1(const bool cmstotem, //!< — see uabase::uabase()
const bool cmsdigis, //!< → #tree_digi_flag
const bool CASTORp, //!< → #ppb
const short int MC, //!< — see uabase::uabase()
const short unsigned int Ncuts = 2, //!< — see uabase::uabase()
const int energy = 8 //!< — sqrt(s) in TeV
);
~uaplotter1();
int Loop(const int evts, const int trigger, vector<string> hlt_path_regexps = {});
int noiseLoop(const int evts);
int t2Loop(const int evts);
private:
const bool tree_digi_flag; //!< true - with cms digis
const bool ppb; //!< true for pPb (p->CASTOR, p == Beam 1), false for Pbp (Pb == Beam 1) //WARNING! old naming convention
bool zdc56; //!< flag for ZDCdigi proper TS, initialized in initializeChain
const short unsigned int dummy_cut; //!< service variable for processing without histo filling
unsigned int current_event;
TChain *chainTree;
TFile *outputFile;
TString initializeChain();
uamc *CMSmc;
uacmsevtinfo *CMSevtinfo;
uatracking *CMStracking;
uapf *CMSpf;
uacalo *CMScalo;
uacastor *CMScastor;
uaforward *CMSforward;
uat2 *T2;
uarp *RP;
int DefineTrigger(int trigger_bit_common, bool &tech_bit);
bool ProceedTrigger(int trigger_bit, bool tech_bit);
bool ProceedEvent(const short unsigned int cut = 0, const bool fill = false, const bool info = false);
bool FillLastEvent(const short unsigned int cut);
void PrintEventInfo(const bool detailed = false);
void IniRapGapRange(); //!< to be called during construction. Sets value to first_central_bin and last_central_bin according to uathresholds
bool FindRapGap(int ind = 0); //!< if 0 - works on RECO, 1 - on MCtruth (tight), 2 - on MCtruth (loose)
bool TotalRapGap(short unsigned int ind, bool active_minus, bool active_plus);
void PrintRapGap();
short unsigned int first_central_bin;
short unsigned int last_central_bin;
bool combined_central_activity[N_ETA_BINS];
enum processID: short {
pid_nd=0, pid_cd=3, pid_sdm=-1, pid_sdp=1, pid_dd=2, pid_elastic=4, pid_undefined=5,
pid_min = pid_sdm, pid_max=pid_undefined
}; //!< Types of processID's: \li 0 - ND \li -1 — SD- \li +1 — SD+ \li 2 — DD~central gap(s) \li 3 — CD cand \li 4 — "elastic" \li 5 — "undefined"
processID sd_flag_central[3]; //!< all MCtruth for MC, T2 events for RECO
processID sd_flag_total[5]; //!< \li [0] — reco, \li [1] — mctruth eta_binning (tight), \li [2] — mctruch total (tight), \li [3], [4] - the same for mctruth (loose)
short unsigned int n_sd_minus_bins[3]; //!< \li [0] — reco, \li [1] — mctruth (tight), \li [2] — mctruth (loose)
short unsigned int n_sd_plus_bins[3]; //!< \li [0] — reco, \li [1] — mctruth (tight), \li [2] — mctruth (loose)
short unsigned int n_dd_rg_bins[3]; //!< \li [0] — reco, \li [1] — mctruth (tight), \li [2] — mctruth (loose)
void CalculateSDdiffMass(bool info = false); //!< for SD only!!
void PrintSDdiffMass(bool detailed);
bool hf_inelastic[2]; // is event passed inelastic cut per HF side
bool hf_emptyHF[2]; // is event passed 'empty HF' cut (genLevel) per HF side
bool hf_blindFilled[2]; // is a particle in event in blind spot with enelgy greater inelastic cut
// [0]reco, [1]mctruth
double xi_pf[2];
double xi_calo[2] ;
double xi_cas[2] ;
double xi_zdc[2] ;
double xi_full[2] ;
double xi_mc_out; // this includes ZDC and CASTOR also!
double xi_mc_total; // everything from first active bin in reco
void create_histos();
TH2F **diff_flag_mc_full_reco_central_h; //!< X:mc_total; Y:reco_central
TH2F **diff_flag_mc_full_reco_full_h; //!< X:mc_total; Y:reco_total
TH2F **diff_flag_mc_full_mc_central_h; //!< X:mc_full; Y:mc_central
TH2F **diff_flag_mc_total_mc_central_h; //!< X:mc_total; Y:mc_central
TH2F **n_sd_minus_bins_mcreco_mctruth_h; //!< X:RECO; Y:Truth
TH2F **n_sd_plus_bins_mcreco_mctruth_h; //!< X:RECO; Y:Truth
TH2F **n_sd_minus_bins_mcreco_mctruth_emptyHF_h; //!< X:RECO; Y:Truth
TH2F **n_sd_plus_bins_mcreco_mctruth_emptyHF_h; //!< X:RECO; Y:Truth
TH2F **n_sd_minus_bins_mcreco_mctruthLoose_h; //!< X:RECO; Y:Truth
TH2F **n_sd_plus_bins_mcreco_mctruthLoose_h; //!< X:RECO; Y:Truth
TH2F **n_sd_minus_bins_mcreco_mctruthLoose_emptyHF_h; //!< X:RECO; Y:Truth
TH2F **n_sd_plus_bins_mcreco_mctruthLoose_emptyHF_h; //!< X:RECO; Y:Truth
TH2F **n_sd_minus_bins_mctruth_mctruthLoose_h; //!< X:RECO; Y:Truth
TH2F **n_sd_plus_bins_mctruth_mctruthLoose_h; //!< X:RECO; Y:Truth
TH2F **n_sd_minus_bins_mctruth_mctruthLoose_emptyHF_h; //!< X:RECO; Y:Truth
TH2F **n_sd_plus_bins_mctruth_mctruthLoose_emptyHF_h; //!< X:RECO; Y:Truth
TH2F **xi_mc_p_mc_total_h; //!< X xi(p), Y:xi_mc_total
TH2F **xi_mc_p_reco_full_h; //!< X xi(p), Y:xi_full reco (but does not care about diffraction); MC only
TH2F **xi_p_reco_full_h; //!< X:RP xi or MC proton; Y:reco_total xi (combines the above and data case with RP)
TH2F **xi_mc_total_mc_full_h;
TH2F **xi_mc_total_reco_full_h;
TH2F **xi_calo_mc_reco_h;
TH2F **xi_pf_mc_reco_h;
TH2F **xi_cas_mc_reco_h;
TH2F **xi_zdc_mc_reco_h;
TH2F **n_sd_minus_bins_plus_bins_h;
TH1F **n_sd_minus_bins_h;
TH1F **n_sd_plus_bins_h;
TH1F **central_activity_h;
TH1F **central_activity_mc_h;
TH1F **sd_flag_central_reco_h;
TH1F **sd_flag_total_reco_h;
TH1F **xi_reco_full_h;
TH2F **zdcM_vs_castor_h;
TH2F **zdcM_vs_T2primM_h;
TH2F **ZDCm_vs_xiRP_h;
TH2F **ZDCp_vs_xiRP_h;
TH2F **FSCmSi8_vs_xiRP_h;
TH2F **FSCmN_vs_xiRP_h;
TH2F **FSCmN_vs_castor_h;
TH2F **n_sd_minus_bins_reco_pid_inelastic_h;
TH2F **n_sd_plus_bins_reco_pid_inelastic_h;
TH2F **n_sd_minus_bins_mctruth_pid_inelastic_h;
TH2F **n_sd_plus_bins_mctruth_pid_inelastic_h;
TH2F **n_sd_minus_bins_reco_pid_inelastic_veto_h;
TH2F **n_sd_plus_bins_reco_pid_inelastic_veto_h;
TH2F **n_sd_minus_bins_mctruth_pid_inelastic_veto_h;
TH2F **n_sd_plus_bins_mctruth_pid_inelastic_veto_h;
TH2F **n_sd_minus_bins_mctruthLoose_pid_inelastic_h;
TH2F **n_sd_plus_bins_mctruthLoose_pid_inelastic_h;
TH2F **n_sd_minus_bins_mctruthLoose_pid_inelastic_veto_h;
TH2F **n_sd_plus_bins_mctruthLoose_pid_inelastic_veto_h;
TH2F **n_sd_minus_bins_reco_pid_inelastic_veto_blindFilled_h;
TH2F **n_sd_plus_bins_reco_pid_inelastic_veto_blindFilled_h;
TH2F **n_sd_minus_bins_mctruth_pid_inelastic_veto_blindFilled_h;
TH2F **n_sd_plus_bins_mctruth_pid_inelastic_veto_blindFilled_h;
struct {double hfMinus, hfPlus; int processID; std::vector<bool> l1Triggers;} hf_by_processID;
TTree* hf_by_processID_t;
ClassDef(uaplotter1, 2);
};
#endif // UAPLOTTER1_H
| [
"[email protected]"
] | |
6b0314a292e3481997f7a124baea1cb70efa8683 | e5a37a543ca382ed3eaab28c37d267b04ad667c0 | /probrems/AOJ0112.cpp | db0831e6a1ad05ad502b1f51f387540e1514ff65 | [] | no_license | akawashiro/competitiveProgramming | 6dfbe626c2e2433d5e702e9431ee9de2c41337ed | ee8a582c80dbd5716ae900a02e8ea67ff8daae4b | refs/heads/master | 2018-09-02T19:49:22.460865 | 2018-06-30T05:45:51 | 2018-06-30T05:45:51 | 71,694,415 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 393 | cpp | #include <iostream>
#include <vector>
#include <algorithm>
typedef long long LL;
using namespace std;
void solve(int n)
{
LL r=0;
vector<LL> v(n);
for(int i=0;i<n;i++)
cin >> v[i];
sort(v.begin(),v.end());
for(int i=1;i<n;i++)
{
r+=v[i-1];
v[i]+=v[i-1];
}
cout << r << endl;
}
int main()
{
int n;
while(1)
{
cin >> n;
if(n==0)
break;
solve(n);
}
return 0;
}
| [
"[email protected]"
] | |
0c11d8b2af32bc0df58959ca8ec679964b11d948 | f6803203be52d4b4e64545e5edef6ca2f6be8309 | /微机原理/新建文件夹/微机实验汇总2011.12.30/2011.12.12实验8251.8255/SAMPLE/实验15_可编程并行接口8255方式1/可编程并行接口(8255方式一实验2)C/可编程并行接口(8255方式一实验2)C.cpp | 75d45812150faa0d14d2a091fb605a996ca85edd | [] | no_license | Tropicana33/Microcomputer-Principle | 9281887d1b7e715ce4adf1c67c76d6a32207aa0e | a6f1e49aff9ce18e8755d63988d47adead794ca6 | refs/heads/master | 2021-01-13T03:09:50.423359 | 2017-01-06T06:55:37 | 2017-01-06T06:55:37 | 77,432,872 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,210 | cpp | /*******************************/
/* 可编程并行接口(二) */
/* 8255方式1输入实验 (A口) */
/*******************************/
#include <stdio.h>
#include <conio.h>
#include "ApiEx.h"
#pragma comment(lib,"ApiEx.lib")
int Count=8; /*响应中断次数为8*/
void IntS();
void main()
{
printf("--------------------EXP21_10_8255-1_2---------------------\n");
printf("1. 8255 (PA0-PA7) === TPC (K0-K7)\n");
printf("2. I/O (288-28F) === 8255 (CS)\n");
printf("3. 8255 (PC3) === TPC (IRQ)\n");
printf("4. 8255 (PC4) === (K8(DMC))\n");
printf("Press any key to begin!\n\n");
getch();
if(!Startup()) /*打开设备*/
{
printf("ERROR: Open Device Error!\n");
return;
}
printf("Press DMC!Press any key to exit!\n");
PortWriteByte(0x28b,0xb8); /*设8255工作方式1输入*/
PortWriteByte(0x28b,0x09); /*将PC4置位*/
RegisterLocalISR(IntS); /*注册中断程序*/
EnableIntr(); /*开中断*/
while(!kbhit()) Sleep(10);
DisableIntr(); /*关中断*/
Cleanup(); /*关闭设备*/
}
void IntS()
{
BYTE data;
PortReadByte(0x288,&data); /*以16进制打印自A口输入的数据*/
printf("This is a Intrupt! In = %x\n",data);
Count--;
if(Count == 0)
exit(0);
}
| [
"[email protected]"
] | |
54a1f1e472f8d5d6dd4e2a63fec08f3480598ab3 | d3954d4770f72f6d8b1704b0c508903d6f74f0f5 | /css/property/linear_gradient.h++ | cb2b33ca6df481ade942534415d739f5f239bc6e | [
"MIT"
] | permissive | skui-org/skui | 83b0779c63c9332e86f4e9e2f1f02ceb7aba501f | f04d74d1938f053dc876e85ae469a711ed2edbc5 | refs/heads/master | 2022-01-31T08:21:45.375334 | 2022-01-21T15:24:51 | 2022-01-21T15:24:51 | 85,348,438 | 382 | 57 | MIT | 2022-01-01T01:29:57 | 2017-03-17T19:37:28 | C++ | UTF-8 | C++ | false | false | 1,833 | /**
* The MIT License (MIT)
*
* Copyright © 2019-2020 Ruben Van Boxem
*
* 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 SKUI_CSS_PROPERTY_LINEAR_GRADIENT_H
#define SKUI_CSS_PROPERTY_LINEAR_GRADIENT_H
#include "css/angle.h++"
#include "css/position.h++"
#include "css/property/background_gradient.h++"
#include <variant>
#include <cinttypes>
namespace skui::css
{
struct linear_gradient : background_gradient<length>
{
std::variant<position, angle> direction; // direction or explicit angle [0,360] degrees
};
constexpr bool operator==(const linear_gradient& lhs, const linear_gradient& rhs)
{
return static_cast<const background_gradient<length>&>(lhs) == static_cast<const background_gradient<length>&>(rhs)
&& lhs.direction == rhs.direction;
}
}
#endif
| [
"[email protected]"
] | ||
e63ee953cd28bd715f5d94f45bb7ab28d17b5778 | f4064dbc68decb87973e0b05992d39268b0c4a1a | /AtCoder/ABC012/C.cpp | 1005051053bfde576a4c6efa5e178954777b9c4a | [] | no_license | odanado/Procon | d7c75387b15e3dc860b6a813eb43b1fa1ab8ffd3 | 6f30fb4819f577df9db54ccc74765eb0ddf2119c | refs/heads/master | 2020-04-12T01:43:42.196994 | 2017-08-06T14:58:02 | 2017-08-06T14:58:02 | 48,416,463 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 798 | cpp | #include <algorithm>
#include <functional>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <string>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <bitset>
#include <climits>
#define all(c) (c).begin(), (c).end()
#define rep(i,n) for(int i=0;i<(n);i++)
#define pb(e) push_back(e)
#define mp(a, b) make_pair(a, b)
#define fr first
#define sc second
const int INF=100000000;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
using namespace std;
typedef pair<int ,int > P;
typedef long long ll;
int main() {
int n;
cin>>n;
n=2025-n;
rep(i,10) if(i) rep(j,10) if(j) {
if(n==i*j) printf("%d x %d\n",i,j);
}
return 0;
}
| [
"[email protected]"
] | |
036feaa9e4078398921bebbde4b7aaca989f5d11 | a51a50cac4ff551c79bf6adc2053380fadb6fc79 | /src/Data.h | dd1d0183c3e396f7844111000368e43162dbbbaa | [] | no_license | andreb86/fuzzy_c_means | e18b9c37db772950313cccf2529bbe1834aa0c77 | 55fc356eb8501340e9e86ba6a2517cb35071629e | refs/heads/master | 2020-04-16T00:23:58.423254 | 2019-02-10T21:05:58 | 2019-02-10T21:05:58 | 165,136,046 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,644 | h | //
// Created by andrea on 31/12/18.
//
#ifndef DATA
#define DATA
#include <iostream>
#include <fstream>
#include <vector>
#include <random>
#include <sstream>
class Data {
protected:
// input data coords
std::vector<double> x;
// centroids coordinates
std::vector<double> y;
// size of the problem
unsigned int ndat, ndim;
unsigned long size;
public:
Data(const std::string &filename) {
std::cout << "======================= I N P U T ============================" << std::endl;
std::cout << "Reading file: " << filename << std::endl;
// read input dataset into file stream
std::fstream instream(filename, std::fstream::in);
std::string line;
ndim = 0;
ndat = 0;
if (instream) {
while (std::getline(instream, line)) {
std::istringstream s(line);
double tmp;
while (s >> tmp) {
if (ndat == 0)
ndim++;
x.push_back(tmp);
// x.push_back(tmp / 100000);
}
ndat++;
}
std::cout << "File successfully loaded!" << std::endl;
}
instream.close();
size = x.size();
std::cout << "The dataset is in R^" << ndim << std::endl;
std::cout << ndat << " data points loaded." << std::endl;
std::cout << "The total size of the problem is: " << size << std::endl;
}
// generate the centroids
void init_centroids(int n) {
std::random_device rd;
std::mt19937_64 eng(rd());
std::uniform_int_distribution<> dist(0, ndat - 1);
std::cout.flush();
std::printf("Selecting %d random centroids from list:", n);
for (int i = 0; i < n; ++i) {
int k = dist(eng);
std::printf("\n%d: ", k);
for (int j = 0; j < ndim; ++j) {
std::printf("%.8f\t", x[k * ndim + j]);
y.push_back(x[k * ndim + j]);
}
std::cout << std::endl;
}
}
unsigned int get_size() {
return ndat;
}
unsigned int get_dim() {
return ndim;
}
// write the data into an MPI_Scatter compatible buffer
double *dataset() {
return x.data();
}
double *centroids() {
return y.data();
}
// print the data to stdout
void print() {
for (int i = 0; i < ndat; ++i){
for (int j = 0; j < ndim; ++j)
std::cout << x[i * ndim + j] << "\t";
std::cout << std::endl;
}
}
};
#endif
| [
"[email protected]"
] | |
596c485d2d0f386aa2e2642a2ec3f3598a5aee5d | dd8849cba469e624c4152dbf85a735acabdf3fd3 | /test/normalize_to_nfkc_000.cpp | 357eab613c4c095b3186b944a17da4bacc7ad0e0 | [
"LicenseRef-scancode-unknown-license-reference",
"BSL-1.0"
] | permissive | skyformat99/text | e237dce1cced4b8b92a1d80d4b25c99edb5772d6 | f9e5979710c9a391e81f3f432ea6fd04e97d5490 | refs/heads/master | 2020-03-22T04:35:53.875892 | 2018-07-01T13:21:27 | 2018-07-01T13:21:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 563,025 | cpp | // Warning! This file is autogenerated.
#include <boost/text/normalize_string.hpp>
#include <boost/text/utility.hpp>
#include <gtest/gtest.h>
#include <algorithm>
TEST(normalization, nfkc_000_000)
{
// 1E0A;1E0A;0044 0307;1E0A;0044 0307;
// (Ḋ; Ḋ; D◌̇; Ḋ; D◌̇; ) LATIN CAPITAL LETTER D WITH DOT ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x1E0A }};
std::array<uint32_t, 1> const c2 = {{ 0x1E0A }};
std::array<uint32_t, 2> const c3 = {{ 0x0044, 0x0307 }};
std::array<uint32_t, 1> const c4 = {{ 0x1E0A }};
std::array<uint32_t, 2> const c5 = {{ 0x0044, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_001)
{
// 1E0C;1E0C;0044 0323;1E0C;0044 0323;
// (Ḍ; Ḍ; D◌̣; Ḍ; D◌̣; ) LATIN CAPITAL LETTER D WITH DOT BELOW
{
std::array<uint32_t, 1> const c1 = {{ 0x1E0C }};
std::array<uint32_t, 1> const c2 = {{ 0x1E0C }};
std::array<uint32_t, 2> const c3 = {{ 0x0044, 0x0323 }};
std::array<uint32_t, 1> const c4 = {{ 0x1E0C }};
std::array<uint32_t, 2> const c5 = {{ 0x0044, 0x0323 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_002)
{
// 1E0A 0323;1E0C 0307;0044 0323 0307;1E0C 0307;0044 0323 0307;
// (Ḋ◌̣; Ḍ◌̇; D◌̣◌̇; Ḍ◌̇; D◌̣◌̇; ) LATIN CAPITAL LETTER D WITH DOT ABOVE, COMBINING DOT BELOW
{
std::array<uint32_t, 2> const c1 = {{ 0x1E0A, 0x0323 }};
std::array<uint32_t, 2> const c2 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 3> const c3 = {{ 0x0044, 0x0323, 0x0307 }};
std::array<uint32_t, 2> const c4 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 3> const c5 = {{ 0x0044, 0x0323, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_003)
{
// 1E0C 0307;1E0C 0307;0044 0323 0307;1E0C 0307;0044 0323 0307;
// (Ḍ◌̇; Ḍ◌̇; D◌̣◌̇; Ḍ◌̇; D◌̣◌̇; ) LATIN CAPITAL LETTER D WITH DOT BELOW, COMBINING DOT ABOVE
{
std::array<uint32_t, 2> const c1 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 2> const c2 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 3> const c3 = {{ 0x0044, 0x0323, 0x0307 }};
std::array<uint32_t, 2> const c4 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 3> const c5 = {{ 0x0044, 0x0323, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_004)
{
// 0044 0307 0323;1E0C 0307;0044 0323 0307;1E0C 0307;0044 0323 0307;
// (D◌̇◌̣; Ḍ◌̇; D◌̣◌̇; Ḍ◌̇; D◌̣◌̇; ) LATIN CAPITAL LETTER D, COMBINING DOT ABOVE, COMBINING DOT BELOW
{
std::array<uint32_t, 3> const c1 = {{ 0x0044, 0x0307, 0x0323 }};
std::array<uint32_t, 2> const c2 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 3> const c3 = {{ 0x0044, 0x0323, 0x0307 }};
std::array<uint32_t, 2> const c4 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 3> const c5 = {{ 0x0044, 0x0323, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_005)
{
// 0044 0323 0307;1E0C 0307;0044 0323 0307;1E0C 0307;0044 0323 0307;
// (D◌̣◌̇; Ḍ◌̇; D◌̣◌̇; Ḍ◌̇; D◌̣◌̇; ) LATIN CAPITAL LETTER D, COMBINING DOT BELOW, COMBINING DOT ABOVE
{
std::array<uint32_t, 3> const c1 = {{ 0x0044, 0x0323, 0x0307 }};
std::array<uint32_t, 2> const c2 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 3> const c3 = {{ 0x0044, 0x0323, 0x0307 }};
std::array<uint32_t, 2> const c4 = {{ 0x1E0C, 0x0307 }};
std::array<uint32_t, 3> const c5 = {{ 0x0044, 0x0323, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_006)
{
// 1E0A 031B;1E0A 031B;0044 031B 0307;1E0A 031B;0044 031B 0307;
// (Ḋ◌̛; Ḋ◌̛; D◌̛◌̇; Ḋ◌̛; D◌̛◌̇; ) LATIN CAPITAL LETTER D WITH DOT ABOVE, COMBINING HORN
{
std::array<uint32_t, 2> const c1 = {{ 0x1E0A, 0x031B }};
std::array<uint32_t, 2> const c2 = {{ 0x1E0A, 0x031B }};
std::array<uint32_t, 3> const c3 = {{ 0x0044, 0x031B, 0x0307 }};
std::array<uint32_t, 2> const c4 = {{ 0x1E0A, 0x031B }};
std::array<uint32_t, 3> const c5 = {{ 0x0044, 0x031B, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_007)
{
// 1E0C 031B;1E0C 031B;0044 031B 0323;1E0C 031B;0044 031B 0323;
// (Ḍ◌̛; Ḍ◌̛; D◌̛◌̣; Ḍ◌̛; D◌̛◌̣; ) LATIN CAPITAL LETTER D WITH DOT BELOW, COMBINING HORN
{
std::array<uint32_t, 2> const c1 = {{ 0x1E0C, 0x031B }};
std::array<uint32_t, 2> const c2 = {{ 0x1E0C, 0x031B }};
std::array<uint32_t, 3> const c3 = {{ 0x0044, 0x031B, 0x0323 }};
std::array<uint32_t, 2> const c4 = {{ 0x1E0C, 0x031B }};
std::array<uint32_t, 3> const c5 = {{ 0x0044, 0x031B, 0x0323 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_008)
{
// 1E0A 031B 0323;1E0C 031B 0307;0044 031B 0323 0307;1E0C 031B 0307;0044 031B 0323 0307;
// (Ḋ◌̛◌̣; Ḍ◌̛◌̇; D◌̛◌̣◌̇; Ḍ◌̛◌̇; D◌̛◌̣◌̇; ) LATIN CAPITAL LETTER D WITH DOT ABOVE, COMBINING HORN, COMBINING DOT BELOW
{
std::array<uint32_t, 3> const c1 = {{ 0x1E0A, 0x031B, 0x0323 }};
std::array<uint32_t, 3> const c2 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 4> const c3 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
std::array<uint32_t, 3> const c4 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 4> const c5 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_009)
{
// 1E0C 031B 0307;1E0C 031B 0307;0044 031B 0323 0307;1E0C 031B 0307;0044 031B 0323 0307;
// (Ḍ◌̛◌̇; Ḍ◌̛◌̇; D◌̛◌̣◌̇; Ḍ◌̛◌̇; D◌̛◌̣◌̇; ) LATIN CAPITAL LETTER D WITH DOT BELOW, COMBINING HORN, COMBINING DOT ABOVE
{
std::array<uint32_t, 3> const c1 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 3> const c2 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 4> const c3 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
std::array<uint32_t, 3> const c4 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 4> const c5 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_010)
{
// 0044 031B 0307 0323;1E0C 031B 0307;0044 031B 0323 0307;1E0C 031B 0307;0044 031B 0323 0307;
// (D◌̛◌̇◌̣; Ḍ◌̛◌̇; D◌̛◌̣◌̇; Ḍ◌̛◌̇; D◌̛◌̣◌̇; ) LATIN CAPITAL LETTER D, COMBINING HORN, COMBINING DOT ABOVE, COMBINING DOT BELOW
{
std::array<uint32_t, 4> const c1 = {{ 0x0044, 0x031B, 0x0307, 0x0323 }};
std::array<uint32_t, 3> const c2 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 4> const c3 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
std::array<uint32_t, 3> const c4 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 4> const c5 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_011)
{
// 0044 031B 0323 0307;1E0C 031B 0307;0044 031B 0323 0307;1E0C 031B 0307;0044 031B 0323 0307;
// (D◌̛◌̣◌̇; Ḍ◌̛◌̇; D◌̛◌̣◌̇; Ḍ◌̛◌̇; D◌̛◌̣◌̇; ) LATIN CAPITAL LETTER D, COMBINING HORN, COMBINING DOT BELOW, COMBINING DOT ABOVE
{
std::array<uint32_t, 4> const c1 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
std::array<uint32_t, 3> const c2 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 4> const c3 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
std::array<uint32_t, 3> const c4 = {{ 0x1E0C, 0x031B, 0x0307 }};
std::array<uint32_t, 4> const c5 = {{ 0x0044, 0x031B, 0x0323, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_012)
{
// 00C8;00C8;0045 0300;00C8;0045 0300;
// (È; È; E◌̀; È; E◌̀; ) LATIN CAPITAL LETTER E WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00C8 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C8 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C8 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_013)
{
// 0112;0112;0045 0304;0112;0045 0304;
// (Ē; Ē; E◌̄; Ē; E◌̄; ) LATIN CAPITAL LETTER E WITH MACRON
{
std::array<uint32_t, 1> const c1 = {{ 0x0112 }};
std::array<uint32_t, 1> const c2 = {{ 0x0112 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0304 }};
std::array<uint32_t, 1> const c4 = {{ 0x0112 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_014)
{
// 0045 0300;00C8;0045 0300;00C8;0045 0300;
// (E◌̀; È; E◌̀; È; E◌̀; ) LATIN CAPITAL LETTER E, COMBINING GRAVE ACCENT
{
std::array<uint32_t, 2> const c1 = {{ 0x0045, 0x0300 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C8 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C8 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_015)
{
// 0045 0304;0112;0045 0304;0112;0045 0304;
// (E◌̄; Ē; E◌̄; Ē; E◌̄; ) LATIN CAPITAL LETTER E, COMBINING MACRON
{
std::array<uint32_t, 2> const c1 = {{ 0x0045, 0x0304 }};
std::array<uint32_t, 1> const c2 = {{ 0x0112 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0304 }};
std::array<uint32_t, 1> const c4 = {{ 0x0112 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_016)
{
// 1E14;1E14;0045 0304 0300;1E14;0045 0304 0300;
// (Ḕ; Ḕ; E◌̄◌̀; Ḕ; E◌̄◌̀; ) LATIN CAPITAL LETTER E WITH MACRON AND GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x1E14 }};
std::array<uint32_t, 1> const c2 = {{ 0x1E14 }};
std::array<uint32_t, 3> const c3 = {{ 0x0045, 0x0304, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x1E14 }};
std::array<uint32_t, 3> const c5 = {{ 0x0045, 0x0304, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_017)
{
// 0112 0300;1E14;0045 0304 0300;1E14;0045 0304 0300;
// (Ē◌̀; Ḕ; E◌̄◌̀; Ḕ; E◌̄◌̀; ) LATIN CAPITAL LETTER E WITH MACRON, COMBINING GRAVE ACCENT
{
std::array<uint32_t, 2> const c1 = {{ 0x0112, 0x0300 }};
std::array<uint32_t, 1> const c2 = {{ 0x1E14 }};
std::array<uint32_t, 3> const c3 = {{ 0x0045, 0x0304, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x1E14 }};
std::array<uint32_t, 3> const c5 = {{ 0x0045, 0x0304, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_018)
{
// 1E14 0304;1E14 0304;0045 0304 0300 0304;1E14 0304;0045 0304 0300 0304;
// (Ḕ◌̄; Ḕ◌̄; E◌̄◌̀◌̄; Ḕ◌̄; E◌̄◌̀◌̄; ) LATIN CAPITAL LETTER E WITH MACRON AND GRAVE, COMBINING MACRON
{
std::array<uint32_t, 2> const c1 = {{ 0x1E14, 0x0304 }};
std::array<uint32_t, 2> const c2 = {{ 0x1E14, 0x0304 }};
std::array<uint32_t, 4> const c3 = {{ 0x0045, 0x0304, 0x0300, 0x0304 }};
std::array<uint32_t, 2> const c4 = {{ 0x1E14, 0x0304 }};
std::array<uint32_t, 4> const c5 = {{ 0x0045, 0x0304, 0x0300, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_019)
{
// 0045 0304 0300;1E14;0045 0304 0300;1E14;0045 0304 0300;
// (E◌̄◌̀; Ḕ; E◌̄◌̀; Ḕ; E◌̄◌̀; ) LATIN CAPITAL LETTER E, COMBINING MACRON, COMBINING GRAVE ACCENT
{
std::array<uint32_t, 3> const c1 = {{ 0x0045, 0x0304, 0x0300 }};
std::array<uint32_t, 1> const c2 = {{ 0x1E14 }};
std::array<uint32_t, 3> const c3 = {{ 0x0045, 0x0304, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x1E14 }};
std::array<uint32_t, 3> const c5 = {{ 0x0045, 0x0304, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_020)
{
// 0045 0300 0304;00C8 0304;0045 0300 0304;00C8 0304;0045 0300 0304;
// (E◌̀◌̄; È◌̄; E◌̀◌̄; È◌̄; E◌̀◌̄; ) LATIN CAPITAL LETTER E, COMBINING GRAVE ACCENT, COMBINING MACRON
{
std::array<uint32_t, 3> const c1 = {{ 0x0045, 0x0300, 0x0304 }};
std::array<uint32_t, 2> const c2 = {{ 0x00C8, 0x0304 }};
std::array<uint32_t, 3> const c3 = {{ 0x0045, 0x0300, 0x0304 }};
std::array<uint32_t, 2> const c4 = {{ 0x00C8, 0x0304 }};
std::array<uint32_t, 3> const c5 = {{ 0x0045, 0x0300, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_021)
{
// 05B8 05B9 05B1 0591 05C3 05B0 05AC 059F;05B1 05B8 05B9 0591 05C3 05B0 05AC 059F;05B1 05B8 05B9 0591 05C3 05B0 05AC 059F;05B1 05B8 05B9 0591 05C3 05B0 05AC 059F;05B1 05B8 05B9 0591 05C3 05B0 05AC 059F;
// (◌ָ◌ֹ◌ֱ◌֑׃◌ְ◌֬◌֟; ◌ֱ◌ָ◌ֹ◌֑׃◌ְ◌֬◌֟; ◌ֱ◌ָ◌ֹ◌֑׃◌ְ◌֬◌֟; ◌ֱ◌ָ◌ֹ◌֑׃◌ְ◌֬◌֟; ◌ֱ◌ָ◌ֹ◌֑׃◌ְ◌֬◌֟; ) HEBREW POINT QAMATS, HEBREW POINT HOLAM, HEBREW POINT HATAF SEGOL, HEBREW ACCENT ETNAHTA, HEBREW PUNCTUATION SOF PASUQ, HEBREW POINT SHEVA, HEBREW ACCENT ILUY, HEBREW ACCENT QARNEY PARA
{
std::array<uint32_t, 8> const c1 = {{ 0x05B8, 0x05B9, 0x05B1, 0x0591, 0x05C3, 0x05B0, 0x05AC, 0x059F }};
std::array<uint32_t, 8> const c2 = {{ 0x05B1, 0x05B8, 0x05B9, 0x0591, 0x05C3, 0x05B0, 0x05AC, 0x059F }};
std::array<uint32_t, 8> const c3 = {{ 0x05B1, 0x05B8, 0x05B9, 0x0591, 0x05C3, 0x05B0, 0x05AC, 0x059F }};
std::array<uint32_t, 8> const c4 = {{ 0x05B1, 0x05B8, 0x05B9, 0x0591, 0x05C3, 0x05B0, 0x05AC, 0x059F }};
std::array<uint32_t, 8> const c5 = {{ 0x05B1, 0x05B8, 0x05B9, 0x0591, 0x05C3, 0x05B0, 0x05AC, 0x059F }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_022)
{
// 0592 05B7 05BC 05A5 05B0 05C0 05C4 05AD;05B0 05B7 05BC 05A5 0592 05C0 05AD 05C4;05B0 05B7 05BC 05A5 0592 05C0 05AD 05C4;05B0 05B7 05BC 05A5 0592 05C0 05AD 05C4;05B0 05B7 05BC 05A5 0592 05C0 05AD 05C4;
// (◌֒◌ַ◌ּ◌֥◌ְ׀◌ׄ◌֭; ◌ְ◌ַ◌ּ◌֥◌֒׀◌֭◌ׄ; ◌ְ◌ַ◌ּ◌֥◌֒׀◌֭◌ׄ; ◌ְ◌ַ◌ּ◌֥◌֒׀◌֭◌ׄ; ◌ְ◌ַ◌ּ◌֥◌֒׀◌֭◌ׄ; ) HEBREW ACCENT SEGOL, HEBREW POINT PATAH, HEBREW POINT DAGESH OR MAPIQ, HEBREW ACCENT MERKHA, HEBREW POINT SHEVA, HEBREW PUNCTUATION PASEQ, HEBREW MARK UPPER DOT, HEBREW ACCENT DEHI
{
std::array<uint32_t, 8> const c1 = {{ 0x0592, 0x05B7, 0x05BC, 0x05A5, 0x05B0, 0x05C0, 0x05C4, 0x05AD }};
std::array<uint32_t, 8> const c2 = {{ 0x05B0, 0x05B7, 0x05BC, 0x05A5, 0x0592, 0x05C0, 0x05AD, 0x05C4 }};
std::array<uint32_t, 8> const c3 = {{ 0x05B0, 0x05B7, 0x05BC, 0x05A5, 0x0592, 0x05C0, 0x05AD, 0x05C4 }};
std::array<uint32_t, 8> const c4 = {{ 0x05B0, 0x05B7, 0x05BC, 0x05A5, 0x0592, 0x05C0, 0x05AD, 0x05C4 }};
std::array<uint32_t, 8> const c5 = {{ 0x05B0, 0x05B7, 0x05BC, 0x05A5, 0x0592, 0x05C0, 0x05AD, 0x05C4 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_023)
{
// 1100 AC00 11A8;1100 AC01;1100 1100 1161 11A8;1100 AC01;1100 1100 1161 11A8;
// (ᄀ각; ᄀ각; ᄀ각; ᄀ각; ᄀ각; ) HANGUL CHOSEONG KIYEOK, HANGUL SYLLABLE GA, HANGUL JONGSEONG KIYEOK
{
std::array<uint32_t, 3> const c1 = {{ 0x1100, 0xAC00, 0x11A8 }};
std::array<uint32_t, 2> const c2 = {{ 0x1100, 0xAC01 }};
std::array<uint32_t, 4> const c3 = {{ 0x1100, 0x1100, 0x1161, 0x11A8 }};
std::array<uint32_t, 2> const c4 = {{ 0x1100, 0xAC01 }};
std::array<uint32_t, 4> const c5 = {{ 0x1100, 0x1100, 0x1161, 0x11A8 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_024)
{
// 1100 AC00 11A8 11A8;1100 AC01 11A8;1100 1100 1161 11A8 11A8;1100 AC01 11A8;1100 1100 1161 11A8 11A8;
// (ᄀ각ᆨ; ᄀ각ᆨ; ᄀ각ᆨ; ᄀ각ᆨ; ᄀ각ᆨ; ) HANGUL CHOSEONG KIYEOK, HANGUL SYLLABLE GA, HANGUL JONGSEONG KIYEOK, HANGUL JONGSEONG KIYEOK
{
std::array<uint32_t, 4> const c1 = {{ 0x1100, 0xAC00, 0x11A8, 0x11A8 }};
std::array<uint32_t, 3> const c2 = {{ 0x1100, 0xAC01, 0x11A8 }};
std::array<uint32_t, 5> const c3 = {{ 0x1100, 0x1100, 0x1161, 0x11A8, 0x11A8 }};
std::array<uint32_t, 3> const c4 = {{ 0x1100, 0xAC01, 0x11A8 }};
std::array<uint32_t, 5> const c5 = {{ 0x1100, 0x1100, 0x1161, 0x11A8, 0x11A8 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_025)
{
// 00A0;00A0;00A0;0020;0020;
// ( ; ; ; ; ; ) NO-BREAK SPACE
{
std::array<uint32_t, 1> const c1 = {{ 0x00A0 }};
std::array<uint32_t, 1> const c2 = {{ 0x00A0 }};
std::array<uint32_t, 1> const c3 = {{ 0x00A0 }};
std::array<uint32_t, 1> const c4 = {{ 0x0020 }};
std::array<uint32_t, 1> const c5 = {{ 0x0020 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_026)
{
// 00A8;00A8;00A8;0020 0308;0020 0308;
// (¨; ¨; ¨; ◌̈; ◌̈; ) DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00A8 }};
std::array<uint32_t, 1> const c2 = {{ 0x00A8 }};
std::array<uint32_t, 1> const c3 = {{ 0x00A8 }};
std::array<uint32_t, 2> const c4 = {{ 0x0020, 0x0308 }};
std::array<uint32_t, 2> const c5 = {{ 0x0020, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_027)
{
// 00AA;00AA;00AA;0061;0061;
// (ª; ª; ª; a; a; ) FEMININE ORDINAL INDICATOR
{
std::array<uint32_t, 1> const c1 = {{ 0x00AA }};
std::array<uint32_t, 1> const c2 = {{ 0x00AA }};
std::array<uint32_t, 1> const c3 = {{ 0x00AA }};
std::array<uint32_t, 1> const c4 = {{ 0x0061 }};
std::array<uint32_t, 1> const c5 = {{ 0x0061 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_028)
{
// 00AF;00AF;00AF;0020 0304;0020 0304;
// (¯; ¯; ¯; ◌̄; ◌̄; ) MACRON
{
std::array<uint32_t, 1> const c1 = {{ 0x00AF }};
std::array<uint32_t, 1> const c2 = {{ 0x00AF }};
std::array<uint32_t, 1> const c3 = {{ 0x00AF }};
std::array<uint32_t, 2> const c4 = {{ 0x0020, 0x0304 }};
std::array<uint32_t, 2> const c5 = {{ 0x0020, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_029)
{
// 00B2;00B2;00B2;0032;0032;
// (²; ²; ²; 2; 2; ) SUPERSCRIPT TWO
{
std::array<uint32_t, 1> const c1 = {{ 0x00B2 }};
std::array<uint32_t, 1> const c2 = {{ 0x00B2 }};
std::array<uint32_t, 1> const c3 = {{ 0x00B2 }};
std::array<uint32_t, 1> const c4 = {{ 0x0032 }};
std::array<uint32_t, 1> const c5 = {{ 0x0032 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_030)
{
// 00B3;00B3;00B3;0033;0033;
// (³; ³; ³; 3; 3; ) SUPERSCRIPT THREE
{
std::array<uint32_t, 1> const c1 = {{ 0x00B3 }};
std::array<uint32_t, 1> const c2 = {{ 0x00B3 }};
std::array<uint32_t, 1> const c3 = {{ 0x00B3 }};
std::array<uint32_t, 1> const c4 = {{ 0x0033 }};
std::array<uint32_t, 1> const c5 = {{ 0x0033 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_031)
{
// 00B4;00B4;00B4;0020 0301;0020 0301;
// (´; ´; ´; ◌́; ◌́; ) ACUTE ACCENT
{
std::array<uint32_t, 1> const c1 = {{ 0x00B4 }};
std::array<uint32_t, 1> const c2 = {{ 0x00B4 }};
std::array<uint32_t, 1> const c3 = {{ 0x00B4 }};
std::array<uint32_t, 2> const c4 = {{ 0x0020, 0x0301 }};
std::array<uint32_t, 2> const c5 = {{ 0x0020, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_032)
{
// 00B5;00B5;00B5;03BC;03BC;
// (µ; µ; µ; μ; μ; ) MICRO SIGN
{
std::array<uint32_t, 1> const c1 = {{ 0x00B5 }};
std::array<uint32_t, 1> const c2 = {{ 0x00B5 }};
std::array<uint32_t, 1> const c3 = {{ 0x00B5 }};
std::array<uint32_t, 1> const c4 = {{ 0x03BC }};
std::array<uint32_t, 1> const c5 = {{ 0x03BC }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_033)
{
// 00B8;00B8;00B8;0020 0327;0020 0327;
// (¸; ¸; ¸; ◌̧; ◌̧; ) CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x00B8 }};
std::array<uint32_t, 1> const c2 = {{ 0x00B8 }};
std::array<uint32_t, 1> const c3 = {{ 0x00B8 }};
std::array<uint32_t, 2> const c4 = {{ 0x0020, 0x0327 }};
std::array<uint32_t, 2> const c5 = {{ 0x0020, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_034)
{
// 00B9;00B9;00B9;0031;0031;
// (¹; ¹; ¹; 1; 1; ) SUPERSCRIPT ONE
{
std::array<uint32_t, 1> const c1 = {{ 0x00B9 }};
std::array<uint32_t, 1> const c2 = {{ 0x00B9 }};
std::array<uint32_t, 1> const c3 = {{ 0x00B9 }};
std::array<uint32_t, 1> const c4 = {{ 0x0031 }};
std::array<uint32_t, 1> const c5 = {{ 0x0031 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_035)
{
// 00BA;00BA;00BA;006F;006F;
// (º; º; º; o; o; ) MASCULINE ORDINAL INDICATOR
{
std::array<uint32_t, 1> const c1 = {{ 0x00BA }};
std::array<uint32_t, 1> const c2 = {{ 0x00BA }};
std::array<uint32_t, 1> const c3 = {{ 0x00BA }};
std::array<uint32_t, 1> const c4 = {{ 0x006F }};
std::array<uint32_t, 1> const c5 = {{ 0x006F }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_036)
{
// 00BC;00BC;00BC;0031 2044 0034;0031 2044 0034;
// (¼; ¼; ¼; 1⁄4; 1⁄4; ) VULGAR FRACTION ONE QUARTER
{
std::array<uint32_t, 1> const c1 = {{ 0x00BC }};
std::array<uint32_t, 1> const c2 = {{ 0x00BC }};
std::array<uint32_t, 1> const c3 = {{ 0x00BC }};
std::array<uint32_t, 3> const c4 = {{ 0x0031, 0x2044, 0x0034 }};
std::array<uint32_t, 3> const c5 = {{ 0x0031, 0x2044, 0x0034 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_037)
{
// 00BD;00BD;00BD;0031 2044 0032;0031 2044 0032;
// (½; ½; ½; 1⁄2; 1⁄2; ) VULGAR FRACTION ONE HALF
{
std::array<uint32_t, 1> const c1 = {{ 0x00BD }};
std::array<uint32_t, 1> const c2 = {{ 0x00BD }};
std::array<uint32_t, 1> const c3 = {{ 0x00BD }};
std::array<uint32_t, 3> const c4 = {{ 0x0031, 0x2044, 0x0032 }};
std::array<uint32_t, 3> const c5 = {{ 0x0031, 0x2044, 0x0032 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_038)
{
// 00BE;00BE;00BE;0033 2044 0034;0033 2044 0034;
// (¾; ¾; ¾; 3⁄4; 3⁄4; ) VULGAR FRACTION THREE QUARTERS
{
std::array<uint32_t, 1> const c1 = {{ 0x00BE }};
std::array<uint32_t, 1> const c2 = {{ 0x00BE }};
std::array<uint32_t, 1> const c3 = {{ 0x00BE }};
std::array<uint32_t, 3> const c4 = {{ 0x0033, 0x2044, 0x0034 }};
std::array<uint32_t, 3> const c5 = {{ 0x0033, 0x2044, 0x0034 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_039)
{
// 00C0;00C0;0041 0300;00C0;0041 0300;
// (À; À; A◌̀; À; A◌̀; ) LATIN CAPITAL LETTER A WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00C0 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C0 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C0 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_040)
{
// 00C1;00C1;0041 0301;00C1;0041 0301;
// (Á; Á; A◌́; Á; A◌́; ) LATIN CAPITAL LETTER A WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00C1 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C1 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C1 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_041)
{
// 00C2;00C2;0041 0302;00C2;0041 0302;
// (Â; Â; A◌̂; Â; A◌̂; ) LATIN CAPITAL LETTER A WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00C2 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C2 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C2 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_042)
{
// 00C3;00C3;0041 0303;00C3;0041 0303;
// (Ã; Ã; A◌̃; Ã; A◌̃; ) LATIN CAPITAL LETTER A WITH TILDE
{
std::array<uint32_t, 1> const c1 = {{ 0x00C3 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C3 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x0303 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C3 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x0303 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_043)
{
// 00C4;00C4;0041 0308;00C4;0041 0308;
// (Ä; Ä; A◌̈; Ä; A◌̈; ) LATIN CAPITAL LETTER A WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00C4 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C4 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C4 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_044)
{
// 00C5;00C5;0041 030A;00C5;0041 030A;
// (Å; Å; A◌̊; Å; A◌̊; ) LATIN CAPITAL LETTER A WITH RING ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00C5 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C5 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x030A }};
std::array<uint32_t, 1> const c4 = {{ 0x00C5 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x030A }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_045)
{
// 00C7;00C7;0043 0327;00C7;0043 0327;
// (Ç; Ç; C◌̧; Ç; C◌̧; ) LATIN CAPITAL LETTER C WITH CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x00C7 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C7 }};
std::array<uint32_t, 2> const c3 = {{ 0x0043, 0x0327 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C7 }};
std::array<uint32_t, 2> const c5 = {{ 0x0043, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_046)
{
// 00C8;00C8;0045 0300;00C8;0045 0300;
// (È; È; E◌̀; È; E◌̀; ) LATIN CAPITAL LETTER E WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00C8 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C8 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C8 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_047)
{
// 00C9;00C9;0045 0301;00C9;0045 0301;
// (É; É; E◌́; É; E◌́; ) LATIN CAPITAL LETTER E WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00C9 }};
std::array<uint32_t, 1> const c2 = {{ 0x00C9 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00C9 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_048)
{
// 00CA;00CA;0045 0302;00CA;0045 0302;
// (Ê; Ê; E◌̂; Ê; E◌̂; ) LATIN CAPITAL LETTER E WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00CA }};
std::array<uint32_t, 1> const c2 = {{ 0x00CA }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00CA }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_049)
{
// 00CB;00CB;0045 0308;00CB;0045 0308;
// (Ë; Ë; E◌̈; Ë; E◌̈; ) LATIN CAPITAL LETTER E WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00CB }};
std::array<uint32_t, 1> const c2 = {{ 0x00CB }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00CB }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_050)
{
// 00CC;00CC;0049 0300;00CC;0049 0300;
// (Ì; Ì; I◌̀; Ì; I◌̀; ) LATIN CAPITAL LETTER I WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00CC }};
std::array<uint32_t, 1> const c2 = {{ 0x00CC }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00CC }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_051)
{
// 00CD;00CD;0049 0301;00CD;0049 0301;
// (Í; Í; I◌́; Í; I◌́; ) LATIN CAPITAL LETTER I WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00CD }};
std::array<uint32_t, 1> const c2 = {{ 0x00CD }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00CD }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_052)
{
// 00CE;00CE;0049 0302;00CE;0049 0302;
// (Î; Î; I◌̂; Î; I◌̂; ) LATIN CAPITAL LETTER I WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00CE }};
std::array<uint32_t, 1> const c2 = {{ 0x00CE }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00CE }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_053)
{
// 00CF;00CF;0049 0308;00CF;0049 0308;
// (Ï; Ï; I◌̈; Ï; I◌̈; ) LATIN CAPITAL LETTER I WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00CF }};
std::array<uint32_t, 1> const c2 = {{ 0x00CF }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00CF }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_054)
{
// 00D1;00D1;004E 0303;00D1;004E 0303;
// (Ñ; Ñ; N◌̃; Ñ; N◌̃; ) LATIN CAPITAL LETTER N WITH TILDE
{
std::array<uint32_t, 1> const c1 = {{ 0x00D1 }};
std::array<uint32_t, 1> const c2 = {{ 0x00D1 }};
std::array<uint32_t, 2> const c3 = {{ 0x004E, 0x0303 }};
std::array<uint32_t, 1> const c4 = {{ 0x00D1 }};
std::array<uint32_t, 2> const c5 = {{ 0x004E, 0x0303 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_055)
{
// 00D2;00D2;004F 0300;00D2;004F 0300;
// (Ò; Ò; O◌̀; Ò; O◌̀; ) LATIN CAPITAL LETTER O WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00D2 }};
std::array<uint32_t, 1> const c2 = {{ 0x00D2 }};
std::array<uint32_t, 2> const c3 = {{ 0x004F, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00D2 }};
std::array<uint32_t, 2> const c5 = {{ 0x004F, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_056)
{
// 00D3;00D3;004F 0301;00D3;004F 0301;
// (Ó; Ó; O◌́; Ó; O◌́; ) LATIN CAPITAL LETTER O WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00D3 }};
std::array<uint32_t, 1> const c2 = {{ 0x00D3 }};
std::array<uint32_t, 2> const c3 = {{ 0x004F, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00D3 }};
std::array<uint32_t, 2> const c5 = {{ 0x004F, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_057)
{
// 00D4;00D4;004F 0302;00D4;004F 0302;
// (Ô; Ô; O◌̂; Ô; O◌̂; ) LATIN CAPITAL LETTER O WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00D4 }};
std::array<uint32_t, 1> const c2 = {{ 0x00D4 }};
std::array<uint32_t, 2> const c3 = {{ 0x004F, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00D4 }};
std::array<uint32_t, 2> const c5 = {{ 0x004F, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_058)
{
// 00D5;00D5;004F 0303;00D5;004F 0303;
// (Õ; Õ; O◌̃; Õ; O◌̃; ) LATIN CAPITAL LETTER O WITH TILDE
{
std::array<uint32_t, 1> const c1 = {{ 0x00D5 }};
std::array<uint32_t, 1> const c2 = {{ 0x00D5 }};
std::array<uint32_t, 2> const c3 = {{ 0x004F, 0x0303 }};
std::array<uint32_t, 1> const c4 = {{ 0x00D5 }};
std::array<uint32_t, 2> const c5 = {{ 0x004F, 0x0303 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_059)
{
// 00D6;00D6;004F 0308;00D6;004F 0308;
// (Ö; Ö; O◌̈; Ö; O◌̈; ) LATIN CAPITAL LETTER O WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00D6 }};
std::array<uint32_t, 1> const c2 = {{ 0x00D6 }};
std::array<uint32_t, 2> const c3 = {{ 0x004F, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00D6 }};
std::array<uint32_t, 2> const c5 = {{ 0x004F, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_060)
{
// 00D9;00D9;0055 0300;00D9;0055 0300;
// (Ù; Ù; U◌̀; Ù; U◌̀; ) LATIN CAPITAL LETTER U WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00D9 }};
std::array<uint32_t, 1> const c2 = {{ 0x00D9 }};
std::array<uint32_t, 2> const c3 = {{ 0x0055, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00D9 }};
std::array<uint32_t, 2> const c5 = {{ 0x0055, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_061)
{
// 00DA;00DA;0055 0301;00DA;0055 0301;
// (Ú; Ú; U◌́; Ú; U◌́; ) LATIN CAPITAL LETTER U WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00DA }};
std::array<uint32_t, 1> const c2 = {{ 0x00DA }};
std::array<uint32_t, 2> const c3 = {{ 0x0055, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00DA }};
std::array<uint32_t, 2> const c5 = {{ 0x0055, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_062)
{
// 00DB;00DB;0055 0302;00DB;0055 0302;
// (Û; Û; U◌̂; Û; U◌̂; ) LATIN CAPITAL LETTER U WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00DB }};
std::array<uint32_t, 1> const c2 = {{ 0x00DB }};
std::array<uint32_t, 2> const c3 = {{ 0x0055, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00DB }};
std::array<uint32_t, 2> const c5 = {{ 0x0055, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_063)
{
// 00DC;00DC;0055 0308;00DC;0055 0308;
// (Ü; Ü; U◌̈; Ü; U◌̈; ) LATIN CAPITAL LETTER U WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00DC }};
std::array<uint32_t, 1> const c2 = {{ 0x00DC }};
std::array<uint32_t, 2> const c3 = {{ 0x0055, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00DC }};
std::array<uint32_t, 2> const c5 = {{ 0x0055, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_064)
{
// 00DD;00DD;0059 0301;00DD;0059 0301;
// (Ý; Ý; Y◌́; Ý; Y◌́; ) LATIN CAPITAL LETTER Y WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00DD }};
std::array<uint32_t, 1> const c2 = {{ 0x00DD }};
std::array<uint32_t, 2> const c3 = {{ 0x0059, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00DD }};
std::array<uint32_t, 2> const c5 = {{ 0x0059, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_065)
{
// 00E0;00E0;0061 0300;00E0;0061 0300;
// (à; à; a◌̀; à; a◌̀; ) LATIN SMALL LETTER A WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00E0 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E0 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00E0 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_066)
{
// 00E1;00E1;0061 0301;00E1;0061 0301;
// (á; á; a◌́; á; a◌́; ) LATIN SMALL LETTER A WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00E1 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E1 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00E1 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_067)
{
// 00E2;00E2;0061 0302;00E2;0061 0302;
// (â; â; a◌̂; â; a◌̂; ) LATIN SMALL LETTER A WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00E2 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E2 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00E2 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_068)
{
// 00E3;00E3;0061 0303;00E3;0061 0303;
// (ã; ã; a◌̃; ã; a◌̃; ) LATIN SMALL LETTER A WITH TILDE
{
std::array<uint32_t, 1> const c1 = {{ 0x00E3 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E3 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x0303 }};
std::array<uint32_t, 1> const c4 = {{ 0x00E3 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x0303 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_069)
{
// 00E4;00E4;0061 0308;00E4;0061 0308;
// (ä; ä; a◌̈; ä; a◌̈; ) LATIN SMALL LETTER A WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00E4 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E4 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00E4 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_070)
{
// 00E5;00E5;0061 030A;00E5;0061 030A;
// (å; å; a◌̊; å; a◌̊; ) LATIN SMALL LETTER A WITH RING ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00E5 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E5 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x030A }};
std::array<uint32_t, 1> const c4 = {{ 0x00E5 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x030A }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_071)
{
// 00E7;00E7;0063 0327;00E7;0063 0327;
// (ç; ç; c◌̧; ç; c◌̧; ) LATIN SMALL LETTER C WITH CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x00E7 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E7 }};
std::array<uint32_t, 2> const c3 = {{ 0x0063, 0x0327 }};
std::array<uint32_t, 1> const c4 = {{ 0x00E7 }};
std::array<uint32_t, 2> const c5 = {{ 0x0063, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_072)
{
// 00E8;00E8;0065 0300;00E8;0065 0300;
// (è; è; e◌̀; è; e◌̀; ) LATIN SMALL LETTER E WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00E8 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E8 }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00E8 }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_073)
{
// 00E9;00E9;0065 0301;00E9;0065 0301;
// (é; é; e◌́; é; e◌́; ) LATIN SMALL LETTER E WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00E9 }};
std::array<uint32_t, 1> const c2 = {{ 0x00E9 }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00E9 }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_074)
{
// 00EA;00EA;0065 0302;00EA;0065 0302;
// (ê; ê; e◌̂; ê; e◌̂; ) LATIN SMALL LETTER E WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00EA }};
std::array<uint32_t, 1> const c2 = {{ 0x00EA }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00EA }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_075)
{
// 00EB;00EB;0065 0308;00EB;0065 0308;
// (ë; ë; e◌̈; ë; e◌̈; ) LATIN SMALL LETTER E WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00EB }};
std::array<uint32_t, 1> const c2 = {{ 0x00EB }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00EB }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_076)
{
// 00EC;00EC;0069 0300;00EC;0069 0300;
// (ì; ì; i◌̀; ì; i◌̀; ) LATIN SMALL LETTER I WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00EC }};
std::array<uint32_t, 1> const c2 = {{ 0x00EC }};
std::array<uint32_t, 2> const c3 = {{ 0x0069, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00EC }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_077)
{
// 00ED;00ED;0069 0301;00ED;0069 0301;
// (í; í; i◌́; í; i◌́; ) LATIN SMALL LETTER I WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00ED }};
std::array<uint32_t, 1> const c2 = {{ 0x00ED }};
std::array<uint32_t, 2> const c3 = {{ 0x0069, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00ED }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_078)
{
// 00EE;00EE;0069 0302;00EE;0069 0302;
// (î; î; i◌̂; î; i◌̂; ) LATIN SMALL LETTER I WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00EE }};
std::array<uint32_t, 1> const c2 = {{ 0x00EE }};
std::array<uint32_t, 2> const c3 = {{ 0x0069, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00EE }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_079)
{
// 00EF;00EF;0069 0308;00EF;0069 0308;
// (ï; ï; i◌̈; ï; i◌̈; ) LATIN SMALL LETTER I WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00EF }};
std::array<uint32_t, 1> const c2 = {{ 0x00EF }};
std::array<uint32_t, 2> const c3 = {{ 0x0069, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00EF }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_080)
{
// 00F1;00F1;006E 0303;00F1;006E 0303;
// (ñ; ñ; n◌̃; ñ; n◌̃; ) LATIN SMALL LETTER N WITH TILDE
{
std::array<uint32_t, 1> const c1 = {{ 0x00F1 }};
std::array<uint32_t, 1> const c2 = {{ 0x00F1 }};
std::array<uint32_t, 2> const c3 = {{ 0x006E, 0x0303 }};
std::array<uint32_t, 1> const c4 = {{ 0x00F1 }};
std::array<uint32_t, 2> const c5 = {{ 0x006E, 0x0303 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_081)
{
// 00F2;00F2;006F 0300;00F2;006F 0300;
// (ò; ò; o◌̀; ò; o◌̀; ) LATIN SMALL LETTER O WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00F2 }};
std::array<uint32_t, 1> const c2 = {{ 0x00F2 }};
std::array<uint32_t, 2> const c3 = {{ 0x006F, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00F2 }};
std::array<uint32_t, 2> const c5 = {{ 0x006F, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_082)
{
// 00F3;00F3;006F 0301;00F3;006F 0301;
// (ó; ó; o◌́; ó; o◌́; ) LATIN SMALL LETTER O WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00F3 }};
std::array<uint32_t, 1> const c2 = {{ 0x00F3 }};
std::array<uint32_t, 2> const c3 = {{ 0x006F, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00F3 }};
std::array<uint32_t, 2> const c5 = {{ 0x006F, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_083)
{
// 00F4;00F4;006F 0302;00F4;006F 0302;
// (ô; ô; o◌̂; ô; o◌̂; ) LATIN SMALL LETTER O WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00F4 }};
std::array<uint32_t, 1> const c2 = {{ 0x00F4 }};
std::array<uint32_t, 2> const c3 = {{ 0x006F, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00F4 }};
std::array<uint32_t, 2> const c5 = {{ 0x006F, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_084)
{
// 00F5;00F5;006F 0303;00F5;006F 0303;
// (õ; õ; o◌̃; õ; o◌̃; ) LATIN SMALL LETTER O WITH TILDE
{
std::array<uint32_t, 1> const c1 = {{ 0x00F5 }};
std::array<uint32_t, 1> const c2 = {{ 0x00F5 }};
std::array<uint32_t, 2> const c3 = {{ 0x006F, 0x0303 }};
std::array<uint32_t, 1> const c4 = {{ 0x00F5 }};
std::array<uint32_t, 2> const c5 = {{ 0x006F, 0x0303 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_085)
{
// 00F6;00F6;006F 0308;00F6;006F 0308;
// (ö; ö; o◌̈; ö; o◌̈; ) LATIN SMALL LETTER O WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00F6 }};
std::array<uint32_t, 1> const c2 = {{ 0x00F6 }};
std::array<uint32_t, 2> const c3 = {{ 0x006F, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00F6 }};
std::array<uint32_t, 2> const c5 = {{ 0x006F, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_086)
{
// 00F9;00F9;0075 0300;00F9;0075 0300;
// (ù; ù; u◌̀; ù; u◌̀; ) LATIN SMALL LETTER U WITH GRAVE
{
std::array<uint32_t, 1> const c1 = {{ 0x00F9 }};
std::array<uint32_t, 1> const c2 = {{ 0x00F9 }};
std::array<uint32_t, 2> const c3 = {{ 0x0075, 0x0300 }};
std::array<uint32_t, 1> const c4 = {{ 0x00F9 }};
std::array<uint32_t, 2> const c5 = {{ 0x0075, 0x0300 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_087)
{
// 00FA;00FA;0075 0301;00FA;0075 0301;
// (ú; ú; u◌́; ú; u◌́; ) LATIN SMALL LETTER U WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00FA }};
std::array<uint32_t, 1> const c2 = {{ 0x00FA }};
std::array<uint32_t, 2> const c3 = {{ 0x0075, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00FA }};
std::array<uint32_t, 2> const c5 = {{ 0x0075, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_088)
{
// 00FB;00FB;0075 0302;00FB;0075 0302;
// (û; û; u◌̂; û; u◌̂; ) LATIN SMALL LETTER U WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x00FB }};
std::array<uint32_t, 1> const c2 = {{ 0x00FB }};
std::array<uint32_t, 2> const c3 = {{ 0x0075, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x00FB }};
std::array<uint32_t, 2> const c5 = {{ 0x0075, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_089)
{
// 00FC;00FC;0075 0308;00FC;0075 0308;
// (ü; ü; u◌̈; ü; u◌̈; ) LATIN SMALL LETTER U WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00FC }};
std::array<uint32_t, 1> const c2 = {{ 0x00FC }};
std::array<uint32_t, 2> const c3 = {{ 0x0075, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00FC }};
std::array<uint32_t, 2> const c5 = {{ 0x0075, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_090)
{
// 00FD;00FD;0079 0301;00FD;0079 0301;
// (ý; ý; y◌́; ý; y◌́; ) LATIN SMALL LETTER Y WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x00FD }};
std::array<uint32_t, 1> const c2 = {{ 0x00FD }};
std::array<uint32_t, 2> const c3 = {{ 0x0079, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x00FD }};
std::array<uint32_t, 2> const c5 = {{ 0x0079, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_091)
{
// 00FF;00FF;0079 0308;00FF;0079 0308;
// (ÿ; ÿ; y◌̈; ÿ; y◌̈; ) LATIN SMALL LETTER Y WITH DIAERESIS
{
std::array<uint32_t, 1> const c1 = {{ 0x00FF }};
std::array<uint32_t, 1> const c2 = {{ 0x00FF }};
std::array<uint32_t, 2> const c3 = {{ 0x0079, 0x0308 }};
std::array<uint32_t, 1> const c4 = {{ 0x00FF }};
std::array<uint32_t, 2> const c5 = {{ 0x0079, 0x0308 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_092)
{
// 0100;0100;0041 0304;0100;0041 0304;
// (Ā; Ā; A◌̄; Ā; A◌̄; ) LATIN CAPITAL LETTER A WITH MACRON
{
std::array<uint32_t, 1> const c1 = {{ 0x0100 }};
std::array<uint32_t, 1> const c2 = {{ 0x0100 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x0304 }};
std::array<uint32_t, 1> const c4 = {{ 0x0100 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_093)
{
// 0101;0101;0061 0304;0101;0061 0304;
// (ā; ā; a◌̄; ā; a◌̄; ) LATIN SMALL LETTER A WITH MACRON
{
std::array<uint32_t, 1> const c1 = {{ 0x0101 }};
std::array<uint32_t, 1> const c2 = {{ 0x0101 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x0304 }};
std::array<uint32_t, 1> const c4 = {{ 0x0101 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_094)
{
// 0102;0102;0041 0306;0102;0041 0306;
// (Ă; Ă; A◌̆; Ă; A◌̆; ) LATIN CAPITAL LETTER A WITH BREVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0102 }};
std::array<uint32_t, 1> const c2 = {{ 0x0102 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x0306 }};
std::array<uint32_t, 1> const c4 = {{ 0x0102 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x0306 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_095)
{
// 0103;0103;0061 0306;0103;0061 0306;
// (ă; ă; a◌̆; ă; a◌̆; ) LATIN SMALL LETTER A WITH BREVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0103 }};
std::array<uint32_t, 1> const c2 = {{ 0x0103 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x0306 }};
std::array<uint32_t, 1> const c4 = {{ 0x0103 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x0306 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_096)
{
// 0104;0104;0041 0328;0104;0041 0328;
// (Ą; Ą; A◌̨; Ą; A◌̨; ) LATIN CAPITAL LETTER A WITH OGONEK
{
std::array<uint32_t, 1> const c1 = {{ 0x0104 }};
std::array<uint32_t, 1> const c2 = {{ 0x0104 }};
std::array<uint32_t, 2> const c3 = {{ 0x0041, 0x0328 }};
std::array<uint32_t, 1> const c4 = {{ 0x0104 }};
std::array<uint32_t, 2> const c5 = {{ 0x0041, 0x0328 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_097)
{
// 0105;0105;0061 0328;0105;0061 0328;
// (ą; ą; a◌̨; ą; a◌̨; ) LATIN SMALL LETTER A WITH OGONEK
{
std::array<uint32_t, 1> const c1 = {{ 0x0105 }};
std::array<uint32_t, 1> const c2 = {{ 0x0105 }};
std::array<uint32_t, 2> const c3 = {{ 0x0061, 0x0328 }};
std::array<uint32_t, 1> const c4 = {{ 0x0105 }};
std::array<uint32_t, 2> const c5 = {{ 0x0061, 0x0328 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_098)
{
// 0106;0106;0043 0301;0106;0043 0301;
// (Ć; Ć; C◌́; Ć; C◌́; ) LATIN CAPITAL LETTER C WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x0106 }};
std::array<uint32_t, 1> const c2 = {{ 0x0106 }};
std::array<uint32_t, 2> const c3 = {{ 0x0043, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x0106 }};
std::array<uint32_t, 2> const c5 = {{ 0x0043, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_099)
{
// 0107;0107;0063 0301;0107;0063 0301;
// (ć; ć; c◌́; ć; c◌́; ) LATIN SMALL LETTER C WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x0107 }};
std::array<uint32_t, 1> const c2 = {{ 0x0107 }};
std::array<uint32_t, 2> const c3 = {{ 0x0063, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x0107 }};
std::array<uint32_t, 2> const c5 = {{ 0x0063, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_100)
{
// 0108;0108;0043 0302;0108;0043 0302;
// (Ĉ; Ĉ; C◌̂; Ĉ; C◌̂; ) LATIN CAPITAL LETTER C WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x0108 }};
std::array<uint32_t, 1> const c2 = {{ 0x0108 }};
std::array<uint32_t, 2> const c3 = {{ 0x0043, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x0108 }};
std::array<uint32_t, 2> const c5 = {{ 0x0043, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_101)
{
// 0109;0109;0063 0302;0109;0063 0302;
// (ĉ; ĉ; c◌̂; ĉ; c◌̂; ) LATIN SMALL LETTER C WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x0109 }};
std::array<uint32_t, 1> const c2 = {{ 0x0109 }};
std::array<uint32_t, 2> const c3 = {{ 0x0063, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x0109 }};
std::array<uint32_t, 2> const c5 = {{ 0x0063, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_102)
{
// 010A;010A;0043 0307;010A;0043 0307;
// (Ċ; Ċ; C◌̇; Ċ; C◌̇; ) LATIN CAPITAL LETTER C WITH DOT ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x010A }};
std::array<uint32_t, 1> const c2 = {{ 0x010A }};
std::array<uint32_t, 2> const c3 = {{ 0x0043, 0x0307 }};
std::array<uint32_t, 1> const c4 = {{ 0x010A }};
std::array<uint32_t, 2> const c5 = {{ 0x0043, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_103)
{
// 010B;010B;0063 0307;010B;0063 0307;
// (ċ; ċ; c◌̇; ċ; c◌̇; ) LATIN SMALL LETTER C WITH DOT ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x010B }};
std::array<uint32_t, 1> const c2 = {{ 0x010B }};
std::array<uint32_t, 2> const c3 = {{ 0x0063, 0x0307 }};
std::array<uint32_t, 1> const c4 = {{ 0x010B }};
std::array<uint32_t, 2> const c5 = {{ 0x0063, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_104)
{
// 010C;010C;0043 030C;010C;0043 030C;
// (Č; Č; C◌̌; Č; C◌̌; ) LATIN CAPITAL LETTER C WITH CARON
{
std::array<uint32_t, 1> const c1 = {{ 0x010C }};
std::array<uint32_t, 1> const c2 = {{ 0x010C }};
std::array<uint32_t, 2> const c3 = {{ 0x0043, 0x030C }};
std::array<uint32_t, 1> const c4 = {{ 0x010C }};
std::array<uint32_t, 2> const c5 = {{ 0x0043, 0x030C }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_105)
{
// 010D;010D;0063 030C;010D;0063 030C;
// (č; č; c◌̌; č; c◌̌; ) LATIN SMALL LETTER C WITH CARON
{
std::array<uint32_t, 1> const c1 = {{ 0x010D }};
std::array<uint32_t, 1> const c2 = {{ 0x010D }};
std::array<uint32_t, 2> const c3 = {{ 0x0063, 0x030C }};
std::array<uint32_t, 1> const c4 = {{ 0x010D }};
std::array<uint32_t, 2> const c5 = {{ 0x0063, 0x030C }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_106)
{
// 010E;010E;0044 030C;010E;0044 030C;
// (Ď; Ď; D◌̌; Ď; D◌̌; ) LATIN CAPITAL LETTER D WITH CARON
{
std::array<uint32_t, 1> const c1 = {{ 0x010E }};
std::array<uint32_t, 1> const c2 = {{ 0x010E }};
std::array<uint32_t, 2> const c3 = {{ 0x0044, 0x030C }};
std::array<uint32_t, 1> const c4 = {{ 0x010E }};
std::array<uint32_t, 2> const c5 = {{ 0x0044, 0x030C }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_107)
{
// 010F;010F;0064 030C;010F;0064 030C;
// (ď; ď; d◌̌; ď; d◌̌; ) LATIN SMALL LETTER D WITH CARON
{
std::array<uint32_t, 1> const c1 = {{ 0x010F }};
std::array<uint32_t, 1> const c2 = {{ 0x010F }};
std::array<uint32_t, 2> const c3 = {{ 0x0064, 0x030C }};
std::array<uint32_t, 1> const c4 = {{ 0x010F }};
std::array<uint32_t, 2> const c5 = {{ 0x0064, 0x030C }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_108)
{
// 0112;0112;0045 0304;0112;0045 0304;
// (Ē; Ē; E◌̄; Ē; E◌̄; ) LATIN CAPITAL LETTER E WITH MACRON
{
std::array<uint32_t, 1> const c1 = {{ 0x0112 }};
std::array<uint32_t, 1> const c2 = {{ 0x0112 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0304 }};
std::array<uint32_t, 1> const c4 = {{ 0x0112 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_109)
{
// 0113;0113;0065 0304;0113;0065 0304;
// (ē; ē; e◌̄; ē; e◌̄; ) LATIN SMALL LETTER E WITH MACRON
{
std::array<uint32_t, 1> const c1 = {{ 0x0113 }};
std::array<uint32_t, 1> const c2 = {{ 0x0113 }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x0304 }};
std::array<uint32_t, 1> const c4 = {{ 0x0113 }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_110)
{
// 0114;0114;0045 0306;0114;0045 0306;
// (Ĕ; Ĕ; E◌̆; Ĕ; E◌̆; ) LATIN CAPITAL LETTER E WITH BREVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0114 }};
std::array<uint32_t, 1> const c2 = {{ 0x0114 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0306 }};
std::array<uint32_t, 1> const c4 = {{ 0x0114 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0306 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_111)
{
// 0115;0115;0065 0306;0115;0065 0306;
// (ĕ; ĕ; e◌̆; ĕ; e◌̆; ) LATIN SMALL LETTER E WITH BREVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0115 }};
std::array<uint32_t, 1> const c2 = {{ 0x0115 }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x0306 }};
std::array<uint32_t, 1> const c4 = {{ 0x0115 }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x0306 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_112)
{
// 0116;0116;0045 0307;0116;0045 0307;
// (Ė; Ė; E◌̇; Ė; E◌̇; ) LATIN CAPITAL LETTER E WITH DOT ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0116 }};
std::array<uint32_t, 1> const c2 = {{ 0x0116 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0307 }};
std::array<uint32_t, 1> const c4 = {{ 0x0116 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_113)
{
// 0117;0117;0065 0307;0117;0065 0307;
// (ė; ė; e◌̇; ė; e◌̇; ) LATIN SMALL LETTER E WITH DOT ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0117 }};
std::array<uint32_t, 1> const c2 = {{ 0x0117 }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x0307 }};
std::array<uint32_t, 1> const c4 = {{ 0x0117 }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_114)
{
// 0118;0118;0045 0328;0118;0045 0328;
// (Ę; Ę; E◌̨; Ę; E◌̨; ) LATIN CAPITAL LETTER E WITH OGONEK
{
std::array<uint32_t, 1> const c1 = {{ 0x0118 }};
std::array<uint32_t, 1> const c2 = {{ 0x0118 }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x0328 }};
std::array<uint32_t, 1> const c4 = {{ 0x0118 }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x0328 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_115)
{
// 0119;0119;0065 0328;0119;0065 0328;
// (ę; ę; e◌̨; ę; e◌̨; ) LATIN SMALL LETTER E WITH OGONEK
{
std::array<uint32_t, 1> const c1 = {{ 0x0119 }};
std::array<uint32_t, 1> const c2 = {{ 0x0119 }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x0328 }};
std::array<uint32_t, 1> const c4 = {{ 0x0119 }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x0328 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_116)
{
// 011A;011A;0045 030C;011A;0045 030C;
// (Ě; Ě; E◌̌; Ě; E◌̌; ) LATIN CAPITAL LETTER E WITH CARON
{
std::array<uint32_t, 1> const c1 = {{ 0x011A }};
std::array<uint32_t, 1> const c2 = {{ 0x011A }};
std::array<uint32_t, 2> const c3 = {{ 0x0045, 0x030C }};
std::array<uint32_t, 1> const c4 = {{ 0x011A }};
std::array<uint32_t, 2> const c5 = {{ 0x0045, 0x030C }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_117)
{
// 011B;011B;0065 030C;011B;0065 030C;
// (ě; ě; e◌̌; ě; e◌̌; ) LATIN SMALL LETTER E WITH CARON
{
std::array<uint32_t, 1> const c1 = {{ 0x011B }};
std::array<uint32_t, 1> const c2 = {{ 0x011B }};
std::array<uint32_t, 2> const c3 = {{ 0x0065, 0x030C }};
std::array<uint32_t, 1> const c4 = {{ 0x011B }};
std::array<uint32_t, 2> const c5 = {{ 0x0065, 0x030C }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_118)
{
// 011C;011C;0047 0302;011C;0047 0302;
// (Ĝ; Ĝ; G◌̂; Ĝ; G◌̂; ) LATIN CAPITAL LETTER G WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x011C }};
std::array<uint32_t, 1> const c2 = {{ 0x011C }};
std::array<uint32_t, 2> const c3 = {{ 0x0047, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x011C }};
std::array<uint32_t, 2> const c5 = {{ 0x0047, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_119)
{
// 011D;011D;0067 0302;011D;0067 0302;
// (ĝ; ĝ; g◌̂; ĝ; g◌̂; ) LATIN SMALL LETTER G WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x011D }};
std::array<uint32_t, 1> const c2 = {{ 0x011D }};
std::array<uint32_t, 2> const c3 = {{ 0x0067, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x011D }};
std::array<uint32_t, 2> const c5 = {{ 0x0067, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_120)
{
// 011E;011E;0047 0306;011E;0047 0306;
// (Ğ; Ğ; G◌̆; Ğ; G◌̆; ) LATIN CAPITAL LETTER G WITH BREVE
{
std::array<uint32_t, 1> const c1 = {{ 0x011E }};
std::array<uint32_t, 1> const c2 = {{ 0x011E }};
std::array<uint32_t, 2> const c3 = {{ 0x0047, 0x0306 }};
std::array<uint32_t, 1> const c4 = {{ 0x011E }};
std::array<uint32_t, 2> const c5 = {{ 0x0047, 0x0306 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_121)
{
// 011F;011F;0067 0306;011F;0067 0306;
// (ğ; ğ; g◌̆; ğ; g◌̆; ) LATIN SMALL LETTER G WITH BREVE
{
std::array<uint32_t, 1> const c1 = {{ 0x011F }};
std::array<uint32_t, 1> const c2 = {{ 0x011F }};
std::array<uint32_t, 2> const c3 = {{ 0x0067, 0x0306 }};
std::array<uint32_t, 1> const c4 = {{ 0x011F }};
std::array<uint32_t, 2> const c5 = {{ 0x0067, 0x0306 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_122)
{
// 0120;0120;0047 0307;0120;0047 0307;
// (Ġ; Ġ; G◌̇; Ġ; G◌̇; ) LATIN CAPITAL LETTER G WITH DOT ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0120 }};
std::array<uint32_t, 1> const c2 = {{ 0x0120 }};
std::array<uint32_t, 2> const c3 = {{ 0x0047, 0x0307 }};
std::array<uint32_t, 1> const c4 = {{ 0x0120 }};
std::array<uint32_t, 2> const c5 = {{ 0x0047, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_123)
{
// 0121;0121;0067 0307;0121;0067 0307;
// (ġ; ġ; g◌̇; ġ; g◌̇; ) LATIN SMALL LETTER G WITH DOT ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0121 }};
std::array<uint32_t, 1> const c2 = {{ 0x0121 }};
std::array<uint32_t, 2> const c3 = {{ 0x0067, 0x0307 }};
std::array<uint32_t, 1> const c4 = {{ 0x0121 }};
std::array<uint32_t, 2> const c5 = {{ 0x0067, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_124)
{
// 0122;0122;0047 0327;0122;0047 0327;
// (Ģ; Ģ; G◌̧; Ģ; G◌̧; ) LATIN CAPITAL LETTER G WITH CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x0122 }};
std::array<uint32_t, 1> const c2 = {{ 0x0122 }};
std::array<uint32_t, 2> const c3 = {{ 0x0047, 0x0327 }};
std::array<uint32_t, 1> const c4 = {{ 0x0122 }};
std::array<uint32_t, 2> const c5 = {{ 0x0047, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_125)
{
// 0123;0123;0067 0327;0123;0067 0327;
// (ģ; ģ; g◌̧; ģ; g◌̧; ) LATIN SMALL LETTER G WITH CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x0123 }};
std::array<uint32_t, 1> const c2 = {{ 0x0123 }};
std::array<uint32_t, 2> const c3 = {{ 0x0067, 0x0327 }};
std::array<uint32_t, 1> const c4 = {{ 0x0123 }};
std::array<uint32_t, 2> const c5 = {{ 0x0067, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_126)
{
// 0124;0124;0048 0302;0124;0048 0302;
// (Ĥ; Ĥ; H◌̂; Ĥ; H◌̂; ) LATIN CAPITAL LETTER H WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x0124 }};
std::array<uint32_t, 1> const c2 = {{ 0x0124 }};
std::array<uint32_t, 2> const c3 = {{ 0x0048, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x0124 }};
std::array<uint32_t, 2> const c5 = {{ 0x0048, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_127)
{
// 0125;0125;0068 0302;0125;0068 0302;
// (ĥ; ĥ; h◌̂; ĥ; h◌̂; ) LATIN SMALL LETTER H WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x0125 }};
std::array<uint32_t, 1> const c2 = {{ 0x0125 }};
std::array<uint32_t, 2> const c3 = {{ 0x0068, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x0125 }};
std::array<uint32_t, 2> const c5 = {{ 0x0068, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_128)
{
// 0128;0128;0049 0303;0128;0049 0303;
// (Ĩ; Ĩ; I◌̃; Ĩ; I◌̃; ) LATIN CAPITAL LETTER I WITH TILDE
{
std::array<uint32_t, 1> const c1 = {{ 0x0128 }};
std::array<uint32_t, 1> const c2 = {{ 0x0128 }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0303 }};
std::array<uint32_t, 1> const c4 = {{ 0x0128 }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0303 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_129)
{
// 0129;0129;0069 0303;0129;0069 0303;
// (ĩ; ĩ; i◌̃; ĩ; i◌̃; ) LATIN SMALL LETTER I WITH TILDE
{
std::array<uint32_t, 1> const c1 = {{ 0x0129 }};
std::array<uint32_t, 1> const c2 = {{ 0x0129 }};
std::array<uint32_t, 2> const c3 = {{ 0x0069, 0x0303 }};
std::array<uint32_t, 1> const c4 = {{ 0x0129 }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x0303 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_130)
{
// 012A;012A;0049 0304;012A;0049 0304;
// (Ī; Ī; I◌̄; Ī; I◌̄; ) LATIN CAPITAL LETTER I WITH MACRON
{
std::array<uint32_t, 1> const c1 = {{ 0x012A }};
std::array<uint32_t, 1> const c2 = {{ 0x012A }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0304 }};
std::array<uint32_t, 1> const c4 = {{ 0x012A }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_131)
{
// 012B;012B;0069 0304;012B;0069 0304;
// (ī; ī; i◌̄; ī; i◌̄; ) LATIN SMALL LETTER I WITH MACRON
{
std::array<uint32_t, 1> const c1 = {{ 0x012B }};
std::array<uint32_t, 1> const c2 = {{ 0x012B }};
std::array<uint32_t, 2> const c3 = {{ 0x0069, 0x0304 }};
std::array<uint32_t, 1> const c4 = {{ 0x012B }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x0304 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_132)
{
// 012C;012C;0049 0306;012C;0049 0306;
// (Ĭ; Ĭ; I◌̆; Ĭ; I◌̆; ) LATIN CAPITAL LETTER I WITH BREVE
{
std::array<uint32_t, 1> const c1 = {{ 0x012C }};
std::array<uint32_t, 1> const c2 = {{ 0x012C }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0306 }};
std::array<uint32_t, 1> const c4 = {{ 0x012C }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0306 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_133)
{
// 012D;012D;0069 0306;012D;0069 0306;
// (ĭ; ĭ; i◌̆; ĭ; i◌̆; ) LATIN SMALL LETTER I WITH BREVE
{
std::array<uint32_t, 1> const c1 = {{ 0x012D }};
std::array<uint32_t, 1> const c2 = {{ 0x012D }};
std::array<uint32_t, 2> const c3 = {{ 0x0069, 0x0306 }};
std::array<uint32_t, 1> const c4 = {{ 0x012D }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x0306 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_134)
{
// 012E;012E;0049 0328;012E;0049 0328;
// (Į; Į; I◌̨; Į; I◌̨; ) LATIN CAPITAL LETTER I WITH OGONEK
{
std::array<uint32_t, 1> const c1 = {{ 0x012E }};
std::array<uint32_t, 1> const c2 = {{ 0x012E }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0328 }};
std::array<uint32_t, 1> const c4 = {{ 0x012E }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0328 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_135)
{
// 012F;012F;0069 0328;012F;0069 0328;
// (į; į; i◌̨; į; i◌̨; ) LATIN SMALL LETTER I WITH OGONEK
{
std::array<uint32_t, 1> const c1 = {{ 0x012F }};
std::array<uint32_t, 1> const c2 = {{ 0x012F }};
std::array<uint32_t, 2> const c3 = {{ 0x0069, 0x0328 }};
std::array<uint32_t, 1> const c4 = {{ 0x012F }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x0328 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_136)
{
// 0130;0130;0049 0307;0130;0049 0307;
// (İ; İ; I◌̇; İ; I◌̇; ) LATIN CAPITAL LETTER I WITH DOT ABOVE
{
std::array<uint32_t, 1> const c1 = {{ 0x0130 }};
std::array<uint32_t, 1> const c2 = {{ 0x0130 }};
std::array<uint32_t, 2> const c3 = {{ 0x0049, 0x0307 }};
std::array<uint32_t, 1> const c4 = {{ 0x0130 }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x0307 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_137)
{
// 0132;0132;0132;0049 004A;0049 004A;
// (IJ; IJ; IJ; IJ; IJ; ) LATIN CAPITAL LIGATURE IJ
{
std::array<uint32_t, 1> const c1 = {{ 0x0132 }};
std::array<uint32_t, 1> const c2 = {{ 0x0132 }};
std::array<uint32_t, 1> const c3 = {{ 0x0132 }};
std::array<uint32_t, 2> const c4 = {{ 0x0049, 0x004A }};
std::array<uint32_t, 2> const c5 = {{ 0x0049, 0x004A }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_138)
{
// 0133;0133;0133;0069 006A;0069 006A;
// (ij; ij; ij; ij; ij; ) LATIN SMALL LIGATURE IJ
{
std::array<uint32_t, 1> const c1 = {{ 0x0133 }};
std::array<uint32_t, 1> const c2 = {{ 0x0133 }};
std::array<uint32_t, 1> const c3 = {{ 0x0133 }};
std::array<uint32_t, 2> const c4 = {{ 0x0069, 0x006A }};
std::array<uint32_t, 2> const c5 = {{ 0x0069, 0x006A }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_139)
{
// 0134;0134;004A 0302;0134;004A 0302;
// (Ĵ; Ĵ; J◌̂; Ĵ; J◌̂; ) LATIN CAPITAL LETTER J WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x0134 }};
std::array<uint32_t, 1> const c2 = {{ 0x0134 }};
std::array<uint32_t, 2> const c3 = {{ 0x004A, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x0134 }};
std::array<uint32_t, 2> const c5 = {{ 0x004A, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_140)
{
// 0135;0135;006A 0302;0135;006A 0302;
// (ĵ; ĵ; j◌̂; ĵ; j◌̂; ) LATIN SMALL LETTER J WITH CIRCUMFLEX
{
std::array<uint32_t, 1> const c1 = {{ 0x0135 }};
std::array<uint32_t, 1> const c2 = {{ 0x0135 }};
std::array<uint32_t, 2> const c3 = {{ 0x006A, 0x0302 }};
std::array<uint32_t, 1> const c4 = {{ 0x0135 }};
std::array<uint32_t, 2> const c5 = {{ 0x006A, 0x0302 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_141)
{
// 0136;0136;004B 0327;0136;004B 0327;
// (Ķ; Ķ; K◌̧; Ķ; K◌̧; ) LATIN CAPITAL LETTER K WITH CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x0136 }};
std::array<uint32_t, 1> const c2 = {{ 0x0136 }};
std::array<uint32_t, 2> const c3 = {{ 0x004B, 0x0327 }};
std::array<uint32_t, 1> const c4 = {{ 0x0136 }};
std::array<uint32_t, 2> const c5 = {{ 0x004B, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_142)
{
// 0137;0137;006B 0327;0137;006B 0327;
// (ķ; ķ; k◌̧; ķ; k◌̧; ) LATIN SMALL LETTER K WITH CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x0137 }};
std::array<uint32_t, 1> const c2 = {{ 0x0137 }};
std::array<uint32_t, 2> const c3 = {{ 0x006B, 0x0327 }};
std::array<uint32_t, 1> const c4 = {{ 0x0137 }};
std::array<uint32_t, 2> const c5 = {{ 0x006B, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_143)
{
// 0139;0139;004C 0301;0139;004C 0301;
// (Ĺ; Ĺ; L◌́; Ĺ; L◌́; ) LATIN CAPITAL LETTER L WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x0139 }};
std::array<uint32_t, 1> const c2 = {{ 0x0139 }};
std::array<uint32_t, 2> const c3 = {{ 0x004C, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x0139 }};
std::array<uint32_t, 2> const c5 = {{ 0x004C, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_144)
{
// 013A;013A;006C 0301;013A;006C 0301;
// (ĺ; ĺ; l◌́; ĺ; l◌́; ) LATIN SMALL LETTER L WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x013A }};
std::array<uint32_t, 1> const c2 = {{ 0x013A }};
std::array<uint32_t, 2> const c3 = {{ 0x006C, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x013A }};
std::array<uint32_t, 2> const c5 = {{ 0x006C, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_145)
{
// 013B;013B;004C 0327;013B;004C 0327;
// (Ļ; Ļ; L◌̧; Ļ; L◌̧; ) LATIN CAPITAL LETTER L WITH CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x013B }};
std::array<uint32_t, 1> const c2 = {{ 0x013B }};
std::array<uint32_t, 2> const c3 = {{ 0x004C, 0x0327 }};
std::array<uint32_t, 1> const c4 = {{ 0x013B }};
std::array<uint32_t, 2> const c5 = {{ 0x004C, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_146)
{
// 013C;013C;006C 0327;013C;006C 0327;
// (ļ; ļ; l◌̧; ļ; l◌̧; ) LATIN SMALL LETTER L WITH CEDILLA
{
std::array<uint32_t, 1> const c1 = {{ 0x013C }};
std::array<uint32_t, 1> const c2 = {{ 0x013C }};
std::array<uint32_t, 2> const c3 = {{ 0x006C, 0x0327 }};
std::array<uint32_t, 1> const c4 = {{ 0x013C }};
std::array<uint32_t, 2> const c5 = {{ 0x006C, 0x0327 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_147)
{
// 013D;013D;004C 030C;013D;004C 030C;
// (Ľ; Ľ; L◌̌; Ľ; L◌̌; ) LATIN CAPITAL LETTER L WITH CARON
{
std::array<uint32_t, 1> const c1 = {{ 0x013D }};
std::array<uint32_t, 1> const c2 = {{ 0x013D }};
std::array<uint32_t, 2> const c3 = {{ 0x004C, 0x030C }};
std::array<uint32_t, 1> const c4 = {{ 0x013D }};
std::array<uint32_t, 2> const c5 = {{ 0x004C, 0x030C }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_148)
{
// 013E;013E;006C 030C;013E;006C 030C;
// (ľ; ľ; l◌̌; ľ; l◌̌; ) LATIN SMALL LETTER L WITH CARON
{
std::array<uint32_t, 1> const c1 = {{ 0x013E }};
std::array<uint32_t, 1> const c2 = {{ 0x013E }};
std::array<uint32_t, 2> const c3 = {{ 0x006C, 0x030C }};
std::array<uint32_t, 1> const c4 = {{ 0x013E }};
std::array<uint32_t, 2> const c5 = {{ 0x006C, 0x030C }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_149)
{
// 013F;013F;013F;004C 00B7;004C 00B7;
// (Ŀ; Ŀ; Ŀ; L·; L·; ) LATIN CAPITAL LETTER L WITH MIDDLE DOT
{
std::array<uint32_t, 1> const c1 = {{ 0x013F }};
std::array<uint32_t, 1> const c2 = {{ 0x013F }};
std::array<uint32_t, 1> const c3 = {{ 0x013F }};
std::array<uint32_t, 2> const c4 = {{ 0x004C, 0x00B7 }};
std::array<uint32_t, 2> const c5 = {{ 0x004C, 0x00B7 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_150)
{
// 0140;0140;0140;006C 00B7;006C 00B7;
// (ŀ; ŀ; ŀ; l·; l·; ) LATIN SMALL LETTER L WITH MIDDLE DOT
{
std::array<uint32_t, 1> const c1 = {{ 0x0140 }};
std::array<uint32_t, 1> const c2 = {{ 0x0140 }};
std::array<uint32_t, 1> const c3 = {{ 0x0140 }};
std::array<uint32_t, 2> const c4 = {{ 0x006C, 0x00B7 }};
std::array<uint32_t, 2> const c5 = {{ 0x006C, 0x00B7 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_151)
{
// 0143;0143;004E 0301;0143;004E 0301;
// (Ń; Ń; N◌́; Ń; N◌́; ) LATIN CAPITAL LETTER N WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x0143 }};
std::array<uint32_t, 1> const c2 = {{ 0x0143 }};
std::array<uint32_t, 2> const c3 = {{ 0x004E, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x0143 }};
std::array<uint32_t, 2> const c5 = {{ 0x004E, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
TEST(normalization, nfkc_000_152)
{
// 0144;0144;006E 0301;0144;006E 0301;
// (ń; ń; n◌́; ń; n◌́; ) LATIN SMALL LETTER N WITH ACUTE
{
std::array<uint32_t, 1> const c1 = {{ 0x0144 }};
std::array<uint32_t, 1> const c2 = {{ 0x0144 }};
std::array<uint32_t, 2> const c3 = {{ 0x006E, 0x0301 }};
std::array<uint32_t, 1> const c4 = {{ 0x0144 }};
std::array<uint32_t, 2> const c5 = {{ 0x006E, 0x0301 }};
EXPECT_TRUE(boost::text::normalized_nfc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c2.begin(), c2.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c3.begin(), c3.end()));
EXPECT_TRUE(boost::text::normalized_nfc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfkc(c4.begin(), c4.end()));
EXPECT_TRUE(boost::text::normalized_nfd(c5.begin(), c5.end()));
EXPECT_TRUE(boost::text::normalized_nfkd(c5.begin(), c5.end()));
{
boost::text::string str = boost::text::to_string(c1.begin(), c1.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c2.begin(), c2.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c3.begin(), c3.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c4.begin(), c4.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
{
boost::text::string str = boost::text::to_string(c5.begin(), c5.end());
boost::text::normalize_to_nfkc(str);
boost::text::utf32_range utf32_range(str);
EXPECT_EQ(std::distance(utf32_range.begin(), utf32_range.end()), c4.size());
auto c4_it = c4.begin();
int i = 0;
for (auto x : utf32_range) {
EXPECT_EQ(x, *c4_it) << "iteration " << i;
++c4_it;
++i;
}
}
}
}
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.