#include "JasonType.h"

using JasonType = triagens::basics::JasonType;

////////////////////////////////////////////////////////////////////////////////
/// @brief get the name for a Jason type
////////////////////////////////////////////////////////////////////////////////

char const* triagens::basics::JasonTypeName (JasonType type) {
  switch (type) {
    case JasonType::None:        return "none";
    case JasonType::Null:        return "null";
    case JasonType::Bool:        return "bool";
    case JasonType::Double:      return "double";
    case JasonType::String:      return "string";
    case JasonType::Array:       return "array";
    case JasonType::Object:      return "object";
    case JasonType::External:    return "external";
    case JasonType::ID:          return "id";
    case JasonType::ArangoDB_id: return "arangodb_id";
    case JasonType::UTCDate:     return "utc-date";
    case JasonType::Int:         return "int";
    case JasonType::UInt:        return "uint";
    case JasonType::Binary:      return "binary";
  }

  return "unknown";
}

#include "JasonType.h"

using JasonType = triagens::basics::JasonType;

////////////////////////////////////////////////////////////////////////////////
/// @brief get the name for a Jason type
////////////////////////////////////////////////////////////////////////////////

char const* triagens::basics::JasonTypeName (JasonType type) {
  switch (type) {
    case JasonType::None:        return "none";
    case JasonType::Null:        return "null";
    case JasonType::Bool:        return "bool";
    case JasonType::Double:      return "double";
    case JasonType::String:      return "string";
    case JasonType::Array:       return "array";
    case JasonType::ArrayLong:   return "array_long";
    case JasonType::Object:      return "object";
    case JasonType::ObjectLong:  return "object_long";
    case JasonType::External:    return "external";
    case JasonType::ID:          return "id";
    case JasonType::ArangoDB_id: return "arangodb_id";
    case JasonType::UTCDate:     return "utc-date";
    case JasonType::Int:         return "int";
    case JasonType::UInt:        return "uint";
    case JasonType::Binary:      return "binary";
  }

  return "unknown";
}

Add long types to names.

Add long types to names.


#include "MiNodePIR.h"

MiNodePIR::MiNodePIR() :
pin(NULL)
{
  this->baseId = MINODE_ID_MODULE_PIR;
}

MiNodePIR::~MiNodePIR()
{
  if(pin) {
    delete pin;
  }
}

void MiNodePIR::attach(ConnName connName)
{
  if(this->cn != MN_NC) {
    return;
  }

  MiNodeComponent::initConnector(connName);

  PinName pinName = MiNodeConn::calcP0Name(this->cn);
  if(pin) {
    delete pin;
  }
  pin = new InterruptIn(pinName);
  pin->mode(PullNone);
  pin->rise(this, &MiNodePIR::onTrigger);
}

int MiNodePIR::isTriged()
{
  int temp=0;
  int i;
  for (int i = 0; i < 10; ++i)
  {
    temp += readPir();
  }
  if(temp > 8)
    return 1;
  else
    return 0;
}

void MiNodePIR::onTrigger()
{
  MicroBitEvent evt(this->baseId + this->id,MINODE_PIR_EVT_TRIG);
}

int MiNodePIR::readPir()
{
	return pin->read();
}

#include "MiNodePIR.h"

MiNodePIR::MiNodePIR() :
pin(NULL)
{
  this->baseId = MINODE_ID_MODULE_PIR;
}

MiNodePIR::~MiNodePIR()
{
  if(pin) {
    delete pin;
  }
}

void MiNodePIR::attach(ConnName connName)
{
  if(this->cn != MN_NC) {
    return;
  }

  MiNodeComponent::initConnector(connName);

  PinName pinName = MiNodeConn::calcP0Name(this->cn);
  if(pin) {
    delete pin;
  }
  pin = new InterruptIn(pinName);
  pin->mode(PullNone);
  pin->rise(this, &MiNodePIR::onTrigger);
}

