doc_id
stringlengths
36
36
metadata
dict
input
stringlengths
28
4.3k
output
stringlengths
11
5.45k
8679e0ee-fd00-4b5d-853b-d33e3d20562e
{ "language": "C++" }
```c++ // Return multiple values #include <tuple> #include <string> std::tuple<int, bool, std::string> foo() { return {128, true, "hello"}; } int main() { int obj1; bool obj2; std::string obj3; std::tie(obj1, obj2, obj3) = foo(); } // Return multiple values of different types from a function. // // The `foo`...
```c++ // Return multiple values #include <tuple> std::tuple<int, bool, float> foo() { return {128, true, 1.5f}; } int main() { int obj1; bool obj2; float obj3; std::tie(obj1, obj2, obj3) = foo(); } // Return multiple values of different types from a function. // // The `foo` function on [5-8] returns a // [...
fa376946-d662-474c-8e24-a5516a5f8aaa
{ "language": "C++" }
```c++ //===- llvm/unittest/DebugInfo/DWARFFormValueTest.cpp ---------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- llvm/unittest/DebugInfo/DWARFFormValueTest.cpp ---------------------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
9f3005fa-b17e-4d92-9c8c-078ba6b41ebf
{ "language": "C++" }
```c++ // Copyright (c) 2011 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 "chrome/common/default_plugin.h" #include "chrome/default_plugin/plugin_main.h" #include "webkit/plugins/npapi/plugin_list.h" namesp...
```c++ // Copyright (c) 2011 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 "chrome/common/default_plugin.h" #include "chrome/default_plugin/plugin_main.h" #include "webkit/plugins/npapi/plugin_list.h" namesp...
e668e644-9fb1-4f0d-845d-a3a3eac9d1ce
{ "language": "C++" }
```c++ // Copyright 2017-2020 The Verible 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 applicabl...
```c++ // Copyright 2017-2020 The Verible 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 applicabl...
77df9b87-9c82-4635-b3dc-076c550d8a8f
{ "language": "C++" }
```c++ // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "views/focus/focus_manager.h" #include "base/logging.h" namespace views { void FocusManager::ClearNativeFocus() { NOTIMPLEME...
```c++ // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "views/focus/focus_manager.h" #include "base/logging.h" namespace views { void FocusManager::ClearNativeFocus() { NOTIMPLEME...
38ad6aa7-7744-4089-8ceb-5c24ca3916fe
{ "language": "C++" }
```c++ // Copyright 2020 The XLS 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 a...
```c++ // Copyright 2020 The XLS 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 a...
345a5d9e-b85a-4586-afef-cfcf2b2e88f4
{ "language": "C++" }
```c++ ######################################################### # Local Compiler Rules # ######################################################### #--objectrule--# $(CXX) $(CFLAGS) $(CDEFS) $(CINCS) -o $@ -c #--objectsuffix--# $B #--targetsuffix--# $B #--tarulesuffix--# $B #--buildtargets--# targets .SUFFIXES : ...
```c++ ######################################################### # Local Compiler Rules # ######################################################### #--objectrule--# $(CXX) $(CFLAGS) $(CDEFS) $(CINCS) -o $@ -c #--objectsuffix--# $B #--targetsuffix--# $B #--tarulesuffix--# $B #--buildtargets--# targets .SUFFIXES : ...
6656c81b-a77f-450b-a351-f60714420f86
{ "language": "C++" }
```c++ #include "AppViewController.h" namespace mural { AppViewController::~AppViewController() { delete this->view; } void AppViewController::initWithScriptAtPath(const char *path, int width, int height, const char *title) { this->view = new JavaScriptView(width, height, title); this->view->loadScriptAt...
```c++ #include "AppViewController.h" // #include <thread> namespace mural { AppViewController::~AppViewController() { delete this->view; } void AppViewController::initWithScriptAtPath(const char *path, int width, int height, const char *title) { this->view = new JavaScriptView(width, height, title); th...
e5edb928-beee-4910-9896-5bf29557c488
{ "language": "C++" }
```c++ // REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -S %s -o %t-64.s // RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -S %s -o %t-32.s // RUN: FileCheck -check-prefix CHECK-...
```c++ // RUN: %clang_cc1 -triple x86_64-apple-darwin -std=c++11 -emit-llvm %s -o - | \ // RUN: FileCheck %s // RUN: %clang_cc1 -triple i386-apple-darwin -std=c++11 -emit-llvm %s -o - | \ // RUN: FileCheck %s struct A { A(int); }; struct B { B(A); }; int main () { (B)10; B(10); static_cast<B>(10); } // ...
761f41c2-6591-4ce5-b310-47ed2244d09a
{ "language": "C++" }
```c++ /* * Copyright (C) 2016 Google, Inc. * * 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 ...
```c++ /* * Copyright (C) 2016 Google, Inc. * * 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 ...
ddc64f18-e749-4b97-8778-83c5fab616f1
{ "language": "C++" }
```c++ // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon // We are making my contributions/submissions to this project solely in our // personal capacity and are not conveying any rights to any intellectual // property of any third parties. #include <Rosetta/Commons/Constants.hpp> #include <Rosetta/Mode...
```c++ // Copyright (c) 2019 Chris Ohk, Youngjoong Kim, SeungHyun Jeon // We are making my contributions/submissions to this project solely in our // personal capacity and are not conveying any rights to any intellectual // property of any third parties. #include <Rosetta/Commons/Constants.hpp> #include <Rosetta/Mode...
95ab8913-4baf-4aea-8b4f-b11460426341
{ "language": "C++" }
```c++ #include <stdio.h> #include <string.h> #include <stdbool.h> #define MAX_INPUT_SIZE 100 bool is_palindrome(const char *string, const int begin = 0, int end = -1) { /* initialise parameter */ if(end == -1) end = strlen(string) - 1; /* base case */ if(string[begin] != string[end]) return false; ...
```c++ #include <stdio.h> #include <string.h> #include <stdbool.h> #define MAX_INPUT_SIZE 100 bool is_palindrome(const char *word) { int length = strlen(word); char string[length]; /* Should not modify the value of ptr arg. */ strcpy(string, word); /* base case */ if(length <= 1) return true; ...
eb5eac95-5b6d-4cee-90c5-d506e8af31f1
{ "language": "C++" }
```c++ // RUN: CINDEXTEST_EDITING=1 c-index-test -test-load-source local %s -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=DIAGS %s // Make sure -Wuninitialized works even though the header had a warn-as-error occurrence. // DIAGS: error: unused variable 'x' // DIAGS: warning: variable 'x1' is uninitia...
```c++ // RUN: env CINDEXTEST_EDITING=1 c-index-test -test-load-source local %s -Wuninitialized -Werror=unused 2>&1 | FileCheck -check-prefix=DIAGS %s // Make sure -Wuninitialized works even though the header had a warn-as-error occurrence. // DIAGS: error: unused variable 'x' // DIAGS: warning: variable 'x1' is unin...
96ec4cd0-5340-434d-a1f0-9951a5c907a4
{ "language": "C++" }
```c++ #include "host-interface.hpp" namespace phosphor { namespace host { void Host::execute(Command command) { // Future commits to build on return; } } // namespace host } // namepsace phosphor ``` Support for putting entries onto queue
```c++ #include <queue> #include <phosphor-logging/log.hpp> #include "host-interface.hpp" namespace phosphor { namespace host { using namespace phosphor::logging; // When you see base:: you know we're referencing our base class namespace base = sdbusplus::xyz::openbmc_project::Control::server; std::queue<base::Host...
7be7cec0-f210-4e79-8b39-1ab4fd7870d2
{ "language": "C++" }
```c++ // RUN: %clang_cc1 -fsyntax-only -Wno-dangling -Wreturn-stack-address -verify %s struct [[gsl::Owner(int)]] MyIntOwner { MyIntOwner(); int &operator*(); }; struct [[gsl::Pointer(int)]] MyIntPointer { MyIntPointer(int *p = nullptr); MyIntPointer(const MyIntOwner &); int &operator*(); MyIntOwner toOw...
```c++ // RUN: %clang_cc1 -fsyntax-only -Wno-dangling-gsl -Wreturn-stack-address -verify %s struct [[gsl::Owner(int)]] MyIntOwner { MyIntOwner(); int &operator*(); }; struct [[gsl::Pointer(int)]] MyIntPointer { MyIntPointer(int *p = nullptr); MyIntPointer(const MyIntOwner &); int &operator*(); MyIntOwner ...
1da0f30e-f1db-405c-aa81-f24a6feffe33
{ "language": "C++" }
```c++ /** ** \file libport/perror.cc ** \brief perror: implements file libport/perror.hh */ #include <stdio.h> #include "libport/cstring" namespace libport { void perror (const char* s) { #ifndef WIN32 ::perror(s); #else int errnum; const char* errstring; const char* colon; errnum = W...
```c++ /** ** \file libport/perror.cc ** \brief perror: implements file libport/perror.hh */ #include <cstdio> #include <iostream> #include "libport/cstring" namespace libport { void perror (const char* s) { #ifndef WIN32 ::perror(s); #else int errnum; const char* errstring; const char* col...
22c0f528-2d4b-47d6-8fb9-cf3df832b242
{ "language": "C++" }
```c++ #include "Timer.h" #define BOOST_TEST_MODULE TimerTest #include <boost/test/unit_test.hpp> #include <string> #include <iostream> BOOST_AUTO_TEST_CASE(timer_basic_test) { Timer timer; timer.start(); BOOST_REQUIRE(timer.is_running()); BOOST_REQUIRE(timer.get_elapsed_cpu_time() > 0.0); BOOST_REQUIRE(ti...
```c++ #include "Timer.h" #define BOOST_TEST_MODULE TimerTest #include <boost/test/unit_test.hpp> #include <string> #include <iostream> #include <unistd.h> BOOST_AUTO_TEST_CASE(timer_basic_test) { Timer timer; const int sleep_time_microsec = 40; // ad-hoc microseconds to pass unit tests. timer.start(); BOOS...
3229b63f-d117-4ab8-9f56-331420215421
{ "language": "C++" }
```c++ #include <iostream> #include "../src/tisys.hpp" int main(int argc, char** argv){ cout << "Example" <<endl; Filesystem fs; if ( argc == 1 ) fs.listdir("."); else fs.listdir( argv[1] ); cout << fs; return 0; } ``` Put the using namespace std in the cpp files
```c++ #include <iostream> #include "../src/tisys.hpp" using namespace std; int main(int argc, char** argv){ cout << "Example" <<endl; Filesystem fs; if ( argc == 1 ) fs.listdir("."); else fs.listdir( argv[1] ); cout << fs; return 0; } ```
99324cb6-10d6-43c0-bebd-aeb54a7342ce
{ "language": "C++" }
```c++ /// \file Connector_RAW/main.cpp /// Contains the main code for the RAW connector. #include <iostream> #include "../util/socket.h" /// Contains the main code for the RAW connector. /// Expects a single commandline argument telling it which stream to connect to, /// then outputs the raw stream to stdout. int ma...
```c++ /// \file Connector_RAW/main.cpp /// Contains the main code for the RAW connector. #include <iostream> #include "../util/socket.h" /// Contains the main code for the RAW connector. /// Expects a single commandline argument telling it which stream to connect to, /// then outputs the raw stream to stdout. int ma...
3742cec5-3430-4d83-a644-d4b6d24ac09d
{ "language": "C++" }
```c++ // Includes. #include "UI/mainwindow.h" #include "App/App.h" #include "App/Factories/AdditionNFDelegate.h" #include "App/Factories/ConstantNFDelegate.h" #include "App/Factories/PrinterNFDelegate.h" #include "App/Factories/TextFileNFDelegate.h" // Qt. #include <QApplication> QString titleString() { QStrin...
```c++ // Includes. #include "UI/mainwindow.h" #include "App/App.h" #include "App/Factories/AdditionNFDelegate.h" #include "App/Factories/ConstantNFDelegate.h" #include "App/Factories/PrinterNFDelegate.h" #include "App/Factories/TextFileNFDelegate.h" #include "System/QtBasedFileSystem.h" // Qt. #include <QApplicati...
1a91c849-8fc8-415e-8d72-5c34c53f4afa
{ "language": "C++" }
```c++ #include <QApplication> #include <QTranslator> #include <qtsingleapplication.h> #include <Manager.h> #include <Settings.h> int main (int argc, char *argv[]) { QtSingleApplication a (argc, argv); if (a.sendMessage (QString ())) { return 0; } a.setQuitOnLastWindowClosed (false); a.setApplicationNa...
```c++ #ifdef Q_OS_LINUX # include <locale.h> #endif #include <QApplication> #include <QTranslator> #include <qtsingleapplication.h> #include <Manager.h> #include <Settings.h> int main (int argc, char *argv[]) { QtSingleApplication a (argc, argv); if (a.sendMessage (QString ())) { return 0; } #ifdef Q_OS...
92da5a60-5136-44e7-ba24-f1c8161d9e9f
{ "language": "C++" }
```c++ // Includes. #include "UI/mainwindow.h" #include "App/App.h" #include "App/Factories/PrinterNFDelegate.h" #include "App/Factories/TextFileNFDelegate.h" #include "System/QtBasedFileSystem.h" // Qt. #include <QApplication> QString titleString() { QString name = QString::fromStdString(App::appName()); ...
```c++ // Includes. #include "UI/mainwindow.h" #include "App/App.h" #include "App/Factories/TextFileNFDelegate.h" #include "System/QtBasedFileSystem.h" // Qt. #include <QApplication> QString titleString() { QString name = QString::fromStdString(App::appName()); QString version = QString::fromStdString(App:...
1c1b2f63-5f93-47e8-9f28-a27df616cfbc
{ "language": "C++" }
```c++ #include <ncurses.h> #include "ev3dev.h" using namespace ev3dev; int main() { int inputKey; const int KEY_A = 97; const int KEY_S = 115; const int KEY_D = 100; const int KEY_F = 102; const int KEY_Q = 113; const int KEY_R = 114; initscr(); raw(); mvprintw(1,2,"Hello world :) Press Q to quit. "); ...
```c++ #include <ncurses.h> #include "ev3dev.h" using namespace ev3dev; int main() { int inputKey; const int KEY_A = 97; const int KEY_S = 115; const int KEY_D = 100; const int KEY_F = 102; const int KEY_Q = 113; const int KEY_R = 114; initscr(); raw(); keypad(stdscr, TRUE); mvprintw(1,2,"Hello world :)...
349ae66a-4a12-4249-b1df-a3102c6b36b9
{ "language": "C++" }
```c++ /* * Copyright 2013 Kamil Michalak <kmichalak8@gmail.com> * * 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 requ...
```c++ /* * Copyright 2013 Kamil Michalak <kmichalak8@gmail.com> * * 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 requ...
25b506fa-d440-41d0-9382-924821aa237b
{ "language": "C++" }
```c++ /* * This file is part of meego-im-framework * * * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * Contact: Nokia Corporation (directui@nokia.com) * * If you have questions regarding the use of this file, please contact * Nokia at directui@nokia.com. * * This l...
```c++ /* * This file is part of meego-im-framework * * * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * Contact: Nokia Corporation (directui@nokia.com) * * If you have questions regarding the use of this file, please contact * Nokia at directui@nokia.com. * * This l...
b14e46d4-3b94-429d-97a5-c243013dcb79
{ "language": "C++" }
```c++ # include "broker2broker.hpp" # include <sstream> #include <sys/socket.h> /** * @brief Initialize an outgoing message of SNDMSG type. */ MessageForB2B::MessageForB2B(const chattp::ChattpMessage& mesg, const string& channel_id) { message_buffer.set_sequence_number(b2b_counter.get()); *(message_buffer.m...
```c++ # include "broker2broker.hpp" # include <sstream> #include <sys/socket.h> /** * @brief Initialize an outgoing message of SNDMSG type. */ MessageForB2B::MessageForB2B(const chattp::ChattpMessage& mesg, const string& channel_id) { message_buffer.set_sequence_number(b2b_counter.get()); *(message_buffer.m...
88045019-49d4-41db-8865-b0fbd1f7c89d
{ "language": "C++" }
```c++ #include <QApplication> #include <QSettings> #include <QLocale> #include <QTranslator> #include <QLibraryInfo> #include "trayicon.h" int main(int argc, char **argv) { QApplication app(argc, argv); QApplication::setOrganizationName("Restnotifier"); app.setQuitOnLastWindowClosed(false); // Set...
```c++ #include <QApplication> #include <QSettings> #include <QLocale> #include <QTranslator> #include <QLibraryInfo> #include "trayicon.h" int main(int argc, char **argv) { QApplication app(argc, argv); QApplication::setOrganizationName("Restnotifier"); app.setQuitOnLastWindowClosed(false); // Set...
b05f1d94-f9e7-4856-aa34-fd943dab6c1c
{ "language": "C++" }
```c++ #include "./transfer_function.h" #include <QLoggingCategory> #include <stdexcept> #include "./texture_manager.h" #include "../utils/gradient_utils.h" namespace Graphics { // QLoggingCategory tfChan("Graphics.TransferFunction"); TransferFunction::TransferFunction( std::shared_ptr<TextureManager> textureMan...
```c++ #include "./transfer_function.h" #include <QLoggingCategory> #include <stdexcept> #include "./texture_manager.h" #include "../utils/gradient_utils.h" namespace Graphics { // QLoggingCategory tfChan("Graphics.TransferFunction"); TransferFunction::TransferFunction( std::shared_ptr<TextureManager> textureMan...
7f2b0f7e-510a-48d5-b437-56ddf27e0d19
{ "language": "C++" }
```c++ #include <strong_types.hpp> namespace st = strong_types; // Create a type that counts number of cycles struct cycle_count : st::type<cycle_count, int> { // inherit the base class's constructors using type::type; }; // Create a type that counts number of instructions struct instruction_count : st::type<ins...
```c++ #include <strong_types.hpp> namespace st = strong_types; // Create a type that counts number of cycles struct cycle_count : st::type<cycle_count, int> { // inherit the base class's constructors using type::type; }; // Create a type that counts number of instructions struct instruction_count : st::type<ins...
5c6c313c-1a92-484b-9d08-a70bccc2bcc9
{ "language": "C++" }
```c++ #include "fisx_detector.h" #include <math.h> #include <stdexcept> Detector::Detector(const std::string & name, const double & density, const double & thickness, \ const double & funnyFactor): Layer(name, density, thickness, funnyFactor) { this->diameter = 0.0; this->distance = 10.0; }...
```c++ #include "fisx_detector.h" #include <math.h> #include <stdexcept> Detector::Detector(const std::string & name, const double & density, const double & thickness, \ const double & funnyFactor): Layer(name, density, thickness, funnyFactor) { this->diameter = 0.0; this->distance = 10.0; }...
19e49f40-a0cc-4b7f-a69e-70783540bf8d
{ "language": "C++" }
```c++ #include <mantella_bits/helper/unorderedContainer.hpp> // C++ standard library #include <functional> namespace mant { arma::uword Hash::operator()( const arma::Col<double>& key) const { // Start with the hash of the first value ... arma::uword hashedKey = std::hash<double>()(key(0)); // .....
```c++ #include <mantella_bits/helper/unorderedContainer.hpp> // C++ standard library #include <functional> namespace mant { arma::uword Hash::operator()( const arma::Col<double>& key) const { // Start with the hash of the first value ... arma::uword hashedKey = std::hash<double>()(key(0)); // .....
84e3d274-a76d-4c8b-a12c-8aa1c079adde
{ "language": "C++" }
```c++ /* C++ working draft 7.9.1 If the source value is between two adjacent destination values, the result of the conversion is an implementation-defined choice of either of those values. Otherwise, the behavior is undefined. */ #include <cstdlib> #include <iostream> int main() { static constexpr double kLargeDoub...
```c++ /* http://eel.is/c++draft/conv.double#1 7 Expressions [expr] 7.3 Standard conversions [conv] 7.3.9 Floating-point conversions [conv.double] 1 A prvalue of floating-point type can be converted to a prvalue of another floating-point type. If the source value can be exactly represented in the destination type, th...
ce8aa622-cbf0-42ff-be0e-f4aea4d62dc8
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 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/disk_cache/cache_util.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" namespace dis...
```c++ // Copyright (c) 2006-2008 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/disk_cache/cache_util.h" #include "base/file_util.h" #include "base/logging.h" #include "base/string_util.h" namespace dis...
2da51fda-e5de-4b9c-a501-046ed1c1ff56
{ "language": "C++" }
```c++ #include "OptionsManager.h" #include <fstream> #include <iostream> #include <boost/filesystem.hpp> #include <spotify/json.hpp> #include "codecs/OptionsCodec.h" #include "logging/Logging.h" OptionsManager::OptionsManager(std::string optionsFilename) { loadOptions(optionsFilename); } void OptionsManager:...
```c++ #include "OptionsManager.h" #include <fstream> #include <iostream> #include <boost/filesystem.hpp> #include <spotify/json.hpp> #include "codecs/OptionsCodec.h" #include "logging/Logging.h" OptionsManager::OptionsManager(std::string optionsFilename) { loadOptions(optionsFilename); } void OptionsManager:...
34e334f9-a26d-4b98-a97b-18fb183ece29
{ "language": "C++" }
```c++ #include "vast/detail/cppa_type_info.h" #include <cppa/announce.hpp> #include "vast/chunk.h" #include "vast/event.h" #include "vast/expression.h" #include "vast/schema.h" #include "vast/segment.h" #include "vast/to_string.h" #include "vast/uuid.h" namespace vast { namespace detail { template <typename T> void...
```c++ #include "vast/detail/cppa_type_info.h" #include <cppa/announce.hpp> #include "vast/chunk.h" #include "vast/event.h" #include "vast/expression.h" #include "vast/schema.h" #include "vast/segment.h" #include "vast/to_string.h" #include "vast/uuid.h" namespace vast { namespace detail { template <typename T> void...
4ecba23b-f742-4a52-a437-ecac11d5c25e
{ "language": "C++" }
```c++ // RUN: %clangxx -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx_cfi_diag -g %s -o %t %ld_flags_rpath_exe // RUN: %run %t 2>&1 | FileCheck %s // REQUIRES: cxxabi // UNSUPPORTED: win32 #include <stdio.h> #include <string.h> struct A { virtual void f(); }; void *create_B()...
```c++ // RUN: %clangxx -g -DSHARED_LIB %s -fPIC -shared -o %dynamiclib %ld_flags_rpath_so // RUN: %clangxx_cfi_diag -g %s -o %t %ld_flags_rpath_exe // RUN: %run %t 2>&1 | FileCheck %s // REQUIRES: cxxabi // UNSUPPORTED: win32 #include <stdio.h> #include <string.h> struct A { virtual void f(); }; void *create_B()...
a4219843-f804-4f3f-8629-3313b86429fb
{ "language": "C++" }
```c++ #include <iostream> using namespace std; #include "numvec.hpp" template<typename T> void f1(T &res, const T &x) { T u,y = 2*x; y = 7*x; y -= 1.2; u = x + y; y = y/x; u = 3/x; u += -y; u += 1.1*x; y = sin(u); res = pow(x,y); } void test_correctness() { const int len = 4; numvec<double, ...
```c++ #include <iostream> using namespace std; #include "numvec.hpp" template<typename T> void f1(T &res, const T &x) { T u,y = 2*x; y = 7*x; y -= 1.2; u = x + y; y = y/x; u = 3/x; u += -y; u += 1.1*x; y = sin(u); res = pow(x,y); y = pow(res,1.2); res = pow(y,3); } void test_correctness() { ...
317783c8-af02-431a-a5f7-aae7080a9d9a
{ "language": "C++" }
```c++ // Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #include "HorizontalTile.h" HorizontalTile::HorizontalTile(std::wstring bitmapName, int x, int y, int units, bool reverse) : Meter(bitmapName, x, y, units), _reverse(reverse) { _rect.Wid...
```c++ // Copyright (c) 2015, Matthew Malensek. // Distributed under the BSD 2-Clause License (see LICENSE.txt for details) #include "HorizontalTile.h" HorizontalTile::HorizontalTile(std::wstring bitmapName, int x, int y, int units, bool reverse) : Meter(bitmapName, x, y, units), _reverse(reverse) { _rect.Wid...
98538932-be82-476e-91aa-3caffabc229a
{ "language": "C++" }
```c++ #include <Python.h> #include "Quantuccia/ql/time/calendars/unitedstates.hpp" static PyObject* get_holiday_date(PyObject *self, PyObject *args) { return NULL; } static PyMethodDef QuantucciaMethods[] = { {"get_holiday_date", (PyCFunction)get_holiday_date, METH_VARARGS, NULL}, {NULL, NULL} /* S...
```c++ #include <Python.h> #include "Quantuccia/ql/time/calendars/unitedstates.hpp" static PyObject* get_holiday_date(PyObject *self, PyObject *args) { return NULL; } static PyMethodDef QuantucciaMethods[] = { {"get_holiday_date", (PyCFunction)get_holiday_date, METH_VARARGS, NULL}, {NULL, NULL} /* S...
68992a59-e4f2-4f80-aeed-93771ea1dbf7
{ "language": "C++" }
```c++ // Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 #include <signal.h> #include <iostream> #include "verilated_toplevel.h" #include "verilator_sim_ctrl.h" ibex_riscv_compliance *top; VerilatorSimCtrl *simctrl; ...
```c++ // Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 #include <signal.h> #include <iostream> #include "verilated_toplevel.h" #include "verilator_sim_ctrl.h" ibex_riscv_compliance *top; VerilatorSimCtrl *simctrl; ...
942796b0-1d02-41b6-98ae-ecfcb379d415
{ "language": "C++" }
```c++ /** * Author: Václav Volhejn * Source: KACTL notebook (various/chapter.tex) * Status: Tested manually, forAllSubsetMasks tested at Ptz * Description: Various bit manipulation functions/snippets. */ #include "../base.hpp" int lowestSetBit(int x) { return x & -x } void forAllSubsetMasks(int m) { // Includin...
```c++ /** * Name: Bit hacks * Author: Václav Volhejn * Source: KACTL notebook (various/chapter.tex) * Status: Tested manually, forAllSubsetMasks tested at Ptz * Description: Various bit manipulation functions/snippets. */ #include "../base.hpp" int lowestSetBit(int x) { return x & -x } void forAllSubsetMasks(i...
6622ea96-125a-4023-b70a-e737c737ea5b
{ "language": "C++" }
```c++ #include "gameitem.h" #include <QDeclarativeExpression> GameItem::GameItem(QQuickItem *parent) : QQuickItem(parent), m_expression(0) { } void GameItem::update(long delta) { if (m_expression) m_expression->evaluate(); } QDeclarativeScriptString GameItem::updateScript() const { return...
```c++ #include "gameitem.h" #include <QDeclarativeExpression> GameItem::GameItem(QQuickItem *parent) : QQuickItem(parent), m_expression(0) { } void GameItem::update(long delta) { if (m_expression) m_expression->evaluate(); } QDeclarativeScriptString GameItem::updateScript() const { return...
0310fe72-5719-4c89-8a43-9b5a019af574
{ "language": "C++" }
```c++ // Copyright (c) 2011 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 "content/shell/shell_content_client.h" #include "base/string_piece.h" namespace content { ShellContentClient::~ShellContentClient()...
```c++ // Copyright (c) 2011 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 "content/shell/shell_content_client.h" #include "base/string_piece.h" #include "webkit/glue/user_agent.h" namespace content { Shell...
76570a20-5cff-4520-b1f6-0d2c565b6e2b
{ "language": "C++" }
```c++ #include <MemoryManager.hh> #include <cstddef> #include <new> void *operator new(std::size_t size) { return MemoryManager::get().allocate(size); } void *operator new[](std::size_t size) { return MemoryManager::get().allocate(size); } void operator delete(void* p) { MemoryManager::get().deallocate(...
```c++ #include <MemoryManager.hh> #include <cstddef> #include <new> void *operator new(std::size_t size) { return MemoryManager::get().allocate(size); } void *operator new[](std::size_t size) { return MemoryManager::get().allocate(size); } void operator delete(void* p) { MemoryManager::get().deallocate(...
929f2d36-67aa-432a-ab59-643d1cc5c82f
{ "language": "C++" }
```c++ // Copyright (c) 2011 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 "content/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_view_host.h" RenderViewHo...
```c++ // Copyright (c) 2011 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 "content/browser/renderer_host/render_view_host_observer.h" #include "content/browser/renderer_host/render_view_host.h" RenderViewHo...
0d01a4ea-cf12-403e-aff0-778011c5152a
{ "language": "C++" }
```c++ #include <QtPlugin> #include "test_video_annotator.h" #include "fish_detector/video_annotator/mainwindow.h" #ifdef _WIN32 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) #endif void TestVideoAnnotator::testLoadVideo() { fish_detector::video_annotator::MainWindow mainwin; mainwin.player_->loadVideo("slow_motion...
```c++ #include <QtPlugin> #include "test_video_annotator.h" #include "fish_detector/video_annotator/mainwindow.h" #ifdef _WIN32 Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin) #endif void TestVideoAnnotator::testLoadVideo() { fish_detector::video_annotator::MainWindow mainwin; std::string name = "C:/local/FishDetect...
fe61ca03-7481-4cc9-b830-5e68ca8a3eda
{ "language": "C++" }
```c++ // 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 "chrome/browser/extensions/extension_input_method_api.h" #include "base/values.h" #include "chrome/browser/chromeos/input_method/inpu...
```c++ // 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 "chrome/browser/extensions/extension_input_method_api.h" #include "base/values.h" #include "chrome/browser/chromeos/input_method/inpu...
6bdb0dbf-c1b0-440b-b4c4-ff44c1a3ae2a
{ "language": "C++" }
```c++ #include <vector> #include <iostream> #include <algorithm> #ifndef REMOVE_VALUES #ifndef CHECK_VALUES #error "define one of REMOVE_VALUES or CHECK_VALUES" #endif #endif #ifdef REMOVE_VALUES #ifdef CHECK_VALUES #error "define either REMOVE_VALUES or CHECK_VALUES" #endif...
```c++ #include <vector> #include <iostream> #include <algorithm> #ifndef REMOVE_VALUES #ifndef CHECK_VALUES #error "define one of REMOVE_VALUES or CHECK_VALUES" #endif #endif #ifdef REMOVE_VALUES #ifdef CHECK_VALUES #error "define either REMOVE_VALUES or CHECK_VALUES" #endif...
5c5710ae-0ed5-4dc3-bf9e-69b19de5c557
{ "language": "C++" }
```c++ #include "Test.h" TEST_CASE("Nets") { auto tree = SyntaxTree::fromText(R"( module Top; wire logic f = 1; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Continuous Assignments") { auto tree = SyntaxTree::fromText(R"( module T...
```c++ #include "Test.h" #include <nlohmann/json.hpp> TEST_CASE("Nets") { auto tree = SyntaxTree::fromText(R"( module Top; wire logic f = 1; endmodule )"); Compilation compilation; compilation.addSyntaxTree(tree); NO_COMPILATION_ERRORS; } TEST_CASE("Continuous Assignments") { auto tree = Syn...
ed0ad7a6-9714-4448-9fb7-f3a4e4a22ff4
{ "language": "C++" }
```c++ #include <Automaton.h> #include "Atm_blink.h" Atm_blink & Atm_blink::begin( int attached_pin, int blinkrate ) { const static state_t state_table[] PROGMEM = { /* ON_ENTER ON_LOOP ON_EXIT EVT_TIMER ELSE */ /* LED_ON */ ACT_ON, -1, -1, LED_OFF, -1, /* LED_OFF */ ACT...
```c++ #include <Automaton.h> #include "Atm_blink.h" Atm_blink & Atm_blink::begin( int attached_pin, uint32_t blinkrate ) { const static state_t state_table[] PROGMEM = { /* ON_ENTER ON_LOOP ON_EXIT EVT_TIMER ELSE */ /* LED_ON */ ACT_ON, -1, -1, LED_OFF, -1, /* LED_OFF */...
2d7db904-2d95-4b06-9d27-583587bb468a
{ "language": "C++" }
```c++ #include <iostream> using namespace std; class Complex { double re, im; public: Complex(double r, double i) : re {r}, im {i} {} Complex operator+(Complex); Complex operator*(Complex); friend ostream &operator<<(ostream &os, Complex c); }; ostream &operator<<(ostream &os, Complex c) { os << c.re; os << ...
```c++ #include <iostream> using namespace std; class Complex { double re, im; public: Complex(double r, double i) : re {r}, im {i} {} Complex operator+(Complex); Complex operator*(Complex); friend ostream &operator<<(ostream &os, Complex c); }; ostream &operator<<(ostream &os, Complex c) { os << c.re; os << ...
7ce15de1-a2f8-48e0-8d63-e1f4f970176d
{ "language": "C++" }
```c++ /** * atom_types_init.cc * * Link Grammar Atom Types used during Viterbi parsing. * * Copyright (c) 2009 Linas Vepstas <linasvepstas@gmail.com> */ #include "opencog/viterbi/atom_types.definitions" using namespace opencog; // library initialization #if defined(WIN32) && defined(_DLL) namespace win { #inc...
```c++ /** * atom_types_init.cc * * Link Grammar Atom Types used during Viterbi parsing. * * Copyright (c) 2009, 2013 Linas Vepstas <linasvepstas@gmail.com> */ #include <opencog/server/Module.h> #include "opencog/viterbi/atom_types.definitions" using namespace opencog; // library initialization #if defined(WIN...
cc0ec3bd-d085-425c-ba70-e8fbff91195e
{ "language": "C++" }
```c++ Matrix2f M = Matrix2f::Random(); Matrix2f m; m = M; cout << "Here is the matrix m:" << endl << m << endl; cout << "Now we want to replace m by its own transpose." << endl; cout << "If we do m = m.transpose(), then m becomes:" << endl; m = m.transpose() * 1; cout << m << endl << "which is wrong!" << endl; cout <<...
```c++ Matrix2f M = Matrix2f::Random(); Matrix2f m; m = M; cout << "Here is the matrix m:" << endl << m << endl; cout << "Now we want to copy a column into a row." << endl; cout << "If we do m.col(1) = m.row(0), then m becomes:" << endl; m.col(1) = m.row(0); cout << m << endl << "which is wrong!" << endl; cout << "Now ...
2c9c38cb-ee9e-4053-aaf1-9fc7293a7d00
{ "language": "C++" }
```c++ //===- llvm/unittest/Support/TimeValueTest.cpp - Time Value tests ---------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
```c++ //===- llvm/unittest/Support/TimeValueTest.cpp - Time Value tests ---------===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===------------------------------------------------...
4ddfd494-3fc2-40b0-b521-fee8b4bef52c
{ "language": "C++" }
```c++ #include "GLPlatform.hpp" void glPlatformInit() { #ifdef GL_PLATFORM_USING_WIN glewInit(); #endif } ``` Add exception if GLEW fails to initialize.
```c++ #include "GLPlatform.hpp" #include <stdexcept> void glPlatformInit() { #ifdef GL_PLATFORM_USING_WIN GLenum err = glewInit(); if (GLEW_OK != err) { throw std::runtime_error("GLEW failed to initialize."); } #endif } ```
6aa90610-f6df-479b-b359-064e167c74e1
{ "language": "C++" }
```c++ #error Still to implement string executable_path() { char buffer[16 * 1024]; int bytes = GetModuleFileName(NULL, buffer, sizeof(buffer)); if (bytes == 0) { throw unable_to_find_executable_path{}; } buffer[bytes] = '\0'; string executable_path{buffer}; return std::string{executable_path.cbegin(), ...
```c++ #include <sdl_cpp/widgets/executable_path.h> #include <string> #include "Windows.h" //#error Still to implement using namespace ::std; string executable_path() { char buffer[16 * 1024]; int bytes = GetModuleFileName(nullptr, buffer, sizeof(buffer)); if (bytes == 0) { throw unable_to_find_executable_path...
ddd98c71-2ec2-4647-80df-b996d589f5d4
{ "language": "C++" }
```c++ /** * @file BStringTests.cpp * @copyright (c) 2014 by Petr Zemek (s3rvac@gmail.com) and contributors * @license BSD, see the @c LICENSE file for more details * @brief Tests for the BString class. */ #include <gtest/gtest.h> #include "BString.h" namespace bencoding { namespace tests { using namespa...
```c++ /** * @file BStringTests.cpp * @copyright (c) 2014 by Petr Zemek (s3rvac@gmail.com) and contributors * @license BSD, see the @c LICENSE file for more details * @brief Tests for the BString class. */ #include <gtest/gtest.h> #include "BString.h" namespace bencoding { namespace tests { using namespa...
21134849-5c03-4bcd-8aaa-4bbbe2fe8441
{ "language": "C++" }
```c++ // Copyright 2015 http://switchdevice.com #include "Arduino.cc" #include "EEPROM.cc" #include "Serial.cc" #include "SoftwareSerial.cc" #include "serialHelper.cc" #include "Spark.cc" #include "WiFi.cc" #include "Wire.cc" #include "SPI.cc" #include "OneWire.cc" #include "IRremote.cc" ``` Comment out unused mock...
```c++ // Copyright 2015 http://switchdevice.com #include "Arduino.cc" #include "Serial.cc" #include "serialHelper.cc" #include "OneWire.cc" #include "SoftwareSerial.cc" /* At WiTraC we don't make use of any of the following mocks. They are therefore * commented out to save precious build time */ //#include "EEPRO...
64a5f4c2-1f94-4184-a149-adf3d690a083
{ "language": "C++" }
```c++ #include "rastertext.hpp" bool RasterText::loadTexture() { return true; } ``` Add placeholder font code for Windows
```c++ #include "rastertext.hpp" // FIXME: unimplemented Font::Font(Font const &f) { } Font::~Font() { } Font &Font::operator=(Font const &f) { return *this; } bool RasterText::loadTexture() { return true; } ```
fe9d6029-6ab1-4474-8b1b-a2fac10b72c5
{ "language": "C++" }
```c++ /************************************************************************* * * REALM CONFIDENTIAL * __________________ * * [2011] - [2016] Realm Inc * All Rights Reserved. * * NOTICE: All information contained herein is, and remains * the property of Realm Incorporated and its suppliers, * if any. ...
```c++ /************************************************************************* * * Copyright 2016 Realm Inc. * * 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.o...
9118592c-e2a9-4add-932c-ea196c1069f6
{ "language": "C++" }
```c++ // Copyright (c) 2009 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 "chrome/browser/extensions/extension_apitest.h" // Disabled, http://crbug.com/30151. IN_PROC_BROWSER_TEST_F(ExtensionApiTest, DISABLE...
```c++ // Copyright (c) 2009 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 "chrome/browser/extensions/extension_apitest.h" // Disabled, http://crbug.com/30151 (Linux and ChromeOS), // http://crbug.com/35034 (...
69ee1699-caa8-4275-b7c2-4406f885a22e
{ "language": "C++" }
```c++ /** ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** * Copyright 2020 Ben Vanik. All rights reserved. ...
```c++ /** ****************************************************************************** * Xenia : Xbox 360 Emulator Research Project * ****************************************************************************** * Copyright 2020 Ben Vanik. All rights reserved. ...
f5a6820c-fc01-4cb7-bbe1-cdaa62c920c1
{ "language": "C++" }
```c++ // Copyright (c) 2015 Chaobin Zhang. All rights reserved. // Use of this source code is governed by the BSD license that can be // found in the LICENSE file. #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" #include "common/util.h" #include "master/curl_helper.h" #include "testing/gtest/in...
```c++ // Copyright (c) 2015 Chaobin Zhang. All rights reserved. // Use of this source code is governed by the BSD license that can be // found in the LICENSE file. #include "base/files/scoped_temp_dir.h" #include "base/path_service.h" #include "common/util.h" #include "master/curl_helper.h" #include "testing/gtest/in...
c33ff11d-125a-4d6d-ab87-514687173434
{ "language": "C++" }
```c++ /** @file @brief Implementation @date 2014 @author Ryan Pavlik <ryan@sensics.com> <http://sensics.com> */ // Copyright 2014 Sensics, Inc. // // All rights reserved. // // (Final version intended to be licensed under // the Apache License, Version 2.0) // Internal Includes #include <og...
```c++ /** @file @brief Implementation @date 2014 @author Ryan Pavlik <ryan@sensics.com> <http://sensics.com> */ // Copyright 2014 Sensics, Inc. // // All rights reserved. // // (Final version intended to be licensed under // the Apache License, Version 2.0) // Internal Includes #include <og...
04781a49-cc87-4885-a8c9-c07fa38af8ea
{ "language": "C++" }
```c++ /*************************************************************************** * @file main.cpp * @author Alan.W * @date 02 Feb 2014 * 13 Oct 2014 * @remark This code is for the exercises from C++ Primer 5th Edition * @note ********************************************...
```c++ /*************************************************************************** * @file main.cpp * @author Alan.W * @date 02 Feb 2014 * 13 Oct 2014 * @remark This code is for the exercises from C++ Primer 5th Edition * @note ********************************************...
5a0748f1-92cf-4336-b398-c3f1e6b6e978
{ "language": "C++" }
```c++ #define BOOST_TEST_ALTERNATIVE_INIT_API #include <boost/test/unit_test.hpp> #include "ReservoirBenchmark.h" #include "TMGas.h" using namespace boost::unit_test; void performMeasurement() { int iterations = 1000; ReservoirFactory *rFactory = new TMGas::Reservoir::Factory(16); reservoirBenchmark(rFact...
```c++ #define BOOST_TEST_ALTERNATIVE_INIT_API #include <boost/test/unit_test.hpp> #include "ReservoirBenchmark.h" #include "TMGas.h" using namespace boost::unit_test; void performMeasurement() { int iterations = 100; ReservoirFactory *rFactory = new TMGas::Reservoir::Factory(16); reservoirBenchmark(rFacto...
7002c5d9-7ebc-431d-87ee-9816b4c506dc
{ "language": "C++" }
```c++ #include "Renderer.hpp" #include "../OpenGL/OpenGLRenderer.hpp" #include "../Vulkan/VulkanRenderer.hpp" Renderer::~Renderer() { } Renderer* Renderer::makeRenderer(BACKEND backend, Window & window){ // Create and return backend. if(backend == BACKEND::OpenGL) return new OpenGLRenderer(windo...
```c++ #include "Renderer.hpp" #include "../OpenGL/OpenGLRenderer.hpp" #include "../Vulkan/VulkanRenderer.hpp" Renderer::~Renderer() { } Renderer* Renderer::makeRenderer(BACKEND backend, Window & window){ // Create and return backend. if(backend == BACKEND::OpenGL) return new OpenGLRenderer(windo...
0d9c1d6a-ae8d-4bb0-b811-63525f9745e8
{ "language": "C++" }
```c++ #include "WindowMaximize.h" #include "WebPage.h" #include "WebPageManager.h" WindowMaximize::WindowMaximize(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) { } void WindowMaximize::windowFound(WebPage *page) { QDesktopWidget *desktop = QApplicatio...
```c++ #include <QDesktopWidget> #include "WindowMaximize.h" #include "WebPage.h" #include "WebPageManager.h" WindowMaximize::WindowMaximize(WebPageManager *manager, QStringList &arguments, QObject *parent) : WindowCommand(manager, arguments, parent) { } void WindowMaximize::windowFound(WebPage *page) { QDesktopWid...
4a82c7fa-31be-4ad7-b015-0d11e20d3bf4
{ "language": "C++" }
```c++ /* * PartitionReader.cpp * * Created on: 15.02.2013 * Author: Christian Staudt (christian.staudt@kit.edu) */ #include "PartitionReader.h" namespace NetworKit { Partition PartitionReader::read(std::string path) { std::ifstream file(path); // check if file readable if (!file) { throw std::runt...
```c++ /* * PartitionReader.cpp * * Created on: 15.02.2013 * Author: Christian Staudt (christian.staudt@kit.edu) */ #include "PartitionReader.h" namespace NetworKit { Partition PartitionReader::read(std::string path) { std::ifstream file(path); // check if file readable if (!file) { throw std::runt...
8d1605ef-1e57-4f1d-95f7-959e4b6a5a08
{ "language": "C++" }
```c++ /* * Qumulus UML editor * Author: Frank Erens * Author: Randy Thiemann * */ #include "PackageShape.h" #include <QtGui/QBrush> QUML_BEGIN_NAMESPACE_UD PackageShape::PackageShape(QuUK::Element* e, DiagramElement* p) : SelectableShape(e, p), mTabItem(new QGraphicsRectItem(0, 0, 30, ...
```c++ /* * Qumulus UML editor * Author: Frank Erens * Author: Randy Thiemann * */ #include "PackageShape.h" #include <QtGui/QBrush> QUML_BEGIN_NAMESPACE_UD PackageShape::PackageShape(QuUK::Element* e, DiagramElement* p) : SelectableShape(e, p), mTabItem(new QGraphicsRectItem(0, 0, 30, ...
5fadcab6-65ec-486e-b15c-b18e70f5d89c
{ "language": "C++" }
```c++ #include "ofMain.h" #include "ofApp.h" //======================================================================== int main( ){ ofGLWindowSettings settings; settings.setGLVersion(3, 2); // Using programmable renderer. Comment out this line to use the 'standard' GL renderer. settings.width = 1024; ...
```c++ #include "ofMain.h" #include "ofApp.h" //======================================================================== int main( ){ ofWindowSettings winSettings; winSettings.setSize(1024, 768); ofGLWindowSettings glSettings(winSettings); glSettings.setGLVersion(3, 2); // Using programmable renderer. ...
39436f6c-30a1-469f-8c9c-e77d6cecbe0b
{ "language": "C++" }
```c++ /* Copyright (c) 2006, NIF File Format Library and Tools All rights reserved. Please see niflib.h for licence. */ #include "SkinPartition.h" using namespace Niflib; //Constructor SkinPartition::SkinPartition() : numVertices((ushort)0), numTriangles((ushort)0), numBones((ushort)0), numStrips((ushort)0), numWei...
```c++ /* Copyright (c) 2006, NIF File Format Library and Tools All rights reserved. Please see niflib.h for licence. */ #include "SkinPartition.h" using namespace Niflib; //Constructor SkinPartition::SkinPartition() : numVertices((ushort)0), numTriangles((ushort)0), numBones((ushort)0), numStrips((ushort)0), numWei...
0bf7b9e2-b31a-4181-9ade-9f24e5dd7881
{ "language": "C++" }
```c++ #include "socketmanager.h" std::shared_ptr<Socket> SocketManager::getSocket(const std::string& socketType) { void* sockFile = dlopen(("sockets/" + socketType + ".so").c_str(), RTLD_NOW); if (sockFile == nullptr) throw SocketLoadFailed (dlerror()); void* spawnFunc = dlsym(sockFile, "spawn"); if (spawnFunc ...
```c++ #include "socketmanager.h" std::shared_ptr<Socket> SocketManager::getSocket(const std::string& socketType) { void* sockFile = dlopen(("sockets/" + socketType + ".so").c_str(), RTLD_NOW); if (sockFile == nullptr) throw SocketLoadFailed (dlerror()); void* spawnFunc = dlsym(sockFile, "spawn"); if (spawnFunc ...
ebab5c85-1b04-498d-b00e-da658124dfc5
{ "language": "C++" }
```c++ #include <stdio.h> #include <Halide.h> using namespace Halide; int main(int argc, char **argv) { Var x, y; Var xo, xi, yo, yi; Func f, g; printf("Defining function...\n"); f(x, y) = cast<float>(x); g(x, y) = f(x+1, y) + f(x-1, y); Target target = get_jit_target_from_environment(...
```c++ #include <stdio.h> #include <Halide.h> using namespace Halide; int main(int argc, char **argv) { Var x, y; Var xo, xi, yo, yi; Func f, g; printf("Defining function...\n"); f(x, y) = cast<float>(x); g(x, y) = f(x+1, y) + f(x-1, y); Target target = get_jit_target_from_environment(...
9ef14b43-11c4-400f-89cc-6542aacc49d3
{ "language": "C++" }
```c++ /* * Copyright (c) 2007 Digital Bazaar, Inc. All rights reserved. */ #include <iostream> #include "db/io/OStreamOutputStream.h" using namespace std; using namespace db::io; using namespace db::rt; OStreamOutputStream* OStreamOutputStream::mStdoutStream = new OStreamOutputStream(&cout); OStreamOutputSt...
```c++ /* * Copyright (c) 2007 Digital Bazaar, Inc. All rights reserved. */ #include <iostream> #include "db/io/OStreamOutputStream.h" using namespace std; using namespace db::io; using namespace db::rt; OStreamOutputStream* OStreamOutputStream::sStdoutStream = new OStreamOutputStream(&cout); OStreamOutputSt...
5017fc1e-dd29-47fc-bb2a-1866ddbcf1bf
{ "language": "C++" }
```c++ #include <esp_log.h> #include <FreeRTOS.h> #include <string> #include <Task.h> #include <I2C.h> #include "sdkconfig.h" #define SDA_PIN 25 #define SCL_PIN 26 //static char tag[] = "task_cpp_utils"; class I2CScanner: public Task { void run(void *data) override { I2C i2c; i2c.init((gpio_num_t)SDA_PIN, (gpi...
```c++ #include <esp_log.h> #include <FreeRTOS.h> #include <string> #include <Task.h> #include <I2C.h> #include "sdkconfig.h" #define DEVICE_ADDRESS 0 #define SDA_PIN 25 #define SCL_PIN 26 //static char tag[] = "task_cpp_utils"; class I2CScanner: public Task { void run(void *data) override { I2C i2c; i2c.init(...
d8718b48-448c-4667-a7fe-30ae33a4876e
{ "language": "C++" }
```c++ #include "phonevalidator.h" PhoneValidator::PhoneValidator(QObject *parent) : QValidator(parent) { } QValidator::State PhoneValidator::validate(QString &input, int &pos) const { //DDD QRegExp ddd("(\\d{2})+"); if (ddd.exactMatch(input)) { input.insert(input.length(), ") "); ...
```c++ #include "phonevalidator.h" PhoneValidator::PhoneValidator(QObject *parent) : QValidator(parent) { } QValidator::State PhoneValidator::validate(QString &input, int &pos) const { //DDD QRegExp ddd("(\\d{2})+"); if (ddd.exactMatch(input)) { input.insert(input.length(), ") "); ...
5ff9b488-3e33-4902-b79a-cad910e3221c
{ "language": "C++" }
```c++ /* Test program to test the thread callbacks */ #include <iostream> #include "SDL.hh" using namespace RAGE; Logger testlog("testThread"); class ObjectWithThreadCall { public: int threadcall(void* args) { testlog << nl << " --- Thread " << SDL::getCurrentThreadID() << "called --- " << std::endl; retu...
```c++ /* Test program to test the thread callbacks */ #include <iostream> #include "SDL.hh" using namespace RAGE; Logger testlog("testThread"); class ObjectWithThreadCall { public: ObjectWithThreadCall() {} int threadcall(void* args) { testlog << nl << " --- Thread " << SDL::getCurrentThreadID() << "called...
2bdff901-2288-4408-b817-46718db78618
{ "language": "C++" }
```c++ #include "utils/progressBar.h" #include <iostream> #include <glog/logging.h> using namespace std; const std::string ProgressBar::BEGINNING = "["; const std::string ProgressBar::END = "]"; const std::string ProgressBar::FILLER = "-"; const size_t ProgressBar::LENGTH = 50; ProgressBar::ProgressBar() : mProg...
```c++ #include "utils/progressBar.h" #include <iostream> #include <cmath> #include <glog/logging.h> using namespace std; const std::string ProgressBar::BEGINNING = "["; const std::string ProgressBar::END = "]"; const std::string ProgressBar::FILLER = "-"; const size_t ProgressBar::LENGTH = 50; ProgressBar::Progress...
52232137-6501-453e-b4a6-512bc4c5dd7f
{ "language": "C++" }
```c++ #include "framework/applicationcontext.hh" #include "framework/clientcode.hh" using Framework::ApplicationContext; using Framework::ClientCode; using Framework::LoadClientCode; using System::thread; int applicationMain() { ClientCode clientCode = LoadClientCode(); ApplicationContext applicationContex...
```c++ #include "framework/applicationcontext.hh" #include "framework/clientcode.hh" using Framework::ApplicationContext; using Framework::ClientCode; using Framework::LoadClientCode; int applicationMain() { ClientCode clientCode = LoadClientCode(); ApplicationContext applicationContext; clientCode.Appl...
1e63f2c1-64c3-4863-a4ac-eeb875d954ba
{ "language": "C++" }
```c++ #include <QActiveResource.h> #include <QDebug> int main() { qDebug() << getenv("AR_BASE"); QActiveResource::Resource resource(QUrl(getenv("AR_BASE")), getenv("AR_RESOURCE")); const QString field = getenv("AR_FIELD"); for(int i = 0; i < 100; i++) { qDebug() << i; foreach(QAc...
```c++ #include <QActiveResource.h> #include <QDebug> int main() { Q_ASSERT(getenv("AR_BASE") && getenv("AR_RESOURCE") && getenv("AR_FIELD")); qDebug() << getenv("AR_BASE"); QActiveResource::Resource resource(QUrl(getenv("AR_BASE")), getenv("AR_RESOURCE")); const QString field = getenv("AR_FIELD"); ...
1e8ab883-7ed9-45e4-9bae-5daed20f6d7f
{ "language": "C++" }
```c++ #include "response_stream.h" void rs::httpserver::ResponseStream::Flush() { socket_->Flush(); } int rs::httpserver::ResponseStream::Write(const Stream::byte* buffer, int offset, int count) { auto written = 0; while (written < count) { auto sentBytes = socket_->Send(buffer + written, co...
```c++ #include "response_stream.h" void rs::httpserver::ResponseStream::Flush() { socket_->Flush(); } int rs::httpserver::ResponseStream::Write(const Stream::byte* buffer, int offset, int count) { auto written = 0; while (written < count) { auto sentBytes = socket_->Send(buffer + offset + wr...
6b89b354-d0b8-49e6-9423-02fcd6e86090
{ "language": "C++" }
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkColorMatrixFilter.h" static SkScalar byte_to_scale(U8CPU byte) { if (0xFF == byte) { // want to get this exact return 1; } else { ...
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "SkColorMatrixFilter.h" static SkScalar byte_to_scale(U8CPU byte) { if (0xFF == byte) { // want to get this exact return 1; } else { ...
1f97577e-f50d-4688-bd4c-0612026f5d72
{ "language": "C++" }
```c++ // Copyright (c) 2006-2008 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 "base/thread_local.h" #include <pthread.h> #include "base/logging.h" namespace base { // static void ThreadLocalPlatform::All...
```c++ // Copyright (c) 2006-2008 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 "base/thread_local.h" #include <pthread.h> #include "base/logging.h" namespace base { // static void ThreadLocalPlatform::All...
b21f6dba-1438-4716-b098-f221579809a4
{ "language": "C++" }
```c++ // // application_context.cpp // usbtest // // Created by Kristoffer Andersen on 13/07/15. // Copyright (c) 2015 Monolit ApS. All rights reserved. // #include "application_context.h" #include <display_painter.h> extern "C" { #include <project.h> } using namespace mono; ApplicationContext ApplicationConte...
```c++ // // application_context.cpp // usbtest // // Created by Kristoffer Andersen on 13/07/15. // Copyright (c) 2015 Monolit ApS. All rights reserved. // #include "application_context.h" #include "application_controller_interface.h" #include <display_painter.h> extern "C" { #include <project.h> } using namesp...
ab24f37a-a53f-4b28-902f-f169b7f25544
{ "language": "C++" }
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; using DataStore = You::DataStore::DataStore; namespace YouDataStoreTests { TEST_CLASS(DataStoreApiTest) { public: TEST_METHOD(DataStore_Post_Basic_Test) { You::DataStore...
```c++ #include "stdafx.h" #include "CppUnitTest.h" #include "datastore.h" using Assert = Microsoft::VisualStudio::CppUnitTestFramework::Assert; using DataStore = You::DataStore::DataStore; namespace YouDataStoreTests { TEST_CLASS(DataStoreApiTest) { public: DataStore sut; TEST_METHOD(DataStore_Post_Basic_Test) {...
4c27f644-f0be-4ac9-ba7c-4edccbd6f7c6
{ "language": "C++" }
```c++ #include "settingsview.h" #include "ui_settings.h" SettingsView::SettingsView(QWidget *parent) : QMainWindow(parent), ui(new Ui::SettingsView) { ui->setupUi(this); QSettings settings; int syncingPreference = settings.value("syncingPreference", QVariant(static_cast<int>(SyncOptions::MANUAL_ON...
```c++ #include "settingsview.h" #include "ui_settings.h" SettingsView::SettingsView(QWidget *parent) : QMainWindow(parent), ui(new Ui::SettingsView) { ui->setupUi(this); QSettings settings; int syncingPreference = settings.value("syncingPreference", QVariant(static_cast<int>(SyncOptions::MANUAL_ON...
0e85b334-e8d9-449a-95c8-17081af12861
{ "language": "C++" }
```c++ // RUN: clang-cc -emit-llvm-only -verify %s // PR5454 class X {static void * operator new(unsigned long size) throw(); X(int); }; int a(), b(); void b(int x) { new X(x ? a() : b()); } ``` Make test more platform independent.
```c++ // RUN: clang-cc -emit-llvm-only -verify %s // PR5454 #include <stddef.h> class X {static void * operator new(size_t size) throw(); X(int); }; int a(), b(); void b(int x) { new X(x ? a() : b()); } ```
9b68b45a-b7a5-4343-ab6a-735f92df5f58
{ "language": "C++" }
```c++ #include <cstdlib> #include <iostream> int main() { #ifdef __APPLE__ const char* name = "DYLD_LIBRARY_PATH"; #else const char* name = "LD_LIBRARY_PATH"; #endif const char* cetLDPathValue = getenv("CETD_LIBRARY_PATH"); int res = setenv("DYLD_LIBRARY_PATH", cetLDPathValue, 1); const char* localLDPathV...
```c++ #include <cstdlib> #include <string.h> #include <iostream> int main() { #ifdef __APPLE__ const char* name = "DYLD_LIBRARY_PATH"; #else const char* name = "LD_LIBRARY_PATH"; #endif const char* cetLDPathValue = getenv("CETD_LIBRARY_PATH"); int res = setenv("DYLD_LIBRARY_PATH", cetLDPathValue, 1); cons...
74b34496-da34-4a98-bbb6-e6eb7ebeeef7
{ "language": "C++" }
```c++ #include "GeometryObject.h" GeometryObject::GeometryObject() { } GeometryObject::GeometryObject(const std::vector<Point3D>& vertices, const std::vector<uint8_t>& indices) : m_vertices(vertices), m_indices(indices){ } GeometryObject::~GeometryObject() { } const std::vector<Triangle3D> GeometryObject::t...
```c++ #include "GeometryObject.h" GeometryObject::GeometryObject() { m_color = RGBColor(1, 0, 0); } GeometryObject::GeometryObject(const std::vector<Point3D>& vertices, const std::vector<uint8_t>& indices) : m_vertices(vertices), m_indices(indices){ m_color = RGBColor(1, 0, 0); } GeometryObject::~GeometryObj...
e21ecf4a-01b4-428e-8a11-faa0fdc25a92
{ "language": "C++" }
```c++ // Copyright 2015 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 "chrome/browser/banners/app_banner_manager_desktop.h" #include "base/command_line.h" #include "chrome/browser/banners/app_banner_data_fet...
```c++ // Copyright 2015 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 "chrome/browser/banners/app_banner_manager_desktop.h" #include "base/command_line.h" #include "chrome/browser/banners/app_banner_data_fet...
83106363-3668-4611-86d5-87e4fdac0dfb
{ "language": "C++" }
```c++ #include "perf_precomp.hpp" using namespace std; using namespace cv; using namespace perf; using std::tr1::make_tuple; using std::tr1::get; typedef perf::TestBaseWithParam<std::string> fast; #define FAST_IMAGES \ "cv/detectors_descriptors_evaluation/images_datasets/leuven/img1.png",\ "stitching/a3.png...
```c++ #include "perf_precomp.hpp" using namespace std; using namespace cv; using namespace perf; using std::tr1::make_tuple; using std::tr1::get; enum { TYPE_5_8 =FastFeatureDetector::TYPE_5_8, TYPE_7_12 = FastFeatureDetector::TYPE_7_12, TYPE_9_16 = FastFeatureDetector::TYPE_9_16 }; CV_ENUM(FastType, TYPE_5_8, TYPE_...
ba7afebb-af84-4088-bc9b-5a31b52c48ea
{ "language": "C++" }
```c++ int main() { } ``` Test tree and try printing it
```c++ #include <iostream> #include <memory> #include <utility> #include "parse/Parse.hpp" using namespace parse; using std::cout; class TreePrinter : public tree::TermVisitor { public: virtual void acceptTerm(const tree::Abstraction& term) override { cout << "(^"; for (const std::string& a...
11e07722-b50a-46f2-97f1-d75f093354e3
{ "language": "C++" }
```c++ /* BZWorkbench * Copyright (c) 1993 - 2008 Tim Riker * * This package is free software; you can redistribute it and/or * modify it under the terms of the license found in the file * named COPYING that should have accompanied this file. * * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * ...
```c++ /* BZWorkbench * Copyright (c) 1993 - 2008 Tim Riker * * This package is free software; you can redistribute it and/or * modify it under the terms of the license found in the file * named COPYING that should have accompanied this file. * * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR * ...
09069d85-ec72-4d99-b030-52378a1c8b61
{ "language": "C++" }
```c++ /* * Copyright (C) 2018 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...
```c++ /* * Copyright (C) 2018 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...
3cca8ef9-0d79-4b48-919f-b914bbdd8c3c
{ "language": "C++" }
```c++ #include "queuemanager.h" #include "rdkafka.h" QueueManager::QueueManager(rd_kafka_t *rk) : rk_(rk) { } QueueManager::~QueueManager() { ASSERT(queues_.empty()); } void QueueManager::add(rd_kafka_queue_t* queue) { CritScope ss(&crt_); ASSERT(queues_.find(queue) == queues_.end()); //remove the...
```c++ #include "queuemanager.h" #include "rdkafka.h" QueueManager::QueueManager(rd_kafka_t *rk) : rk_(rk) { } QueueManager::~QueueManager() { ASSERT(queues_.empty()); } void QueueManager::add(rd_kafka_queue_t* queue) { CritScope ss(&crt_); ASSERT(queues_.find(queue) == queues_.end()); //remove the...
1c0313c7-eca9-48da-b967-870ffa95574d
{ "language": "C++" }
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ struct GrGLInterface; const GrGLInterface* GrGLDefaultInterface() { return NULL; } ``` Include GrGLInterface.h instead of forward declaring, since we have to get...
```c++ /* * Copyright 2011 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "GrGLInterface.h" const GrGLInterface* GrGLDefaultInterface() { return NULL; } ```
95583eb6-d448-4124-b792-3e181d27ac21
{ "language": "C++" }
```c++ #include <vector> #include <stdio.h> #include <stdint.h> int main (int argc, char const *argv[], char const *envp[]) { std::vector<int> ints; std::vector<short> shorts; for (int i=0; i<12; i++) { ints.push_back(i); shorts.push_back((short)i); } return 0; } ``` Make th...
```c++ #include <vector> #include <stdio.h> #include <stdint.h> int main (int argc, char const *argv[], char const *envp[]) { std::vector<long> longs; std::vector<short> shorts; for (int i=0; i<12; i++) { longs.push_back(i); shorts.push_back(i); } return 0; } ```
3fbe7673-7b1b-47aa-959a-377389b7cd98
{ "language": "C++" }
```c++ #include "cargoproject.h" #include "cargoprojectnode.h" #include "utils/fileutils.h" #include "cargoprojectmanager.h" #include "cargoprojectfile.h" using namespace Rust; CargoProject::CargoProject(CargoProjectManager* projectManager, QString projectFileName) : projectManager_(projectManager), ...
```c++ #include "cargoproject.h" #include "cargoprojectnode.h" #include "utils/fileutils.h" #include "cargoprojectmanager.h" #include "cargoprojectfile.h" using namespace Rust; CargoProject::CargoProject(CargoProjectManager* projectManager, QString projectFileName) : projectManager_(projectManager), ...
94470f4c-2da9-4db7-acdb-c4a65809fc10
{ "language": "C++" }
```c++ // 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 "chrome/browser/net/async_dns_field_trial.h" #include "base/metrics/field_trial.h" #include "build/build_config.h" #include "chrome/c...
```c++ // 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 "chrome/browser/net/async_dns_field_trial.h" #include "base/metrics/field_trial.h" #include "build/build_config.h" #include "chrome/c...