int MiNodePIR::isTriged()
{
  int temp=0;
  int i;
  for (int i = 0; i < 1000; ++i)
  {
    temp += readPir();
  }
  if(temp > 900)
    return 1;
  else
    return 0;
}

void MiNodePIR::onTrigger()
{
  MicroBitEvent evt(this->baseId + this->id,MINODE_PIR_EVT_TRIG);
}

int MiNodePIR::readPir()
{
	return pin->read();
}

Modify the trigger condition of PIR

Modify the trigger condition of PIR


// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: echo '[{"directory":".","command":"clang++ -c %t/test.cpp","file":"%t/test.cpp"}]' > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
// RUN: PWD="%t" clang-check "%t" "test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.

// CHECK: C++ requires
invalid;

// FIXME: JSON doesn't like path separator '\', on Win32 hosts.
// FIXME: clang-check doesn't like gcc driver on cygming.
// XFAIL: cygwin,mingw32,win32

// RUN: rm -rf %t
// RUN: mkdir %t
// RUN: echo "[{\"directory\":\".\",\"command\":\"clang++ -c %t/test.cpp\",\"file\":\"%t/test.cpp\"}]" > %t/compile_commands.json
// RUN: cp "%s" "%t/test.cpp"
// RUN: PWD="%t" clang-check "%t" "test.cpp" 2>&1|FileCheck %s
// FIXME: Make the above easier.

// CHECK: C++ requires
invalid;

// FIXME: JSON doesn't like path separator '\', on Win32 hosts.
// FIXME: clang-check doesn't like gcc driver on cygming.
// XFAIL: cygwin,mingw32,win32

Fix quoting to allow shell expansion to occur for shell variables
introduced by the test harness' expansion of %t.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@154443 91177308-0d34-0410-b5e6-96231b3b80d8


// C++11 code with initializers.
//
// g++     -std=c++11 -pedantic -fsyntax-only cpp11.cpp
// clang++ -std=c++11 -pedantic -fsyntax-only cpp11.cpp

struct A {
    int i = 0;
    double j = 0.0;
};

int main() {
    A a;            // OK, a.i is 0 and a.j is 0.0
    A b = {};       // OK, b.i is 0 and b.j is 0.0
    A c = {1};      // FAIL (compilation error)
    A d = {1, 2.0}; // FAIL (compilation error)
    // GCC:
    //   error: could not convert ‘{1}’ from ‘<brace-enclosed initializer list>’ to ‘A’
    //   error: could not convert ‘{1, 2.0e+0}’ from ‘<brace-enclosed initializer list>’ to ‘A’
    //
    // Clang:
    //   error: no matching constructor for initialization of 'A'
    return 0;
}

// C++11 code with initializers.
//
// g++     -std=c++11 -pedantic -fsyntax-only cpp11.cpp
// clang++ -std=c++11 -pedantic -fsyntax-only cpp11.cpp

struct A {
    int i = 0;
    double j = 0.0;
};

int main() {
    A a;            // OK, a.i is 0 and a.j is 0.0
    A b = {};       // OK, b.i is 0 and b.j is 0.0
    A c = {1};      // FAIL (compilation error)
    A d = {1, 2.0}; // FAIL (compilation error)
    // GCC:
    //   error: could not convert '{1}' from '<brace-enclosed initializer list>' to 'A'
    //   error: could not convert '{1, 2.0e+0}' from '<brace-enclosed initializer list>' to 'A'
    //
    // Clang:
    //   error: no matching constructor for initialization of 'A'
    return 0;
}

en-2015-10-03: Replace non-ASCII quotes from GCC with ASCII quotes.


#include <QApplication>
#include <QDeclarativeView>
#include <QUrl>

int main(int argc, char** argv)
{
    // FIXME: Use the (new?) harmattan booster!!
    QApplication app(argc, argv);

    QDeclarativeView viewer;
    viewer.setSource(QUrl("qrc:/qml/main.qml"));
    viewer.showFullScreen();

    return app.exec();
}

#include <QApplication>
#include <QDeclarativeView>
#include <QUrl>
#include <MDeclarativeCache>

Q_DECL_EXPORT int main(int argc, char** argv)
{
    QApplication* app = MDeclarativeCache::qApplication(argc, argv);

    QDeclarativeView viewer;
    viewer.setSource(QUrl("qrc:/qml/main.qml"));
    viewer.showFullScreen();

    return app->exec();
}

Make luna app boostable to reduce the start up time.


// RUN: %clangxx -O0 %s -o %t && %run %t
// XFAIL: arm-linux-gnueabi

#include <assert.h>
#include <pthread.h>

int main(void) {
  pthread_mutexattr_t ma;
  int res = pthread_mutexattr_init(&ma);
  assert(res == 0);
  res = pthread_mutexattr_setpshared(&ma, 1);
  assert(res == 0);
  int pshared;
  res = pthread_mutexattr_getpshared(&ma, &pshared);
  assert(res == 0);
  assert(pshared == 1);
  res = pthread_mutexattr_destroy(&ma);
  assert(res == 0);
  return 0;
}

// RUN: %clangxx -O0 %s -o %t && %run %t

#include <assert.h>
#include <pthread.h>

int main(void) {
  pthread_mutexattr_t ma;
  int res = pthread_mutexattr_init(&ma);
  assert(res == 0);
  res = pthread_mutexattr_setpshared(&ma, 1);
  assert(res == 0);
  int pshared;
  res = pthread_mutexattr_getpshared(&ma, &pshared);
  assert(res == 0);
  assert(pshared == 1);
  res = pthread_mutexattr_destroy(&ma);
  assert(res == 0);
  return 0;
}

Remove ARM XFAIL from passing test

Remove ARM XFAIL from passing test

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@211608 91177308-0d34-0410-b5e6-96231b3b80d8


/**
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#include "Color.h"

namespace facebook {
namespace react {

SharedColor colorFromComponents(ColorComponents components) {
  return SharedColor(
    ((int)components.alpha & 0xff) << 24 |
    ((int)components.red & 0xff) << 16 |
    ((int)components.green & 0xff) << 8 |
    ((int)components.blue & 0xff)
  );
}

ColorComponents colorComponentsFromColor(SharedColor sharedColor) {
  Color color = *sharedColor;
  return ColorComponents {
    (float)((color >> 16) & 0xff),
    (float)((color >>  8) & 0xff),
    (float)((color      ) & 0xff),
    (float)((color >> 24) & 0xff)
  };
}

} // namespace react
} // namespace facebook

/**
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#include "Color.h"

namespace facebook {
namespace react {

SharedColor colorFromComponents(ColorComponents components) {
  float ratio = 255.9999;
  return SharedColor(
    ((int)(components.alpha * ratio) & 0xff) << 24 |
    ((int)(components.red * ratio) & 0xff) << 16 |
    ((int)(components.green * ratio) & 0xff) << 8 |
    ((int)(components.blue * ratio) & 0xff)
  );
}

ColorComponents colorComponentsFromColor(SharedColor sharedColor) {
  float ratio = 256;
  Color color = *sharedColor;
  return ColorComponents {
    (float)((color >> 16) & 0xff) / ratio,
    (float)((color >>  8) & 0xff) / ratio,
    (float)((color      ) & 0xff) / ratio,
    (float)((color >> 24) & 0xff) / ratio
  };
}

} // namespace react
} // namespace facebook

Fix color conversions for android

Fix color conversions for android

Summary: This diff fixes the color conversions for Android

Reviewed By: shergin

Differential Revision: D9093561

fbshipit-source-id: a17e61c58be511bd463dc0b21b632dc24066b8b6


#include "Arduino.h"
#include "LightModel.h"

const byte LightModel::RED_ON = 0x1;
const byte LightModel::AMBER_ON = 0x2;
const byte LightModel::GREEN_ON = 0x4;

LightModel::LightModel()
  : state(0)
{
}

// typical AMBER light is 5 seconds
void LightModel::setup()
{
    // Set digital pins 3, 4, and 5 to be output.
    DDRD = B00011100;
    // Set all values low
    PORTD = 0;
}

// The state is only expecting a value between 0 and 7.  We'll
// bitshift it over twice to match our input.
void LightModel::setState(byte newState)
{
    state = newState << 2;

    PORTD = state;
}

#include "Arduino.h"
#include "LightModel.h"

const byte LightModel::RED_ON = 0x1;
const byte LightModel::AMBER_ON = 0x2;
const byte LightModel::GREEN_ON = 0x4;

LightModel::LightModel()
  : state(0)
{
}

// typical AMBER light is 5 seconds
void LightModel::setup()
{
    // Set digital pins 4, 5, 6, and 7 to be output
    DDRD = B01111000;

    // Set all values low
    PORTD = 0;
}

// The state is only expecting a value between 0 and 7.  We'll
// bitshift it over twice to match our input.
void LightModel::setState(byte newState)
{
    state = newState << 3;

    PORTD = state;
}

Change code to match expectations of SeeedStudio's relaysheld v1.3


// 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 "base/test/test_suite.h"
#include "media/base/media.h"

int main(int argc, char** argv) {
  base::TestSuite suite(argc, argv);

  media::InitializeMediaLibraryForTesting();

  return suite.Run();
}

// 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 "base/at_exit.h"
#include "base/command_line.h"
#include "base/logging.h"
#include "base/test/test_suite.h"
#include "media/base/media.h"

class TestSuiteNoAtExit : public base::TestSuite {
 public:
  TestSuiteNoAtExit(int argc, char** argv) : TestSuite(argc, argv, false) {}
  virtual ~TestSuiteNoAtExit() {}
};

int main(int argc, char** argv) {
  // By default command-line parsing happens only in TestSuite::Run(), but
  // that's too late to get VLOGs and so on from
  // InitializeMediaLibraryForTesting() below.  Instead initialize logging
  // explicitly here (and have it get re-initialized by TestSuite::Run()).
  CommandLine::Init(argc, argv);
  CHECK(logging::InitLogging(
      NULL,
      logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG,
      logging::DONT_LOCK_LOG_FILE,
      logging::APPEND_TO_OLD_LOG_FILE,
      logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS));
  base::AtExitManager exit_manager;

  media::InitializeMediaLibraryForTesting();

  return TestSuiteNoAtExit(argc, argv).Run();
}

Initialize logging early enough to see VLOGs emitted by InitializeMediaLibraryForTesting().
(specifically, this makes ffmpeg_stubs.cc VLOGs actually get emitted if -v=1 is specified)

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/9320048

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@120345 0039d316-1c4b-4281-b951-d872f2087c98


Fix that bug where things didn't work but now they should


#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    //These things are used by QSettings to set up setting storage
    a.setOrganizationName("EVTV");
    a.setApplicationName("SavvyCAN");
    a.setOrganizationDomain("evtv.me");
    QSettings::setDefaultFormat(QSettings::IniFormat);

    MainWindow w;

    QSettings settings;
    int fontSize = settings.value("Main/FontSize", 9).toUInt();
    QFont sysFont = QFont(); //get default font
    sysFont.setPointSize(fontSize);
    a.setFont(sysFont);

    w.show();

    return a.exec();
}

#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    //Add a local path for Qt extensions, to allow for per-application extensions.
    a.addLibraryPath("plugins");

    //These things are used by QSettings to set up setting storage
    a.setOrganizationName("EVTV");
    a.setApplicationName("SavvyCAN");
    a.setOrganizationDomain("evtv.me");
    QSettings::setDefaultFormat(QSettings::IniFormat);

    MainWindow w;

    QSettings settings;
    int fontSize = settings.value("Main/FontSize", 9).toUInt();
    QFont sysFont = QFont(); //get default font
    sysFont.setPointSize(fontSize);
    a.setFont(sysFont);

    w.show();

    return a.exec();
}

Enable support for local plugins

Enable support for local plugins


//===- lib/ReaderWriter/CoreLinkingContext.cpp ----------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
#include "lld/Core/Pass.h"
#include "lld/Core/PassManager.h"
#include "lld/Core/Simple.h"
#include "lld/ReaderWriter/CoreLinkingContext.h"
#include "llvm/ADT/ArrayRef.h"

using namespace lld;

namespace {

class OrderPass : public Pass {
public:
  /// Sorts atoms by position
  std::error_code perform(SimpleFile &file) override {
    SimpleFile::DefinedAtomRange defined = file.definedAtoms();
    std::sort(defined.begin(), defined.end(), DefinedAtom::compareByPosition);
    return std::error_code();
  }
};

} // anonymous namespace

CoreLinkingContext::CoreLinkingContext() {}

bool CoreLinkingContext::validateImpl(raw_ostream &) {
  _writer = createWriterYAML(*this);
  return true;
}

void CoreLinkingContext::addPasses(PassManager &pm) {
  for (StringRef name : _passNames) {
    assert(name == "order" && "bad pass name");
    pm.add(std::unique_ptr<Pass>(new OrderPass()));
  }
}

Writer &CoreLinkingContext::writer() const { return *_writer; }

//===- lib/ReaderWriter/CoreLinkingContext.cpp ----------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include "lld/Core/DefinedAtom.h"
#include "lld/Core/File.h"
#include "lld/Core/Pass.h"
#include "lld/Core/PassManager.h"
#include "lld/Core/Simple.h"
#include "lld/ReaderWriter/CoreLinkingContext.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/STLExtras.h"

using namespace lld;

namespace {

class OrderPass : public Pass {
public:
  /// Sorts atoms by position
  std::error_code perform(SimpleFile &file) override {
    SimpleFile::DefinedAtomRange defined = file.definedAtoms();
    std::sort(defined.begin(), defined.end(), DefinedAtom::compareByPosition);
    return std::error_code();
  }
};

} // anonymous namespace

CoreLinkingContext::CoreLinkingContext() {}

bool CoreLinkingContext::validateImpl(raw_ostream &) {
  _writer = createWriterYAML(*this);
  return true;
}

void CoreLinkingContext::addPasses(PassManager &pm) {
  for (StringRef name : _passNames) {
    (void)name;
    assert(name == "order" && "bad pass name");
    pm.add(llvm::make_unique<OrderPass>());
  }
}

Writer &CoreLinkingContext::writer() const { return *_writer; }

Fix no-asserts build failure due to unused variable, and cleanup some unique_ptr usage while I'm here

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@240169 91177308-0d34-0410-b5e6-96231b3b80d8


// 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"

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Storage) {
  ASSERT_TRUE(RunExtensionTest("storage")) << message_;
}

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Cookies) {
  ASSERT_TRUE(RunExtensionTest("cookies")) << message_;
}

// 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"

#if defined(OS_LINUX)
// See http://crbug.com/42943.
#define MAYBE_Storage FLAKY_Storage
#else
#define MAYBE_Storage Storage
#endif

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, MAYBE_Storage) {
  ASSERT_TRUE(RunExtensionTest("storage")) << message_;
}

IN_PROC_BROWSER_TEST_F(ExtensionApiTest, Cookies) {
  ASSERT_TRUE(RunExtensionTest("cookies")) << message_;
}

[Linux] Mark ExtensionApiTest.Storage as flaky.
BUG=42943
TEST=none
TBR=rafaelw

Review URL: http://codereview.chromium.org/1810012

git-svn-id: http://src.chromium.org/svn/trunk/src@46083 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: d24d18b9e3f4f98bd820ae1f25a7c9b5c5fac0f3


/*
 * opencog/atoms/core/Checkers.cc
 *
 * Copyright (C) 2017 Linas Vepstas
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <opencog/atoms/base/Atom.h>
#include <opencog/atoms/base/ClassServer.h>

using namespace opencog;

bool check_evaluatable(const Handle& bool_atom)
{
	return true;
}

/* This runs when the shared lib is loaded. */
static __attribute__ ((constructor)) void init(void)
{
	classserver().addValidator(BOOLEAN_LINK, check_evaluatable);
}

/*
 * opencog/atoms/core/Checkers.cc
 *
 * Copyright (C) 2017 Linas Vepstas
 * All Rights Reserved
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include <opencog/atoms/base/Atom.h>
#include <opencog/atoms/base/ClassServer.h>

using namespace opencog;

/// Check to see if every input atom is of Evaluatable type.
bool check_evaluatable(const Handle& bool_atom)
{
	for (const Handle& h: bool_atom->getOutgoingSet())
	{
		if (not h->is_type(EVALUATABLE_LINK)) return false;
	}
	return true;
}

/* This runs when the shared lib is loaded. */
static __attribute__ ((constructor)) void init(void)
{
	classserver().addValidator(BOOLEAN_LINK, check_evaluatable);
}

Add type checking for boolean link types.


#pragma once

#include "CylindersWrapperCodec.h"

namespace spotify
{
namespace json
{

using CylindersWrapper = noise::module::Wrapper<noise::module::Cylinders>;

codec::object_t<CylindersWrapper> default_codec_t<CylindersWrapper>::codec()
    {
        auto codec = codec::object<CylindersWrapper>();
        codec.required("type", codec::eq<std::string>("Cylinders"));
        codec.required("SourceModule", codec::ignore_t<int>());
        codec.optional("Frequency",
                       [](const CylindersWrapper& mw) {return mw.module->GetFrequency(); },
                       [](CylindersWrapper& mw, double frequency) {mw.module->SetFrequency(frequency); });
        return codec;
    }

}
}

#pragma once

#include "CylindersWrapperCodec.h"

namespace spotify
{
namespace json
{

using CylindersWrapper = noise::module::Wrapper<noise::module::Cylinders>;

codec::object_t<CylindersWrapper> default_codec_t<CylindersWrapper>::codec()
    {
        auto codec = codec::object<CylindersWrapper>();
        codec.required("type", codec::eq<std::string>("Cylinders"));
        codec.optional("Frequency",
                       [](const CylindersWrapper& mw) {return mw.module->GetFrequency(); },
                       [](CylindersWrapper& mw, double frequency) {mw.module->SetFrequency(frequency); });
        return codec;
    }

}
}

Remove spurious required field from Cylinders codec


//=======================================================================
// Copyright Baptiste Wicht 2011.
// 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 <string>

#include "Types.hpp"
#include "CompilerException.hpp"

using namespace eddic;

int eddic::size(Type type){
    return type == Type::INT ? 4 : 8;
}

bool eddic::isType(std::string type){
    return type == "int" || type == "void" || type == "string";
}

Type eddic::stringToType(std::string type){
    if (type == "int") {
        return Type::INT;
    } else if (type == "string"){
        return Type::STRING;
    } else if(type == "void") {
        return Type::VOID;
    }

    throw CompilerException("Invalid type");
}

//=======================================================================
// Copyright Baptiste Wicht 2011.
// 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 <string>

#include "Types.hpp"
#include "CompilerException.hpp"

using namespace eddic;

const int typeSizes[(int) Type::COUNT] = { 8, 4, 0 };

int eddic::size(Type type){
    return typeSizes[(int) type];
}

bool eddic::isType(std::string type){
    return type == "int" || type == "void" || type == "string";
}

Type eddic::stringToType(std::string type){
    if (type == "int") {
        return Type::INT;
    } else if (type == "string"){
        return Type::STRING;
    } else if(type == "void") {
        return Type::VOID;
    }

    throw CompilerException("Invalid type");
}

Use an array to store the size of the types


//===-- llvm/CodeGen/DwarfWriter.cpp - Dwarf Framework ----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under the
// University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains support for writing dwarf debug info into asm files.
//
//===----------------------------------------------------------------------===//

#include "llvm/CodeGen/DwarfWriter.h"

Add an eol at the end to shut gcc sup.

Add an eol at the end to shut gcc sup.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@24926 91177308-0d34-0410-b5e6-96231b3b80d8


//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: libcpp-has-no-threads

// [[nodiscard]] on constructors isn't supported by all compilers
// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
// UNSUPPORTED: apple-clang-9, apple-clang-10, apple-clang-11

// <mutex>

// template <class Mutex> class lock_guard;

// [[nodiscard]] explicit lock_guard(mutex_type& m);
// [[nodiscard]] lock_guard(mutex_type& m, adopt_lock_t);

// Test that we properly apply [[nodiscard]] to lock_guard's constructors,
// which is a libc++ extension.

// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
#define _LIBCPP_ENABLE_NODISCARD
#include <mutex>

int main(int, char**) {
    std::mutex m;
    std::lock_guard<std::mutex>{m}; // expected-error{{ignoring temporary created by a constructor declared with 'nodiscard' attribute}}
    std::lock_guard<std::mutex>{m, std::adopt_lock}; // expected-error{{ignoring temporary created by a constructor declared with 'nodiscard' attribute}}
    return 0;
}

//===----------------------------------------------------------------------===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

// UNSUPPORTED: libcpp-has-no-threads

// [[nodiscard]] on constructors isn't supported by all compilers
// UNSUPPORTED: clang-6, clang-7, clang-8, clang-9
// UNSUPPORTED: apple-clang-9, apple-clang-10, apple-clang-11

// [[nodiscard]] isn't supported in C++98 and C++03 (not even as an extension)
// UNSUPPORTED: c++98, c++03

// <mutex>

// template <class Mutex> class lock_guard;

// [[nodiscard]] explicit lock_guard(mutex_type& m);
// [[nodiscard]] lock_guard(mutex_type& m, adopt_lock_t);

// Test that we properly apply [[nodiscard]] to lock_guard's constructors,
// which is a libc++ extension.

// MODULES_DEFINES: _LIBCPP_ENABLE_NODISCARD
#define _LIBCPP_ENABLE_NODISCARD
#include <mutex>

int main(int, char**) {
    std::mutex m;
    std::lock_guard<std::mutex>{m}; // expected-error{{ignoring temporary created by a constructor declared with 'nodiscard' attribute}}
    std::lock_guard<std::mutex>{m, std::adopt_lock}; // expected-error{{ignoring temporary created by a constructor declared with 'nodiscard' attribute}}
    return 0;
}

[libc++] Mark lock_guard nodiscard test as unsupported in C++03

git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@369672 91177308-0d34-0410-b5e6-96231b3b80d8


#include "./video_recorder_controller.h"
#include <QDateTime>
#include "./video_recorder.h"

VideoRecorderController::VideoRecorderController(
    std::shared_ptr<VideoRecorder> videoRecorder)
  : videoRecorder(videoRecorder)
{
  connect(this, SIGNAL(toggleRecording()), this,
          SLOT(toggleRecordingInMainThread()), Qt::QueuedConnection);
}

void VideoRecorderController::startNewVideo()
{
  const QDateTime now = QDateTime::currentDateTime();
  const QString timestamp = now.toString(QLatin1String("yyyy-MM-dd-hhmmsszzz"));
  auto filename = QString::fromLatin1("video_%1.mpeg").arg(timestamp);

  videoRecorder->createNewVideo(filename.toStdString());
  videoRecorder->startRecording();
}

QString VideoRecorderController::getToggleText()
{
  if (videoRecorder->getIsRecording())
    return "Stop recording";

  return "Start recording";
}

void VideoRecorderController::toggleRecordingInMainThread()
{
  if (videoRecorder->getIsRecording())
  {
    videoRecorder->stopRecording();
  }
  else
  {
    videoRecorder->startRecording();
  }

  emit recordingStateSwitched();
}

#include "./video_recorder_controller.h"
#include <QDateTime>
#include "./video_recorder.h"

VideoRecorderController::VideoRecorderController(
    std::shared_ptr<VideoRecorder> videoRecorder)
  : videoRecorder(videoRecorder)
{
  connect(this, SIGNAL(toggleRecording()), this,
          SLOT(toggleRecordingInMainThread()), Qt::QueuedConnection);
}

void VideoRecorderController::startNewVideo()
{
  const QDateTime now = QDateTime::currentDateTime();
  const QString timestamp = now.toString(QLatin1String("yyyy-MM-dd-hhmmsszzz"));
  auto filename = QString::fromLatin1("video_%1.mpeg").arg(timestamp);

  videoRecorder->createNewVideo(filename.toStdString());
  videoRecorder->startRecording();

  emit recordingStateSwitched();
}

QString VideoRecorderController::getToggleText()
{
  if (videoRecorder->getIsRecording())
    return "Stop recording";

  return "Start recording";
}

void VideoRecorderController::toggleRecordingInMainThread()
{
  if (videoRecorder->getIsRecording())
  {
    videoRecorder->stopRecording();
  }
  else
  {
    videoRecorder->startRecording();
  }

  emit recordingStateSwitched();
}

Fix toggle text after first video recording start.


/*
 * Copyright 2011 Intel Corporation.
 *
 * This program is licensed under the terms and conditions of the
 * Apache License, version 2.0.  The full text of the Apache License is at
 * http://www.apache.org/licenses/LICENSE-2.0
 */

#include <glib-object.h>
#include <QDir>

#include "components.h"
#include "launcher.h"
#include "roundedimage.h"
#include "viewfinder.h"
#include "zoomarea.h"

components::components ()
{
  // Initialise the GObject type system
  g_type_init ();

  if (QDir::home ().mkpath ("Pictures/Camera") == false) {
    qDebug () << "Error making camera directory: " << QDir::homePath () << "/Pictures/Camera";
  }

  if (QDir::home ().mkpath ("Videos/Camera") == false) {
    qDebug () << "Error making camera directory: " << QDir::homePath () << "/Pictures/Camera";
  }
}

void components::registerTypes(const char *uri)
{
  qmlRegisterType<Launcher>(uri, 0, 1, "Launcher");
  qmlRegisterType<RoundedImage>(uri, 0, 1, "RoundedImage");
  qmlRegisterType<ViewFinder>(uri, 0, 1, "ViewFinder");
  qmlRegisterType<ZoomArea>(uri, 0, 1, "ZoomArea");
}

Q_EXPORT_PLUGIN(components);

/*
 * Copyright 2011 Intel Corporation.
 *
 * This program is licensed under the terms and conditions of the
 * Apache License, version 2.0.  The full text of the Apache License is at
 * http://www.apache.org/licenses/LICENSE-2.0
 */

#include <glib-object.h>
#include <QDir>

#include "components.h"
#include "launcher.h"
#include "roundedimage.h"
#include "viewfinder.h"

components::components ()
{
  // Initialise the GObject type system
  g_type_init ();

  if (QDir::home ().mkpath ("Pictures/Camera") == false) {
    qDebug () << "Error making camera directory: " << QDir::homePath () << "/Pictures/Camera";
  }

  if (QDir::home ().mkpath ("Videos/Camera") == false) {
    qDebug () << "Error making camera directory: " << QDir::homePath () << "/Pictures/Camera";
  }
}

void components::registerTypes(const char *uri)
{
  qmlRegisterType<Launcher>(uri, 0, 1, "Launcher");
  qmlRegisterType<RoundedImage>(uri, 0, 1, "RoundedImage");
  qmlRegisterType<ViewFinder>(uri, 0, 1, "ViewFinder");
}

Q_EXPORT_PLUGIN(components);

[Components] Remove the unused ZoomArea from the elements