code
stringlengths
3
1.05M
repo_name
stringlengths
4
116
path
stringlengths
3
942
language
stringclasses
30 values
license
stringclasses
15 values
size
int32
3
1.05M
/* Copyright (c) 2014, Aalborg University All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of the <organization> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ using System; using System.Collections.Generic; using System.Linq; using System.Text; using Microsoft.Phone.Controls; using SmartCampusWebMap.RadiomapBackend; //extension metoder using SmartCampusWebMap.Library.ModelExtensions.Indoormodel.Graph; namespace SmartCampusWebMap.Javascript { public static class JSInterface { //OK-I GUESS public static void centerAt(WebBrowser target, double lat, double lon) { if (target == null) return; //string[] args = new string[] { lat.ToString(), lon.ToString() }; //target.InvokeScript("centerAt", args); try { target.InvokeScript("eval", "centerAt(" + lat + ", " + lon + ")"); } catch (SystemException ex) { System.Windows.MessageBox.Show(string.Format("{0} \n {1}", ex.Message, ex.StackTrace)); } } //OK-I GUESS /** * This method is used (or rather CAN be used) for clearing the overlays (markers) on the map * @param target */ public static void clearOverlays(WebBrowser target) { if (target == null) return; //target.InvokeScript("UI_ClearOverlays"); target.InvokeScript("eval", "clearOverlays()"); //target.loadUrl("javascript:UI_ClearOverlays()"); } //OK private static String createFoliaJsonEdge(Edge e) { Vertex origin = e.Vertices[0]; Vertex destination = e.Vertices[1]; AbsoluteLocation absLoc = origin.AbsoluteLocations[0]; StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("endpoint1: { "); sb.Append(" id: ").Append(origin.ID); sb.Append(", lat: ").Append(absLoc.latitude); sb.Append(", lon: ").Append(absLoc.longitude); sb.Append(" }, "); absLoc = destination.AbsoluteLocations[0]; sb.Append("endpoint2: { "); sb.Append(" id: ").Append(destination.ID); sb.Append(", lat: ").Append(absLoc.latitude); sb.Append(", lon: ").Append(absLoc.longitude); sb.Append(" } "); sb.Append("}"); return sb.ToString(); } private static String createFoliaJsonLocation(Vertex v) { if (v == null) return "null"; AbsoluteLocation absLoc = v.AbsoluteLocations[0]; SymbolicLocation symLoc = null; foreach (SymbolicLocation s in v.SymbolicLocations) { symLoc = s; break; } //[ // {id: , latitude: , longitude: , altitude: , title: , description: , url: , location_type: } // ] StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("id: ").Append(v.ID); sb.Append(", latitude: ").Append(absLoc.latitude); sb.Append(", longitude: ").Append(absLoc.longitude); sb.Append(", altitude: ").Append(absLoc.altitude); String title = symLoc != null ? symLoc.title : "null"; sb.Append(", title: ").Append("'").Append(title).Append("'"); String description = symLoc != null ? symLoc.description : "null"; sb.Append(", description: ").Append("'").Append(description).Append("'"); String url = symLoc != null ? symLoc.url : "null"; sb.Append(", url: ").Append("'").Append(url).Append("'"); sb.Append(", location_type: ").Append(symLoc != null ? symLoc.info_type : -1); //ToString capitalizes boolean, so necessary to call toLower string isStair = v.isStairEndpoint().ToString().ToLower(); sb.Append(", isStairEndpoint: ").Append(isStair); string isElevator = v.isElevatorEndpoint().ToString().ToLower(); sb.Append(", isElevatorEndpoint: ").Append(isElevator); string isEntrance = (symLoc != null && (symLoc.is_entrance ?? false)).ToString().ToLower(); sb.Append(", isEntrance: ").Append(isEntrance); sb.Append("}"); return sb.ToString(); } private static String createFoliaJsonLocationJava(Vertex v) { if (v == null) return "null"; AbsoluteLocation absLoc = v.AbsoluteLocations[0]; SymbolicLocation symLoc = null; foreach (SymbolicLocation s in v.SymbolicLocations) { symLoc = s; break; } StringBuilder sb = new StringBuilder(); sb.Append("{"); sb.Append("id: ").Append(v.ID); sb.Append(", latitude: ").Append(absLoc.latitude); sb.Append(", longitude: ").Append(absLoc.longitude); sb.Append(", altitude: ").Append(absLoc.altitude); String title = symLoc != null ? symLoc.title : "null"; sb.Append(", title: ").Append("\"").Append(title).Append("\""); String description = symLoc != null ? symLoc.description : "null"; sb.Append(", description: ").Append("\"").Append(description).Append("\""); String url = symLoc != null ? symLoc.url : "null"; sb.Append(", url: ").Append("\"").Append(url).Append("\""); //sb.append(", location_type: ").append(symLoc != null ? symLoc.getType().toString() : "N/A"); sb.Append(", location_type: ").Append(symLoc != null ? symLoc.info_type ?? -1 : -1); string isStairEndpoint = v.isStairEndpoint().ToString().ToLower(); sb.Append(", isStairEndpoint: ").Append(isStairEndpoint); string isElevatorEndpoint = v.isElevatorEndpoint().ToString().ToLower(); sb.Append(", isElevatorEndpoint: ").Append(isElevatorEndpoint); string isEntrance = (symLoc != null ? symLoc.is_entrance : false).ToString().ToLower(); sb.Append(", isEntrance: ").Append(isEntrance); sb.Append("}"); return sb.ToString(); } //OK-I GUESS /** * This method deselected an endpoint in the add/remove webview */ public static void removeEndpoint(WebBrowser target, int vertexId) { if (target == null) return; target.InvokeScript("eval", "removeEndpoint(" + vertexId + ")"); //target.loadUrl("javascript:removeEndpoint(" + vertexId + ")"); } //NOT TESTED public static void search(WebBrowser target, String query) { if (target == null) return; target.InvokeScript("eval", "search('" + query + "')"); //target.loadUrl("javascript:search('" + query + "')"); } //NOT TESTED - afhængig af UI_ShowVertices /** * This method is called when a user selects an endpoint in the add/remove webview * @param vertexId */ public static void setEndpoint(WebBrowser target, int vertexId) { if (target == null) return; target.InvokeScript("eval", "setEndpoint(" + vertexId + ")"); //target.loadUrl("javascript:setEndpoint(" + vertexId + ")"); } //NOT TESTED - har ingen knap /** * Tells whether we are tracking the user's current position, i.curEdge., if we want the map to center around it. * @param target * @param doTrack */ public static void setIsTracking(WebBrowser target, bool doTrack) { if (target == null) return; target.InvokeScript("eval", "setIsTracking(\"" + doTrack.ToString() + "\")"); //target.loadUrl("javascript:setIsTracking(\"" + stringTrack + "\")"); } //NOT TESTED - bruges vist ikke pt. /** * Tells what the current provider is. If the provider is none - we can remove the estimate-circle. * @param target * @param Status */ public static void setProviderStatus(WebBrowser target, int status) { if (target == null) return; target.InvokeScript("eval", "setProviderStatus('" + status + "')"); //target.loadUrl("javascript:setProviderStatus('" + Status + "')"); } //OK /** * HACK: Building is not necessary; floor number is hardcoded * This method sends the edges that needs to be shown on a map. * NOTE: The floorNum and isOnline parameters may very well be redundant * To use curEdge.Vertices update all existing links and change Android/iPhone so an actual link is added. */ public static void showEdges(WebBrowser target, IEnumerable<Edge> edges, int floorNum) { if (target == null) return; String result; if (edges == null) result = "[]"; //this is the default json if no edges are available else { StringBuilder foliaEdges = new StringBuilder(); foliaEdges.Append("["); bool firstElem = true; foreach (Edge e in edges) { if (!firstElem) foliaEdges.Append(", "); firstElem = false; foliaEdges.Append(JSInterface.createFoliaJsonEdge(e)); } foliaEdges.Append("]"); result = foliaEdges.ToString(); } try { //Load the edges target.InvokeScript("eval", "showEdges(" + floorNum + ", " + result + ")"); //target.loadUrl("javascript:showEdges(" + floorNum + ", " + result + ")"); } catch (Exception ex) { string msg = ex.Message; msg = ex.InnerException != null ? msg + ex.InnerException.Message : msg; System.Windows.MessageBox.Show(msg); } } //OK //Show selected location (for new signal strength measurement) (with sniper icon) public static void showSelectedLocation(WebBrowser target, double lat, double lon) { if (target == null) return; target.InvokeScript("eval", "showSelectedLocation(" + lat + ", " + lon + ")"); //target.loadUrl("javascript:showSelectedLocation(" + lat + ", " + lon + ")"); } public static void showVertices(WebBrowser browser, IEnumerable<Vertex> vertices, int floorNum, bool isOnline) { String result; if (vertices == null) result = "[]"; //this is the default json if no vertices are available else { StringBuilder foliaLocations = new StringBuilder(); foliaLocations.Append("["); bool firstElem = true; foreach (Vertex v in vertices) { if (!firstElem) foliaLocations.Append(", "); firstElem = false; foliaLocations.Append(createFoliaJsonLocationJava(v)); } foliaLocations.Append("]"); result = foliaLocations.ToString(); } //Til debugging: //result = "[{id: 621, latitude: 57.012376850985, longitude: 9.9910009502316, altitude: 0.0, title: 'Aalborg University', description: 'Tag en tur', url: 'no', location_type: 8, isStairEndpoint: false, isElevatorEndpoint: false, isEntrance: false}]"; try { browser.InvokeScript("eval", "addGraphOverlay(" + floorNum + "," + isOnline.ToString().ToLower() + "," + result + ")"); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } } //OK //Show the estimated location and a circle around it denoting the positioning accuracy public static void updateNewLocation(WebBrowser browser, SmartCampusWebMap.WifiSnifferPositioningService.PositionEstimate location) { //Create json location and send it to javascript StringBuilder jsonLoc = new StringBuilder(); jsonLoc.Append("{"); //jsonLoc.Append("hasAltitude: ").Append(location.ha.hasAltitude()).Append(", "); jsonLoc.Append("hasAccuracy: ").Append(location.HasAccuracy).Append(", "); jsonLoc.Append("hasBearing: ").Append(location.HasBearing).Append(", "); jsonLoc.Append("hasSpeed: ").Append(location.HasSpeed).Append(", "); jsonLoc.Append("accuracy: ").Append(location.Accuracy).Append(", "); jsonLoc.Append("bearing: ").Append(location.Bearing).Append(", "); jsonLoc.Append("speed: ").Append(location.Speed).Append(", "); jsonLoc.Append("latitude: ").Append(location.Latitude).Append(", "); jsonLoc.Append("longitude: ").Append(location.Longitude).Append(", "); jsonLoc.Append("altitude: ").Append(location.Altitude); //The last - no comma //jsonLoc.Append("time: ").Append(location.Time); jsonLoc.Append("}"); browser.InvokeScript("eval", "updateNewLocation(" + jsonLoc.ToString() + ")"); //DOES work (but still exception) } //OK //Moves the current select location by the specified number of pixels public static void updateSelectedLocation(WebBrowser target, int xPixels, int yPixels) { if (target == null) return; try { target.InvokeScript("eval", "updateSelectedLocation(" + xPixels + ", " + yPixels + ")"); } catch (Exception ex) { System.Windows.MessageBox.Show(ex.Message); } //target.loadUrl("javascript:updateSelectedLocation(" + xPixels + ", " + yPixels + ")"); } } }
Soufien/SmartCampusAAU
WinPhone/SmartCampusWebMap/Javascript/JSInterface.cs
C#
bsd-3-clause
13,517
from pylab import plot, show, legend import numpy data = numpy.loadtxt("trajectory.gp") x = data[:, 0] y = data[:, 1] plot(x, y, ".", label="trajectory") legend() show()
certik/hermes1d
examples/system_car_model/plot_traj.py
Python
bsd-3-clause
170
// 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 "ash/root_window_controller.h" #include "ash/display/display_manager.h" #include "ash/session/session_state_delegate.h" #include "ash/shelf/shelf_layout_manager.h" #include "ash/shell.h" #include "ash/shell_window_ids.h" #include "ash/system/tray/system_tray_delegate.h" #include "ash/test/ash_test_base.h" #include "ash/test/display_manager_test_api.h" #include "ash/wm/system_modal_container_layout_manager.h" #include "ash/wm/window_properties.h" #include "ash/wm/window_state.h" #include "ash/wm/window_util.h" #include "base/command_line.h" #include "base/memory/scoped_ptr.h" #include "ui/aura/client/focus_change_observer.h" #include "ui/aura/client/focus_client.h" #include "ui/aura/client/window_tree_client.h" #include "ui/aura/env.h" #include "ui/aura/test/test_window_delegate.h" #include "ui/aura/test/test_windows.h" #include "ui/aura/window.h" #include "ui/aura/window_event_dispatcher.h" #include "ui/aura/window_tracker.h" #include "ui/base/ime/dummy_text_input_client.h" #include "ui/base/ime/input_method.h" #include "ui/base/ime/text_input_client.h" #include "ui/base/ime/text_input_focus_manager.h" #include "ui/base/ui_base_switches_util.h" #include "ui/events/test/event_generator.h" #include "ui/events/test/test_event_handler.h" #include "ui/keyboard/keyboard_controller_proxy.h" #include "ui/keyboard/keyboard_switches.h" #include "ui/keyboard/keyboard_util.h" #include "ui/views/controls/menu/menu_controller.h" #include "ui/views/widget/widget.h" #include "ui/views/widget/widget_delegate.h" using aura::Window; using views::Widget; namespace ash { namespace { class TestDelegate : public views::WidgetDelegateView { public: explicit TestDelegate(bool system_modal) : system_modal_(system_modal) {} ~TestDelegate() override {} // Overridden from views::WidgetDelegate: views::View* GetContentsView() override { return this; } ui::ModalType GetModalType() const override { return system_modal_ ? ui::MODAL_TYPE_SYSTEM : ui::MODAL_TYPE_NONE; } private: bool system_modal_; DISALLOW_COPY_AND_ASSIGN(TestDelegate); }; class DeleteOnBlurDelegate : public aura::test::TestWindowDelegate, public aura::client::FocusChangeObserver { public: DeleteOnBlurDelegate() : window_(NULL) {} ~DeleteOnBlurDelegate() override {} void SetWindow(aura::Window* window) { window_ = window; aura::client::SetFocusChangeObserver(window_, this); } private: // aura::test::TestWindowDelegate overrides: bool CanFocus() override { return true; } // aura::client::FocusChangeObserver implementation: void OnWindowFocused(aura::Window* gained_focus, aura::Window* lost_focus) override { if (window_ == lost_focus) delete window_; } aura::Window* window_; DISALLOW_COPY_AND_ASSIGN(DeleteOnBlurDelegate); }; } // namespace namespace test { class RootWindowControllerTest : public test::AshTestBase { public: views::Widget* CreateTestWidget(const gfx::Rect& bounds) { views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( NULL, CurrentContext(), bounds); widget->Show(); return widget; } views::Widget* CreateModalWidget(const gfx::Rect& bounds) { views::Widget* widget = views::Widget::CreateWindowWithContextAndBounds( new TestDelegate(true), CurrentContext(), bounds); widget->Show(); return widget; } views::Widget* CreateModalWidgetWithParent(const gfx::Rect& bounds, gfx::NativeWindow parent) { views::Widget* widget = views::Widget::CreateWindowWithParentAndBounds(new TestDelegate(true), parent, bounds); widget->Show(); return widget; } aura::Window* GetModalContainer(aura::Window* root_window) { return Shell::GetContainer(root_window, ash::kShellWindowId_SystemModalContainer); } }; TEST_F(RootWindowControllerTest, MoveWindows_Basic) { if (!SupportsMultipleDisplays()) return; // Windows origin should be doubled when moved to the 1st display. UpdateDisplay("600x600,300x300"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); RootWindowController* controller = Shell::GetPrimaryRootWindowController(); ShelfLayoutManager* shelf_layout_manager = controller->GetShelfLayoutManager(); shelf_layout_manager->SetAutoHideBehavior( ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); views::Widget* normal = CreateTestWidget(gfx::Rect(650, 10, 100, 100)); EXPECT_EQ(root_windows[1], normal->GetNativeView()->GetRootWindow()); EXPECT_EQ("650,10 100x100", normal->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("50,10 100x100", normal->GetNativeView()->GetBoundsInRootWindow().ToString()); views::Widget* maximized = CreateTestWidget(gfx::Rect(700, 10, 100, 100)); maximized->Maximize(); EXPECT_EQ(root_windows[1], maximized->GetNativeView()->GetRootWindow()); EXPECT_EQ("600,0 300x253", maximized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 300x253", maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); views::Widget* minimized = CreateTestWidget(gfx::Rect(800, 10, 100, 100)); minimized->Minimize(); EXPECT_EQ(root_windows[1], minimized->GetNativeView()->GetRootWindow()); EXPECT_EQ("800,10 100x100", minimized->GetWindowBoundsInScreen().ToString()); views::Widget* fullscreen = CreateTestWidget(gfx::Rect(850, 10, 100, 100)); fullscreen->SetFullscreen(true); EXPECT_EQ(root_windows[1], fullscreen->GetNativeView()->GetRootWindow()); EXPECT_EQ("600,0 300x300", fullscreen->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 300x300", fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); views::Widget* unparented_control = new Widget; Widget::InitParams params; params.bounds = gfx::Rect(650, 10, 100, 100); params.context = CurrentContext(); params.type = Widget::InitParams::TYPE_CONTROL; unparented_control->Init(params); EXPECT_EQ(root_windows[1], unparented_control->GetNativeView()->GetRootWindow()); EXPECT_EQ(kShellWindowId_UnparentedControlContainer, unparented_control->GetNativeView()->parent()->id()); aura::Window* panel = CreateTestWindowInShellWithDelegateAndType( NULL, ui::wm::WINDOW_TYPE_PANEL, 0, gfx::Rect(700, 100, 100, 100)); EXPECT_EQ(root_windows[1], panel->GetRootWindow()); EXPECT_EQ(kShellWindowId_PanelContainer, panel->parent()->id()); // Make sure a window that will delete itself when losing focus // will not crash. aura::WindowTracker tracker; DeleteOnBlurDelegate delete_on_blur_delegate; aura::Window* d2 = CreateTestWindowInShellWithDelegate( &delete_on_blur_delegate, 0, gfx::Rect(50, 50, 100, 100)); delete_on_blur_delegate.SetWindow(d2); aura::client::GetFocusClient(root_windows[0])->FocusWindow(d2); tracker.Add(d2); UpdateDisplay("600x600"); // d2 must have been deleted. EXPECT_FALSE(tracker.Contains(d2)); EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); EXPECT_EQ("100,20 100x100", normal->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("100,20 100x100", normal->GetNativeView()->GetBoundsInRootWindow().ToString()); // Maximized area on primary display has 3px (given as // kAutoHideSize in shelf_layout_manager.cc) inset at the bottom. // First clear fullscreen status, since both fullscreen and maximized windows // share the same desktop workspace, which cancels the shelf status. fullscreen->SetFullscreen(false); EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); EXPECT_EQ("0,0 600x597", maximized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 600x597", maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); // Set fullscreen to true. In that case the 3px inset becomes invisible so // the maximized window can also use the area fully. fullscreen->SetFullscreen(true); EXPECT_EQ(root_windows[0], maximized->GetNativeView()->GetRootWindow()); EXPECT_EQ("0,0 600x600", maximized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 600x600", maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); EXPECT_EQ(root_windows[0], minimized->GetNativeView()->GetRootWindow()); EXPECT_EQ("400,20 100x100", minimized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ(root_windows[0], fullscreen->GetNativeView()->GetRootWindow()); EXPECT_TRUE(fullscreen->IsFullscreen()); EXPECT_EQ("0,0 600x600", fullscreen->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("0,0 600x600", fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); // Test if the restore bounds are correctly updated. wm::GetWindowState(maximized->GetNativeView())->Restore(); EXPECT_EQ("200,20 100x100", maximized->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("200,20 100x100", maximized->GetNativeView()->GetBoundsInRootWindow().ToString()); fullscreen->SetFullscreen(false); EXPECT_EQ("500,20 100x100", fullscreen->GetWindowBoundsInScreen().ToString()); EXPECT_EQ("500,20 100x100", fullscreen->GetNativeView()->GetBoundsInRootWindow().ToString()); // Test if the unparented widget has moved. EXPECT_EQ(root_windows[0], unparented_control->GetNativeView()->GetRootWindow()); EXPECT_EQ(kShellWindowId_UnparentedControlContainer, unparented_control->GetNativeView()->parent()->id()); // Test if the panel has moved. EXPECT_EQ(root_windows[0], panel->GetRootWindow()); EXPECT_EQ(kShellWindowId_PanelContainer, panel->parent()->id()); } TEST_F(RootWindowControllerTest, MoveWindows_Modal) { if (!SupportsMultipleDisplays()) return; UpdateDisplay("500x500,500x500"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); // Emulate virtual screen coordinate system. root_windows[0]->SetBounds(gfx::Rect(0, 0, 500, 500)); root_windows[1]->SetBounds(gfx::Rect(500, 0, 500, 500)); views::Widget* normal = CreateTestWidget(gfx::Rect(300, 10, 100, 100)); EXPECT_EQ(root_windows[0], normal->GetNativeView()->GetRootWindow()); EXPECT_TRUE(wm::IsActiveWindow(normal->GetNativeView())); views::Widget* modal = CreateModalWidget(gfx::Rect(650, 10, 100, 100)); EXPECT_EQ(root_windows[1], modal->GetNativeView()->GetRootWindow()); EXPECT_TRUE(GetModalContainer(root_windows[1])->Contains( modal->GetNativeView())); EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); ui::test::EventGenerator generator_1st(root_windows[0]); generator_1st.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); UpdateDisplay("500x500"); EXPECT_EQ(root_windows[0], modal->GetNativeView()->GetRootWindow()); EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); generator_1st.ClickLeftButton(); EXPECT_TRUE(wm::IsActiveWindow(modal->GetNativeView())); } // Make sure lock related windows moves. TEST_F(RootWindowControllerTest, MoveWindows_LockWindowsInUnified) { if (!SupportsMultipleDisplays()) return; test::DisplayManagerTestApi::EnableUnifiedDesktopForTest(); UpdateDisplay("500x500"); const int kLockScreenWindowId = 1000; const int kLockBackgroundWindowId = 1001; RootWindowController* controller = Shell::GetInstance()->GetPrimaryRootWindowController(); aura::Window* lock_container = controller->GetContainer(kShellWindowId_LockScreenContainer); aura::Window* lock_background_container = controller->GetContainer(kShellWindowId_LockScreenBackgroundContainer); views::Widget* lock_screen = CreateModalWidgetWithParent(gfx::Rect(10, 10, 100, 100), lock_container); lock_screen->GetNativeWindow()->set_id(kLockScreenWindowId); lock_screen->SetFullscreen(true); views::Widget* lock_background = CreateModalWidgetWithParent( gfx::Rect(10, 10, 100, 100), lock_background_container); lock_background->GetNativeWindow()->set_id(kLockBackgroundWindowId); ASSERT_EQ(lock_screen->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); ASSERT_EQ(lock_background->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); // Switch to unified. UpdateDisplay("500x500,500x500"); // In unified mode, RWC is created controller = Shell::GetInstance()->GetPrimaryRootWindowController(); ASSERT_EQ(lock_screen->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); ASSERT_EQ(lock_background->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); // Switch to mirror. DisplayManager* display_manager = Shell::GetInstance()->display_manager(); display_manager->SetMirrorMode(true); EXPECT_TRUE(display_manager->IsInMirrorMode()); controller = Shell::GetInstance()->GetPrimaryRootWindowController(); ASSERT_EQ(lock_screen->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); ASSERT_EQ(lock_background->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); // Switch to unified. display_manager->SetMirrorMode(false); EXPECT_TRUE(display_manager->IsInUnifiedMode()); controller = Shell::GetInstance()->GetPrimaryRootWindowController(); ASSERT_EQ(lock_screen->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); ASSERT_EQ(lock_background->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); EXPECT_EQ("0,0 500x500", lock_screen->GetNativeWindow()->bounds().ToString()); // Switch to single display. UpdateDisplay("600x500"); EXPECT_FALSE(display_manager->IsInUnifiedMode()); EXPECT_FALSE(display_manager->IsInMirrorMode()); controller = Shell::GetInstance()->GetPrimaryRootWindowController(); ASSERT_EQ(lock_screen->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); ASSERT_EQ(lock_background->GetNativeWindow(), controller->GetRootWindow()->GetChildById(kLockBackgroundWindowId)); EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString()); } TEST_F(RootWindowControllerTest, ModalContainer) { UpdateDisplay("600x600"); Shell* shell = Shell::GetInstance(); RootWindowController* controller = shell->GetPrimaryRootWindowController(); EXPECT_EQ(user::LOGGED_IN_USER, shell->system_tray_delegate()->GetUserLoginStatus()); EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager(NULL)); views::Widget* session_modal_widget = CreateModalWidget(gfx::Rect(300, 10, 100, 100)); EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager( session_modal_widget->GetNativeView())); shell->session_state_delegate()->LockScreen(); EXPECT_EQ(user::LOGGED_IN_LOCKED, shell->system_tray_delegate()->GetUserLoginStatus()); EXPECT_EQ(controller->GetContainer(kShellWindowId_LockSystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager(NULL)); aura::Window* lock_container = controller->GetContainer(kShellWindowId_LockScreenContainer); views::Widget* lock_modal_widget = CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); EXPECT_EQ(controller->GetContainer(kShellWindowId_LockSystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager( lock_modal_widget->GetNativeView())); EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager( session_modal_widget->GetNativeView())); shell->session_state_delegate()->UnlockScreen(); } TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { UpdateDisplay("600x600"); Shell* shell = Shell::GetInstance(); // Configure login screen environment. SetUserLoggedIn(false); EXPECT_EQ(user::LOGGED_IN_NONE, shell->system_tray_delegate()->GetUserLoginStatus()); EXPECT_EQ(0, shell->session_state_delegate()->NumberOfLoggedInUsers()); EXPECT_FALSE(shell->session_state_delegate()->IsActiveUserSessionStarted()); RootWindowController* controller = shell->GetPrimaryRootWindowController(); EXPECT_EQ(controller->GetContainer(kShellWindowId_LockSystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager(NULL)); aura::Window* lock_container = controller->GetContainer(kShellWindowId_LockScreenContainer); views::Widget* login_modal_widget = CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); EXPECT_EQ(controller->GetContainer(kShellWindowId_LockSystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager( login_modal_widget->GetNativeView())); login_modal_widget->Close(); // Configure user session environment. SetUserLoggedIn(true); SetSessionStarted(true); EXPECT_EQ(user::LOGGED_IN_USER, shell->system_tray_delegate()->GetUserLoginStatus()); EXPECT_EQ(1, shell->session_state_delegate()->NumberOfLoggedInUsers()); EXPECT_TRUE(shell->session_state_delegate()->IsActiveUserSessionStarted()); EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager(NULL)); views::Widget* session_modal_widget = CreateModalWidget(gfx::Rect(300, 10, 100, 100)); EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager( session_modal_widget->GetNativeView())); } TEST_F(RootWindowControllerTest, ModalContainerBlockedSession) { UpdateDisplay("600x600"); RootWindowController* controller = Shell::GetPrimaryRootWindowController(); aura::Window* lock_container = controller->GetContainer(kShellWindowId_LockScreenContainer); for (int block_reason = FIRST_BLOCK_REASON; block_reason < NUMBER_OF_BLOCK_REASONS; ++block_reason) { views::Widget* session_modal_widget = CreateModalWidget(gfx::Rect(300, 10, 100, 100)); EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager( session_modal_widget->GetNativeView())); EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager(NULL)); session_modal_widget->Close(); BlockUserSession(static_cast<UserSessionBlockReason>(block_reason)); EXPECT_EQ(controller->GetContainer(kShellWindowId_LockSystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager(NULL)); views::Widget* lock_modal_widget = CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); EXPECT_EQ(controller->GetContainer(kShellWindowId_LockSystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager( lock_modal_widget->GetNativeView())); session_modal_widget = CreateModalWidget(gfx::Rect(300, 10, 100, 100)); EXPECT_EQ(controller->GetContainer(kShellWindowId_SystemModalContainer) ->layout_manager(), controller->GetSystemModalLayoutManager( session_modal_widget->GetNativeView())); session_modal_widget->Close(); lock_modal_widget->Close(); UnblockUserSession(); } } TEST_F(RootWindowControllerTest, GetWindowForFullscreenMode) { UpdateDisplay("600x600"); RootWindowController* controller = Shell::GetInstance()->GetPrimaryRootWindowController(); Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); w1->Maximize(); Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); w2->SetFullscreen(true); // |w3| is a transient child of |w2|. Widget* w3 = Widget::CreateWindowWithParentAndBounds(NULL, w2->GetNativeWindow(), gfx::Rect(0, 0, 100, 100)); // Test that GetWindowForFullscreenMode() finds the fullscreen window when one // of its transient children is active. w3->Activate(); EXPECT_EQ(w2->GetNativeWindow(), controller->GetWindowForFullscreenMode()); // If the topmost window is not fullscreen, it returns NULL. w1->Activate(); EXPECT_EQ(NULL, controller->GetWindowForFullscreenMode()); w1->Close(); w3->Close(); // Only w2 remains, if minimized GetWindowForFullscreenMode should return // NULL. w2->Activate(); EXPECT_EQ(w2->GetNativeWindow(), controller->GetWindowForFullscreenMode()); w2->Minimize(); EXPECT_EQ(NULL, controller->GetWindowForFullscreenMode()); } TEST_F(RootWindowControllerTest, MultipleDisplaysGetWindowForFullscreenMode) { if (!SupportsMultipleDisplays()) return; UpdateDisplay("600x600,600x600"); Shell::RootWindowControllerList controllers = Shell::GetInstance()->GetAllRootWindowControllers(); Widget* w1 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); w1->Maximize(); Widget* w2 = CreateTestWidget(gfx::Rect(0, 0, 100, 100)); w2->SetFullscreen(true); Widget* w3 = CreateTestWidget(gfx::Rect(600, 0, 100, 100)); EXPECT_EQ(w1->GetNativeWindow()->GetRootWindow(), controllers[0]->GetRootWindow()); EXPECT_EQ(w2->GetNativeWindow()->GetRootWindow(), controllers[0]->GetRootWindow()); EXPECT_EQ(w3->GetNativeWindow()->GetRootWindow(), controllers[1]->GetRootWindow()); w1->Activate(); EXPECT_EQ(NULL, controllers[0]->GetWindowForFullscreenMode()); EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); w2->Activate(); EXPECT_EQ(w2->GetNativeWindow(), controllers[0]->GetWindowForFullscreenMode()); EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); // Verify that the first root window controller remains in fullscreen mode // when a window on the other display is activated. w3->Activate(); EXPECT_EQ(w2->GetNativeWindow(), controllers[0]->GetWindowForFullscreenMode()); EXPECT_EQ(NULL, controllers[1]->GetWindowForFullscreenMode()); } // Test that user session window can't be focused if user session blocked by // some overlapping UI. TEST_F(RootWindowControllerTest, FocusBlockedWindow) { UpdateDisplay("600x600"); RootWindowController* controller = Shell::GetInstance()->GetPrimaryRootWindowController(); aura::Window* lock_container = controller->GetContainer(kShellWindowId_LockScreenContainer); aura::Window* lock_window = Widget::CreateWindowWithParentAndBounds(NULL, lock_container, gfx::Rect(0, 0, 100, 100))->GetNativeView(); lock_window->Show(); aura::Window* session_window = CreateTestWidget(gfx::Rect(0, 0, 100, 100))->GetNativeView(); session_window->Show(); for (int block_reason = FIRST_BLOCK_REASON; block_reason < NUMBER_OF_BLOCK_REASONS; ++block_reason) { BlockUserSession(static_cast<UserSessionBlockReason>(block_reason)); lock_window->Focus(); EXPECT_TRUE(lock_window->HasFocus()); session_window->Focus(); EXPECT_FALSE(session_window->HasFocus()); UnblockUserSession(); } } // Tracks whether OnWindowDestroying() has been invoked. class DestroyedWindowObserver : public aura::WindowObserver { public: DestroyedWindowObserver() : destroyed_(false), window_(NULL) {} ~DestroyedWindowObserver() override { Shutdown(); } void SetWindow(Window* window) { window_ = window; window->AddObserver(this); } bool destroyed() const { return destroyed_; } // WindowObserver overrides: void OnWindowDestroying(Window* window) override { destroyed_ = true; Shutdown(); } private: void Shutdown() { if (!window_) return; window_->RemoveObserver(this); window_ = NULL; } bool destroyed_; Window* window_; DISALLOW_COPY_AND_ASSIGN(DestroyedWindowObserver); }; // Verifies shutdown doesn't delete windows that are not owned by the parent. TEST_F(RootWindowControllerTest, DontDeleteWindowsNotOwnedByParent) { DestroyedWindowObserver observer1; aura::test::TestWindowDelegate delegate1; aura::Window* window1 = new aura::Window(&delegate1); window1->SetType(ui::wm::WINDOW_TYPE_CONTROL); window1->set_owned_by_parent(false); observer1.SetWindow(window1); window1->Init(ui::LAYER_NOT_DRAWN); aura::client::ParentWindowWithContext( window1, Shell::GetInstance()->GetPrimaryRootWindow(), gfx::Rect()); DestroyedWindowObserver observer2; aura::Window* window2 = new aura::Window(NULL); window2->set_owned_by_parent(false); observer2.SetWindow(window2); window2->Init(ui::LAYER_NOT_DRAWN); Shell::GetInstance()->GetPrimaryRootWindow()->AddChild(window2); Shell::GetInstance()->GetPrimaryRootWindowController()->CloseChildWindows(); ASSERT_FALSE(observer1.destroyed()); delete window1; ASSERT_FALSE(observer2.destroyed()); delete window2; } typedef test::NoSessionAshTestBase NoSessionRootWindowControllerTest; // Make sure that an event handler exists for entire display area. TEST_F(NoSessionRootWindowControllerTest, Event) { // Hide the shelf since it might otherwise get an event target. RootWindowController* controller = Shell::GetPrimaryRootWindowController(); ShelfLayoutManager* shelf_layout_manager = controller->GetShelfLayoutManager(); shelf_layout_manager->SetAutoHideBehavior( ash::SHELF_AUTO_HIDE_ALWAYS_HIDDEN); aura::Window* root = Shell::GetPrimaryRootWindow(); const gfx::Size size = root->bounds().size(); aura::Window* event_target = root->GetEventHandlerForPoint(gfx::Point(0, 0)); EXPECT_TRUE(event_target); EXPECT_EQ(event_target, root->GetEventHandlerForPoint(gfx::Point(0, size.height() - 1))); EXPECT_EQ(event_target, root->GetEventHandlerForPoint(gfx::Point(size.width() - 1, 0))); EXPECT_EQ(event_target, root->GetEventHandlerForPoint(gfx::Point(0, size.height() - 1))); EXPECT_EQ(event_target, root->GetEventHandlerForPoint( gfx::Point(size.width() - 1, size.height() - 1))); } class VirtualKeyboardRootWindowControllerTest : public RootWindowControllerTest { public: VirtualKeyboardRootWindowControllerTest() {} ~VirtualKeyboardRootWindowControllerTest() override {} void SetUp() override { base::CommandLine::ForCurrentProcess()->AppendSwitch( keyboard::switches::kEnableVirtualKeyboard); test::AshTestBase::SetUp(); Shell::GetPrimaryRootWindowController()->ActivateKeyboard( keyboard::KeyboardController::GetInstance()); } private: DISALLOW_COPY_AND_ASSIGN(VirtualKeyboardRootWindowControllerTest); }; class MockTextInputClient : public ui::DummyTextInputClient { public: MockTextInputClient() : ui::DummyTextInputClient(ui::TEXT_INPUT_TYPE_TEXT) {} void EnsureCaretInRect(const gfx::Rect& rect) override { visible_rect_ = rect; } const gfx::Rect& visible_rect() const { return visible_rect_; } private: gfx::Rect visible_rect_; DISALLOW_COPY_AND_ASSIGN(MockTextInputClient); }; class TargetHitTestEventHandler : public ui::test::TestEventHandler { public: TargetHitTestEventHandler() {} // ui::test::TestEventHandler overrides. void OnMouseEvent(ui::MouseEvent* event) override { if (event->type() == ui::ET_MOUSE_PRESSED) ui::test::TestEventHandler::OnMouseEvent(event); event->StopPropagation(); } private: DISALLOW_COPY_AND_ASSIGN(TargetHitTestEventHandler); }; // Test for http://crbug.com/297858. Virtual keyboard container should only show // on primary root window. TEST_F(VirtualKeyboardRootWindowControllerTest, VirtualKeyboardOnPrimaryRootWindowOnly) { if (!SupportsMultipleDisplays()) return; UpdateDisplay("500x500,500x500"); aura::Window::Windows root_windows = Shell::GetAllRootWindows(); aura::Window* primary_root_window = Shell::GetPrimaryRootWindow(); aura::Window* secondary_root_window = root_windows[0] == primary_root_window ? root_windows[1] : root_windows[0]; ASSERT_TRUE(Shell::GetContainer(primary_root_window, kShellWindowId_VirtualKeyboardContainer)); ASSERT_FALSE(Shell::GetContainer(secondary_root_window, kShellWindowId_VirtualKeyboardContainer)); } // Test for http://crbug.com/263599. Virtual keyboard should be able to receive // events at blocked user session. TEST_F(VirtualKeyboardRootWindowControllerTest, ClickVirtualKeyboardInBlockedWindow) { aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); ASSERT_TRUE(keyboard_container); keyboard_container->Show(); aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()-> proxy()->GetKeyboardWindow(); keyboard_container->AddChild(keyboard_window); keyboard_window->set_owned_by_parent(false); keyboard_window->SetBounds(gfx::Rect()); keyboard_window->Show(); ui::test::TestEventHandler handler; root_window->AddPreTargetHandler(&handler); ui::test::EventGenerator event_generator(root_window, keyboard_window); event_generator.ClickLeftButton(); int expected_mouse_presses = 1; EXPECT_EQ(expected_mouse_presses, handler.num_mouse_events() / 2); for (int block_reason = FIRST_BLOCK_REASON; block_reason < NUMBER_OF_BLOCK_REASONS; ++block_reason) { BlockUserSession(static_cast<UserSessionBlockReason>(block_reason)); event_generator.ClickLeftButton(); expected_mouse_presses++; EXPECT_EQ(expected_mouse_presses, handler.num_mouse_events() / 2); UnblockUserSession(); } root_window->RemovePreTargetHandler(&handler); } // Test for http://crbug.com/299787. RootWindowController should delete // the old container since the keyboard controller creates a new window in // GetWindowContainer(). TEST_F(VirtualKeyboardRootWindowControllerTest, DeleteOldContainerOnVirtualKeyboardInit) { aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); ASSERT_TRUE(keyboard_container); // Track the keyboard container window. aura::WindowTracker tracker; tracker.Add(keyboard_container); // Mock a login user profile change to reinitialize the keyboard. ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); // keyboard_container should no longer be present. EXPECT_FALSE(tracker.Contains(keyboard_container)); } // Test for crbug.com/342524. After user login, the work space should restore to // full screen. TEST_F(VirtualKeyboardRootWindowControllerTest, RestoreWorkspaceAfterLogin) { aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); keyboard_container->Show(); keyboard::KeyboardController* controller = keyboard::KeyboardController::GetInstance(); aura::Window* keyboard_window = controller->proxy()->GetKeyboardWindow(); keyboard_container->AddChild(keyboard_window); keyboard_window->set_owned_by_parent(false); keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds( root_window->bounds(), 100)); keyboard_window->Show(); gfx::Rect before = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); // Notify keyboard bounds changing. controller->NotifyKeyboardBoundsChanging(keyboard_container->bounds()); if (!keyboard::IsKeyboardOverscrollEnabled()) { gfx::Rect after = ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(); EXPECT_LT(after, before); } // Mock a login user profile change to reinitialize the keyboard. ash::Shell::GetInstance()->OnLoginUserProfilePrepared(); EXPECT_EQ(ash::Shell::GetScreen()->GetPrimaryDisplay().work_area(), before); } // Ensure that system modal dialogs do not block events targeted at the virtual // keyboard. TEST_F(VirtualKeyboardRootWindowControllerTest, ClickWithActiveModalDialog) { aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); ASSERT_TRUE(keyboard_container); keyboard_container->Show(); aura::Window* keyboard_window = keyboard::KeyboardController::GetInstance()-> proxy()->GetKeyboardWindow(); keyboard_container->AddChild(keyboard_window); keyboard_window->set_owned_by_parent(false); keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds( root_window->bounds(), 100)); ui::test::TestEventHandler handler; root_window->AddPreTargetHandler(&handler); ui::test::EventGenerator root_window_event_generator(root_window); ui::test::EventGenerator keyboard_event_generator(root_window, keyboard_window); views::Widget* modal_widget = CreateModalWidget(gfx::Rect(300, 10, 100, 100)); // Verify that mouse events to the root window are block with a visble modal // dialog. root_window_event_generator.ClickLeftButton(); EXPECT_EQ(0, handler.num_mouse_events()); // Verify that event dispatch to the virtual keyboard is unblocked. keyboard_event_generator.ClickLeftButton(); EXPECT_EQ(1, handler.num_mouse_events() / 2); modal_widget->Close(); // Verify that mouse events are now unblocked to the root window. root_window_event_generator.ClickLeftButton(); EXPECT_EQ(2, handler.num_mouse_events() / 2); root_window->RemovePreTargetHandler(&handler); } // Ensure that the visible area for scrolling the text caret excludes the // region occluded by the on-screen keyboard. TEST_F(VirtualKeyboardRootWindowControllerTest, EnsureCaretInWorkArea) { keyboard::KeyboardController* keyboard_controller = keyboard::KeyboardController::GetInstance(); keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy(); MockTextInputClient text_input_client; ui::InputMethod* input_method = proxy->GetInputMethod(); ASSERT_TRUE(input_method); if (switches::IsTextInputFocusManagerEnabled()) { ui::TextInputFocusManager::GetInstance()->FocusTextInputClient( &text_input_client); } else { input_method->SetFocusedTextInputClient(&text_input_client); } aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); ASSERT_TRUE(keyboard_container); keyboard_container->Show(); const int keyboard_height = 100; aura::Window* keyboard_window =proxy->GetKeyboardWindow(); keyboard_container->AddChild(keyboard_window); keyboard_window->set_owned_by_parent(false); keyboard_window->SetBounds(keyboard::FullWidthKeyboardBoundsFromRootBounds( root_window->bounds(), keyboard_height)); proxy->EnsureCaretInWorkArea(); ASSERT_EQ(root_window->bounds().width(), text_input_client.visible_rect().width()); ASSERT_EQ(root_window->bounds().height() - keyboard_height, text_input_client.visible_rect().height()); if (switches::IsTextInputFocusManagerEnabled()) { ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( &text_input_client); } else { input_method->SetFocusedTextInputClient(NULL); } } // Tests that the virtual keyboard does not block context menus. The virtual // keyboard should appear in front of most content, but not context menus. See // crbug/377180. TEST_F(VirtualKeyboardRootWindowControllerTest, ZOrderTest) { UpdateDisplay("800x600"); keyboard::KeyboardController* keyboard_controller = keyboard::KeyboardController::GetInstance(); keyboard::KeyboardControllerProxy* proxy = keyboard_controller->proxy(); aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); ASSERT_TRUE(keyboard_container); keyboard_container->Show(); const int keyboard_height = 200; aura::Window* keyboard_window = proxy->GetKeyboardWindow(); keyboard_container->AddChild(keyboard_window); keyboard_window->set_owned_by_parent(false); gfx::Rect keyboard_bounds = keyboard::FullWidthKeyboardBoundsFromRootBounds( root_window->bounds(), keyboard_height); keyboard_window->SetBounds(keyboard_bounds); keyboard_window->Show(); ui::test::EventGenerator generator(root_window); // Cover the screen with two windows: a normal window on the left side and a // context menu on the right side. When the virtual keyboard is displayed it // partially occludes the normal window, but not the context menu. Compute // positions for generating synthetic click events to perform hit tests, // ensuring the correct window layering. 'top' is above the VK, whereas // 'bottom' lies within the VK. 'left' is centered in the normal window, and // 'right' is centered in the context menu. int window_height = keyboard_bounds.bottom(); int window_width = keyboard_bounds.width() / 2; int left = window_width / 2; int right = 3 * window_width / 2; int top = keyboard_bounds.y() / 2; int bottom = window_height - keyboard_height / 2; // Normal window is partially occluded by the virtual keyboard. aura::test::TestWindowDelegate delegate; scoped_ptr<aura::Window> normal(CreateTestWindowInShellWithDelegateAndType( &delegate, ui::wm::WINDOW_TYPE_NORMAL, 0, gfx::Rect(0, 0, window_width, window_height))); normal->set_owned_by_parent(false); normal->Show(); TargetHitTestEventHandler normal_handler; normal->AddPreTargetHandler(&normal_handler); // Test that only the click on the top portion of the window is picked up. The // click on the bottom hits the virtual keyboard instead. generator.MoveMouseTo(left, top); generator.ClickLeftButton(); EXPECT_EQ(1, normal_handler.num_mouse_events()); generator.MoveMouseTo(left, bottom); generator.ClickLeftButton(); EXPECT_EQ(1, normal_handler.num_mouse_events()); // Menu overlaps virtual keyboard. aura::test::TestWindowDelegate delegate2; scoped_ptr<aura::Window> menu(CreateTestWindowInShellWithDelegateAndType( &delegate2, ui::wm::WINDOW_TYPE_MENU, 0, gfx::Rect(window_width, 0, window_width, window_height))); menu->set_owned_by_parent(false); menu->Show(); TargetHitTestEventHandler menu_handler; menu->AddPreTargetHandler(&menu_handler); // Test that both clicks register. generator.MoveMouseTo(right, top); generator.ClickLeftButton(); EXPECT_EQ(1, menu_handler.num_mouse_events()); generator.MoveMouseTo(right, bottom); generator.ClickLeftButton(); EXPECT_EQ(2, menu_handler.num_mouse_events()); // Cleanup to ensure that the test windows are destroyed before their // delegates. normal.reset(); menu.reset(); } // Resolution in UpdateDisplay is not being respected on Windows 8. #if defined(OS_WIN) #define MAYBE_DisplayRotation DISABLED_DisplayRotation #else #define MAYBE_DisplayRotation DisplayRotation #endif // Tests that the virtual keyboard correctly resizes with a change to display // orientation. See crbug/417612. TEST_F(VirtualKeyboardRootWindowControllerTest, MAYBE_DisplayRotation) { UpdateDisplay("800x600"); aura::Window* root_window = Shell::GetPrimaryRootWindow(); aura::Window* keyboard_container = Shell::GetContainer(root_window, kShellWindowId_VirtualKeyboardContainer); ASSERT_TRUE(keyboard_container); keyboard::KeyboardController* keyboard_controller = keyboard::KeyboardController::GetInstance(); keyboard_controller->ShowKeyboard(false); keyboard_controller->proxy()->GetKeyboardWindow()->SetBounds( gfx::Rect(0, 400, 800, 200)); EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); UpdateDisplay("600x800"); EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); } } // namespace test } // namespace ash
guorendong/iridium-browser-ubuntu
ash/root_window_controller_unittest.cc
C++
bsd-3-clause
41,315
// Copyright 2014 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 <stdint.h> #include <utility> #include "base/json/json_reader.h" #include "base/macros.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" #include "base/values.h" #include "chrome/browser/apps/app_browsertest_util.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/signin/fake_signin_manager_builder.h" #include "chrome/browser/sync_file_system/drive_backend/sync_engine.h" #include "chrome/browser/sync_file_system/local/local_file_sync_service.h" #include "chrome/browser/sync_file_system/sync_file_system_service.h" #include "chrome/browser/sync_file_system/sync_file_system_service_factory.h" #include "components/drive/service/fake_drive_service.h" #include "extensions/test/extension_test_message_listener.h" #include "extensions/test/result_catcher.h" #include "storage/browser/quota/quota_manager.h" #include "third_party/leveldatabase/src/helpers/memenv/memenv.h" #include "third_party/leveldatabase/src/include/leveldb/env.h" namespace sync_file_system { namespace { class FakeDriveServiceFactory : public drive_backend::SyncEngine::DriveServiceFactory { public: explicit FakeDriveServiceFactory( drive::FakeDriveService::ChangeObserver* change_observer) : change_observer_(change_observer) {} ~FakeDriveServiceFactory() override {} scoped_ptr<drive::DriveServiceInterface> CreateDriveService( OAuth2TokenService* oauth2_token_service, net::URLRequestContextGetter* url_request_context_getter, base::SequencedTaskRunner* blocking_task_runner) override { scoped_ptr<drive::FakeDriveService> drive_service( new drive::FakeDriveService); drive_service->AddChangeObserver(change_observer_); return std::move(drive_service); } private: drive::FakeDriveService::ChangeObserver* change_observer_; DISALLOW_COPY_AND_ASSIGN(FakeDriveServiceFactory); }; } // namespace class SyncFileSystemTest : public extensions::PlatformAppBrowserTest, public drive::FakeDriveService::ChangeObserver { public: SyncFileSystemTest() : remote_service_(NULL) { } void SetUpInProcessBrowserTestFixture() override { ExtensionApiTest::SetUpInProcessBrowserTestFixture(); real_minimum_preserved_space_ = storage::QuotaManager::kMinimumPreserveForSystem; storage::QuotaManager::kMinimumPreserveForSystem = 0; } void TearDownInProcessBrowserTestFixture() override { storage::QuotaManager::kMinimumPreserveForSystem = real_minimum_preserved_space_; ExtensionApiTest::TearDownInProcessBrowserTestFixture(); } scoped_refptr<base::SequencedTaskRunner> MakeSequencedTaskRunner() { scoped_refptr<base::SequencedWorkerPool> worker_pool = content::BrowserThread::GetBlockingPool(); return worker_pool->GetSequencedTaskRunnerWithShutdownBehavior( worker_pool->GetSequenceToken(), base::SequencedWorkerPool::SKIP_ON_SHUTDOWN); } void SetUpOnMainThread() override { ASSERT_TRUE(base_dir_.CreateUniqueTempDir()); SyncFileSystemServiceFactory* factory = SyncFileSystemServiceFactory::GetInstance(); content::BrowserContext* context = browser()->profile(); ExtensionServiceInterface* extension_service = extensions::ExtensionSystem::Get(context)->extension_service(); scoped_ptr<drive_backend::SyncEngine::DriveServiceFactory> drive_service_factory(new FakeDriveServiceFactory(this)); fake_signin_manager_.reset(new FakeSigninManagerForTesting( browser()->profile())); remote_service_ = new drive_backend::SyncEngine( base::ThreadTaskRunnerHandle::Get(), // ui_task_runner MakeSequencedTaskRunner(), MakeSequencedTaskRunner(), content::BrowserThread::GetBlockingPool(), base_dir_.path(), NULL, // task_logger NULL, // notification_manager extension_service, fake_signin_manager_.get(), // signin_manager NULL, // token_service NULL, // request_context std::move(drive_service_factory), in_memory_env_.get()); remote_service_->SetSyncEnabled(true); factory->set_mock_remote_file_service( scoped_ptr<RemoteFileSyncService>(remote_service_)); } // drive::FakeDriveService::ChangeObserver override. void OnNewChangeAvailable() override { sync_engine()->OnNotificationReceived(); } SyncFileSystemService* sync_file_system_service() { return SyncFileSystemServiceFactory::GetForProfile(browser()->profile()); } drive_backend::SyncEngine* sync_engine() { return static_cast<drive_backend::SyncEngine*>( sync_file_system_service()->remote_service_.get()); } LocalFileSyncService* local_file_sync_service() { return sync_file_system_service()->local_service_.get(); } void SignIn() { fake_signin_manager_->SetAuthenticatedAccountInfo("12345", "tester"); sync_engine()->GoogleSigninSucceeded("12345", "tester", "password"); } void SetSyncEnabled(bool enabled) { sync_file_system_service()->SetSyncEnabledForTesting(enabled); } void WaitUntilIdle() { base::RunLoop run_loop; sync_file_system_service()->CallOnIdleForTesting(run_loop.QuitClosure()); run_loop.Run(); } private: base::ScopedTempDir base_dir_; scoped_ptr<leveldb::Env> in_memory_env_; scoped_ptr<FakeSigninManagerForTesting> fake_signin_manager_; drive_backend::SyncEngine* remote_service_; int64_t real_minimum_preserved_space_; DISALLOW_COPY_AND_ASSIGN(SyncFileSystemTest); }; IN_PROC_BROWSER_TEST_F(SyncFileSystemTest, AuthorizationTest) { ExtensionTestMessageListener open_failure( "checkpoint: Failed to get syncfs", true); ExtensionTestMessageListener bar_created( "checkpoint: \"/bar\" created", true); ExtensionTestMessageListener foo_created( "checkpoint: \"/foo\" created", true); extensions::ResultCatcher catcher; LoadAndLaunchPlatformApp("sync_file_system/authorization_test", "Launched"); // Application sync is disabled at the initial state. Thus first // syncFilesystem.requestFileSystem call should fail. ASSERT_TRUE(open_failure.WaitUntilSatisfied()); // Enable Application sync and let the app retry. SignIn(); SetSyncEnabled(true); open_failure.Reply("resume"); ASSERT_TRUE(foo_created.WaitUntilSatisfied()); // The app creates a file "/foo", that should successfully sync to the remote // service. Wait for the completion and resume the app. WaitUntilIdle(); sync_engine()->GoogleSignedOut("test_account", std::string()); foo_created.Reply("resume"); ASSERT_TRUE(bar_created.WaitUntilSatisfied()); // The app creates anohter file "/bar". Since the user signed out from chrome // The synchronization should fail and the service state should be // AUTHENTICATION_REQUIRED. WaitUntilIdle(); EXPECT_EQ(REMOTE_SERVICE_AUTHENTICATION_REQUIRED, sync_engine()->GetCurrentState()); sync_engine()->GoogleSigninSucceeded("test_account", "tester", "testing"); WaitUntilIdle(); bar_created.Reply("resume"); EXPECT_TRUE(catcher.GetNextResult()); } } // namespace sync_file_system
ds-hwang/chromium-crosswalk
chrome/browser/extensions/api/sync_file_system/sync_file_system_browsertest.cc
C++
bsd-3-clause
7,357
package org.revenj; import org.junit.Assert; import org.junit.Test; import java.io.IOException; public class TestCommon { @Test public void checkTreePathMethods() throws IOException { TreePath t1 = TreePath.create("a.b.c"); TreePath t2 = TreePath.create("a.b"); Assert.assertTrue(t1.isDescendant(t2)); Assert.assertFalse(t2.isDescendant(t1)); Assert.assertTrue(t2.isDescendant(t2)); Assert.assertFalse(t1.isAncestor(t2)); Assert.assertTrue(t2.isAncestor(t1)); Assert.assertTrue(t2.isAncestor(t2)); } }
ngs-doo/revenj
java/revenj-core/src/test/java/org/revenj/TestCommon.java
Java
bsd-3-clause
546
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN"> <html> <head> <script src="../../../js/resources/js-test-pre.js"></script> <script src="resources/gesture-helpers.js"></script> <style type="text/css"> #touchtarget { width: 100px; height: 100px; position: relative; background: white; } ::-webkit-scrollbar { width: 0px; height: 0px; } #movingbox { width: 100%; height: 100%; position: absolute; word-wrap: break-word; overflow-y: scroll; overflow-x: scroll; display: block; } #greenbox { width: 100px; height: 100px; background: green; padding: 0px; margin: 0px; } #redbox { width: 100px; height: 100px; background: red; padding: 0px; margin: 0px; } td { padding: 0px; } </style> </head> <body style="margin:0" onload="runTest();"> <div id="touchtarget"> <div id="movingbox"> <table border="0" cellspacing="0px" id="tablefoo"> <tr> <td><div id="redbox"></div></td> <td><div id="greenbox"></div></td> </tr> <tr> <td><div id="greenbox"></div></td> <td><div id="greenbox"></div></td> </tr> </table> </div> </div> <p id="description"></p> <div id="console"></div> <script type="text/javascript"> var movingdiv; var expectedGesturesTotal = 2; var gesturesOccurred = 0; var scrollAmountX = ['90', '90']; var scrollAmountY = ['0', '95']; var wheelEventsOccurred = 0; var expectedWheelEventsOccurred = ['1', '1']; var scrollEventsOccurred = 0; var expectedScrollEventsOccurred = '1'; var scrolledElement = 'movingdiv' function firstGestureScroll() { debug("first gesture"); eventSender.gestureScrollBegin(95, 12); eventSender.gestureScrollUpdate(-90, 0); eventSender.gestureScrollEnd(0, 0); // Wait for layout. checkScrollOffset(); } function secondGestureScroll() { debug("second gesture"); eventSender.gestureScrollBegin(12, 97); eventSender.gestureScrollUpdate(0, -95); eventSender.gestureScrollEnd(0, 0); // Wait for layout. checkScrollOffset(); } if (window.testRunner) testRunner.waitUntilDone(); function runTest() { movingdiv = document.getElementById('movingbox'); movingdiv.addEventListener("scroll", recordScroll); window.addEventListener("mousewheel", recordWheel); if (window.eventSender) { description('This tests gesture event scrolling of an overflow div.'); if (checkTestDependencies()) firstGestureScroll(); else exitIfNecessary(); } else { debug("This test requires DumpRenderTree. Touch scroll the red rect to log."); } } </script> </body> </html>
leighpauls/k2cro4
content/test/data/layout_tests/LayoutTests/fast/events/touch/gesture/touch-gesture-scroll-div.html
HTML
bsd-3-clause
2,626
a,b,i{color : white; width: 100px} @-ms-keyframes boom { from { background-position : 0 0; } to { background-position : 50% 50%; } } b{color: white; width: 100px} /*sdfgsdgf*/ @media print { .theClass { some-css : here; some-more : there; } } i{color: white; width: 100px} @font-face { font-family: 'gzipper'; src: url( yanone.eot ) ; src: local('gzipper' ), url(yanone.ttf) format('truetype'); }
newghost/ourjs
node_modules/cssshrink/node_modules/prettyugly/examples/example.css
CSS
bsd-3-clause
440
<?php /** * 内容处理工具类 * 提供远程图片获取、内容分页、汉字转拼音等功能 * @author Tianfeng.Han * @package SwooleSystem * @subpackage tools * */ class Swoole_content { /** * 自动产生分页代码 * 根据$size提供的长度 * 将$content分成$sptag分割开的一个文本,可以使用explode实现内容划分 * * @param $content 内容 * @param $size 每页内容长度 * @param $sptag 分隔符 * @return bool 是否成功 */ function paging(&$content,$size,$sptag) { if(strlen($content)<$spsize) return false; $bds = explode('<',$content); $npageBody = ""; $istable = 0; $content = ""; foreach($bds as $i=>$k) { if($i==0){$npageBody .= $bds[$i]; continue;} $bds[$i] = "<".$bds[$i]; if(strlen($bds[$i])>6) { $tname = substr($bds[$i],1,5); if(strtolower($tname)=='table') $istable++; else if(strtolower($tname)=='/tabl') $istable--; if($istable>0){$npageBody .= $bds[$i]; continue;} else $npageBody .= $bds[$i]; } else { $npageBody .= $bds[$i]; } if(strlen($npageBody)>$spsize) { $content .= $npageBody.$sptag; $npageBody = ""; } } if($npageBody!="") $content .= $npageBody; return true; } /** * 自动将给定的内容$data中远程图片的url改为本地图片,并自动将远程图片保存到本地 * @param $data * @return unknown_type */ function image_local(&$content,$dir='') { if(empty($dir)) $dir = UPLOAD_DIR.'/extend/'.date('Ym')."/".date("d"); if(!file_exists($dir)) { mkdir(WEBPATH.$dir,0777,true); } $chunklist = array (); $chunklist = explode("\n",$content); $links = array (); $regs = array (); $source = array(); $i = 0; while(list ($id, $chunk) = each($chunklist)) { if (strstr(strtolower($chunk),"img") && strstr(strtolower($chunk), "src")) { while (eregi("(img[^>]*src[[:blank:]]*)=[[:blank:]]*[\'\"]?(([[a-z]{3,5}://(([.a-zA-Z0-9-])+(:[0-9]+)*))*([+:%/?=&;\\\(\),._a-zA-Z0-9-]*))(#[.a-zA-Z0-9-]*)?[\'\" ]?", $chunk, $regs)) { if($regs[2]) { $i++; $source[$i] = $regs[2]; } $chunk = str_replace($regs[0], "", $chunk); } } } $newImg = array(); foreach($source as $uri) { if(!strstr(WEBROOT,$uri) and $uri{0}!='/') { $filename=substr(time(),6,-1).rand(100000,999999).".jpg"; copy($uri,WEBPATH.$dir.'/'.$filename); $content = str_replace($uri,WEBROOT.$dir."/".$filename,$content); } } } /** * 汉字转为拼音 * @param $str 中文 * @return $res 拼音 */ function pinyin($str,$charset='gb2312') { return Pinyin($ret,$charset); } //主要是用于pinyin方法 private function _pinyin($num,&$pinyin) { if($num>0&&$num<160) { return chr($num); } elseif($num<-20319||$num>-10247) { return ""; } else { for($i=count($pinyin)-1;$i>=0;$i--){if($pinyin[$i][1]<=$num)break;} return $pinyin[$i][0]; } } /** * 数字转汉字表示 * */ function num2han($num) { $array = array('〇','一','二','三','四','五','六','七','八','九'); $num = (string) $num; $len = strlen($num); $str = ''; for($i=0;$i<$len;$i++) { $str.=$array[$num{$i}]; } return $str; } } function Pinyin($_String, $_Code='gb2312') { $_DataKey = "a|ai|an|ang|ao|ba|bai|ban|bang|bao|bei|ben|beng|bi|bian|biao|bie|bin|bing|bo|bu|ca|cai|can|cang|cao|ce|ceng|cha". "|chai|chan|chang|chao|che|chen|cheng|chi|chong|chou|chu|chuai|chuan|chuang|chui|chun|chuo|ci|cong|cou|cu|". "cuan|cui|cun|cuo|da|dai|dan|dang|dao|de|deng|di|dian|diao|die|ding|diu|dong|dou|du|duan|dui|dun|duo|e|en|er". "|fa|fan|fang|fei|fen|feng|fo|fou|fu|ga|gai|gan|gang|gao|ge|gei|gen|geng|gong|gou|gu|gua|guai|guan|guang|gui". "|gun|guo|ha|hai|han|hang|hao|he|hei|hen|heng|hong|hou|hu|hua|huai|huan|huang|hui|hun|huo|ji|jia|jian|jiang". "|jiao|jie|jin|jing|jiong|jiu|ju|juan|jue|jun|ka|kai|kan|kang|kao|ke|ken|keng|kong|kou|ku|kua|kuai|kuan|kuang". "|kui|kun|kuo|la|lai|lan|lang|lao|le|lei|leng|li|lia|lian|liang|liao|lie|lin|ling|liu|long|lou|lu|lv|luan|lue". "|lun|luo|ma|mai|man|mang|mao|me|mei|men|meng|mi|mian|miao|mie|min|ming|miu|mo|mou|mu|na|nai|nan|nang|nao|ne". "|nei|nen|neng|ni|nian|niang|niao|nie|nin|ning|niu|nong|nu|nv|nuan|nue|nuo|o|ou|pa|pai|pan|pang|pao|pei|pen". "|peng|pi|pian|piao|pie|pin|ping|po|pu|qi|qia|qian|qiang|qiao|qie|qin|qing|qiong|qiu|qu|quan|que|qun|ran|rang". "|rao|re|ren|reng|ri|rong|rou|ru|ruan|rui|run|ruo|sa|sai|san|sang|sao|se|sen|seng|sha|shai|shan|shang|shao|". "she|shen|sheng|shi|shou|shu|shua|shuai|shuan|shuang|shui|shun|shuo|si|song|sou|su|suan|sui|sun|suo|ta|tai|". "tan|tang|tao|te|teng|ti|tian|tiao|tie|ting|tong|tou|tu|tuan|tui|tun|tuo|wa|wai|wan|wang|wei|wen|weng|wo|wu". "|xi|xia|xian|xiang|xiao|xie|xin|xing|xiong|xiu|xu|xuan|xue|xun|ya|yan|yang|yao|ye|yi|yin|ying|yo|yong|you". "|yu|yuan|yue|yun|za|zai|zan|zang|zao|ze|zei|zen|zeng|zha|zhai|zhan|zhang|zhao|zhe|zhen|zheng|zhi|zhong|". "zhou|zhu|zhua|zhuai|zhuan|zhuang|zhui|zhun|zhuo|zi|zong|zou|zu|zuan|zui|zun|zuo"; $_DataValue = "-20319|-20317|-20304|-20295|-20292|-20283|-20265|-20257|-20242|-20230|-20051|-20036|-20032|-20026|-20002|-19990". "|-19986|-19982|-19976|-19805|-19784|-19775|-19774|-19763|-19756|-19751|-19746|-19741|-19739|-19728|-19725". "|-19715|-19540|-19531|-19525|-19515|-19500|-19484|-19479|-19467|-19289|-19288|-19281|-19275|-19270|-19263". "|-19261|-19249|-19243|-19242|-19238|-19235|-19227|-19224|-19218|-19212|-19038|-19023|-19018|-19006|-19003". "|-18996|-18977|-18961|-18952|-18783|-18774|-18773|-18763|-18756|-18741|-18735|-18731|-18722|-18710|-18697". "|-18696|-18526|-18518|-18501|-18490|-18478|-18463|-18448|-18447|-18446|-18239|-18237|-18231|-18220|-18211". "|-18201|-18184|-18183|-18181|-18012|-17997|-17988|-17970|-17964|-17961|-17950|-17947|-17931|-17928|-17922". "|-17759|-17752|-17733|-17730|-17721|-17703|-17701|-17697|-17692|-17683|-17676|-17496|-17487|-17482|-17468". "|-17454|-17433|-17427|-17417|-17202|-17185|-16983|-16970|-16942|-16915|-16733|-16708|-16706|-16689|-16664". "|-16657|-16647|-16474|-16470|-16465|-16459|-16452|-16448|-16433|-16429|-16427|-16423|-16419|-16412|-16407". "|-16403|-16401|-16393|-16220|-16216|-16212|-16205|-16202|-16187|-16180|-16171|-16169|-16158|-16155|-15959". "|-15958|-15944|-15933|-15920|-15915|-15903|-15889|-15878|-15707|-15701|-15681|-15667|-15661|-15659|-15652". "|-15640|-15631|-15625|-15454|-15448|-15436|-15435|-15419|-15416|-15408|-15394|-15385|-15377|-15375|-15369". "|-15363|-15362|-15183|-15180|-15165|-15158|-15153|-15150|-15149|-15144|-15143|-15141|-15140|-15139|-15128". "|-15121|-15119|-15117|-15110|-15109|-14941|-14937|-14933|-14930|-14929|-14928|-14926|-14922|-14921|-14914". "|-14908|-14902|-14894|-14889|-14882|-14873|-14871|-14857|-14678|-14674|-14670|-14668|-14663|-14654|-14645". "|-14630|-14594|-14429|-14407|-14399|-14384|-14379|-14368|-14355|-14353|-14345|-14170|-14159|-14151|-14149". "|-14145|-14140|-14137|-14135|-14125|-14123|-14122|-14112|-14109|-14099|-14097|-14094|-14092|-14090|-14087". "|-14083|-13917|-13914|-13910|-13907|-13906|-13905|-13896|-13894|-13878|-13870|-13859|-13847|-13831|-13658". "|-13611|-13601|-13406|-13404|-13400|-13398|-13395|-13391|-13387|-13383|-13367|-13359|-13356|-13343|-13340". "|-13329|-13326|-13318|-13147|-13138|-13120|-13107|-13096|-13095|-13091|-13076|-13068|-13063|-13060|-12888". "|-12875|-12871|-12860|-12858|-12852|-12849|-12838|-12831|-12829|-12812|-12802|-12607|-12597|-12594|-12585". "|-12556|-12359|-12346|-12320|-12300|-12120|-12099|-12089|-12074|-12067|-12058|-12039|-11867|-11861|-11847". "|-11831|-11798|-11781|-11604|-11589|-11536|-11358|-11340|-11339|-11324|-11303|-11097|-11077|-11067|-11055". "|-11052|-11045|-11041|-11038|-11024|-11020|-11019|-11018|-11014|-10838|-10832|-10815|-10800|-10790|-10780". "|-10764|-10587|-10544|-10533|-10519|-10331|-10329|-10328|-10322|-10315|-10309|-10307|-10296|-10281|-10274". "|-10270|-10262|-10260|-10256|-10254"; $_TDataKey = explode('|', $_DataKey); $_TDataValue = explode('|', $_DataValue); $_Data = (PHP_VERSION>='5.0') ? array_combine($_TDataKey, $_TDataValue) : _Array_Combine($_TDataKey, $_TDataValue); arsort($_Data); reset($_Data); if($_Code != 'gb2312') $_String = _U2_Utf8_Gb($_String); $_Res = ''; for($i=0; $i<strlen($_String); $i++) { $_P = ord(substr($_String, $i, 1)); if($_P>160) { $_Q = ord(substr($_String, ++$i, 1)); $_P = $_P*256 + $_Q - 65536; } $_Res .= _Pinyin($_P, $_Data); } return preg_replace("/[^a-z0-9]*/", '', $_Res); } function _Pinyin($_Num, $_Data) { if ($_Num>0 && $_Num<160 ) return chr($_Num); elseif($_Num<-20319 || $_Num>-10247) return ''; else { foreach($_Data as $k=>$v){ if($v<=$_Num) break; } return $k; } } function _U2_Utf8_Gb($_C) { $_String = ''; if($_C < 0x80) $_String .= $_C; elseif($_C < 0x800) { $_String .= chr(0xC0 | $_C>>6); $_String .= chr(0x80 | $_C & 0x3F); }elseif($_C < 0x10000){ $_String .= chr(0xE0 | $_C>>12); $_String .= chr(0x80 | $_C>>6 & 0x3F); $_String .= chr(0x80 | $_C & 0x3F); } elseif($_C < 0x200000) { $_String .= chr(0xF0 | $_C>>18); $_String .= chr(0x80 | $_C>>12 & 0x3F); $_String .= chr(0x80 | $_C>>6 & 0x3F); $_String .= chr(0x80 | $_C & 0x3F); } return iconv('UTF-8', 'GB2312', $_String); } function _Array_Combine($_Arr1, $_Arr2) { for($i=0; $i<count($_Arr1); $i++) $_Res[$_Arr1[$i]] = $_Arr2[$i]; return $_Res; } ?>
mumumj/swoole
libs/system/Swoole_content.php
PHP
bsd-3-clause
10,318
// @license // -------------------------------------------------------------------------- // Copyright (C) 2015-2020 Virgil Security, Inc. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // (1) Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // // (2) Redistributions in binary form must reproduce the above copyright // notice, this list of conditions and the following disclaimer in // the documentation and/or other materials provided with the // distribution. // // (3) Neither the name of the copyright holder nor the names of its // contributors may be used to endorse or promote products derived from // this software without specific prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE AUTHOR ''AS IS'' AND ANY EXPRESS OR // IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE // DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR // SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, // STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING // IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE // POSSIBILITY OF SUCH DAMAGE. // // Lead Maintainer: Virgil Security Inc. <[email protected]> // -------------------------------------------------------------------------- // clang-format off // @warning // -------------------------------------------------------------------------- // This file is partially generated. // Generated blocks are enclosed between tags [@<tag>, @end]. // User's code can be added between tags [@end, @<tag>]. // -------------------------------------------------------------------------- // @description // -------------------------------------------------------------------------- // Types of the 'rsa' implementation. // This types SHOULD NOT be used directly. // The only purpose of including this module is to place implementation // object in the stack memory. // -------------------------------------------------------------------------- #ifndef VSCF_RSA_DEFS_H_INCLUDED #define VSCF_RSA_DEFS_H_INCLUDED #include "vscf_library.h" #include "vscf_impl_private.h" #include "vscf_rsa.h" #include "vscf_atomic.h" #include "vscf_impl.h" // clang-format on // @end #ifdef __cplusplus extern "C" { #endif // @generated // -------------------------------------------------------------------------- // clang-format off // Generated section start. // -------------------------------------------------------------------------- // // Handles implementation details. // struct vscf_rsa_t { // // Compile-time known information about this implementation. // const vscf_impl_info_t *info; // // Reference counter. // VSCF_ATOMIC size_t refcnt; // // Dependency to the interface 'random'. // vscf_impl_t *random; }; // -------------------------------------------------------------------------- // Generated section end. // clang-format on // -------------------------------------------------------------------------- // @end #ifdef __cplusplus } #endif // @footer #endif // VSCF_RSA_DEFS_H_INCLUDED // @end
go-virgil/virgil
crypto/wrapper/pkg/linux_amd64__legacy_os/include/virgil/crypto/foundation/private/vscf_rsa_defs.h
C
bsd-3-clause
3,677
/* * Copyright 2015 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef GrMeshDrawOp_DEFINED #define GrMeshDrawOp_DEFINED #include "src/gpu/GrAppliedClip.h" #include "src/gpu/GrGeometryProcessor.h" #include "src/gpu/ops/GrDrawOp.h" #include <type_traits> class SkArenaAlloc; class GrAtlasManager; class GrCaps; class GrMeshDrawTarget; class GrOpFlushState; struct GrSimpleMesh; class GrStrikeCache; /** * Base class for mesh-drawing GrDrawOps. */ class GrMeshDrawOp : public GrDrawOp { public: static bool CanUpgradeAAOnMerge(GrAAType aa1, GrAAType aa2) { return (aa1 == GrAAType::kNone && aa2 == GrAAType::kCoverage) || (aa1 == GrAAType::kCoverage && aa2 == GrAAType::kNone); } protected: GrMeshDrawOp(uint32_t classID); void createProgramInfo(const GrCaps* caps, SkArenaAlloc* arena, const GrSurfaceProxyView& writeView, bool usesMSAASurface, GrAppliedClip&& appliedClip, const GrDstProxyView& dstProxyView, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp) { this->onCreateProgramInfo(caps, arena, writeView, usesMSAASurface, std::move(appliedClip), dstProxyView, renderPassXferBarriers, colorLoadOp); } void createProgramInfo(GrMeshDrawTarget*); /** Helper for rendering repeating meshes using a patterned index buffer. This class creates the space for the vertices and flushes the draws to the GrMeshDrawTarget. */ class PatternHelper { public: PatternHelper(GrMeshDrawTarget*, GrPrimitiveType, size_t vertexStride, sk_sp<const GrBuffer> indexBuffer, int verticesPerRepetition, int indicesPerRepetition, int repeatCount, int maxRepetitions); /** Called to issue draws to the GrMeshDrawTarget.*/ void recordDraw(GrMeshDrawTarget*, const GrGeometryProcessor*) const; void recordDraw(GrMeshDrawTarget*, const GrGeometryProcessor*, const GrSurfaceProxy* const primProcProxies[]) const; void* vertices() const { return fVertices; } GrSimpleMesh* mesh() { return fMesh; } protected: PatternHelper() = default; void init(GrMeshDrawTarget*, GrPrimitiveType, size_t vertexStride, sk_sp<const GrBuffer> indexBuffer, int verticesPerRepetition, int indicesPerRepetition, int repeatCount, int maxRepetitions); private: void* fVertices = nullptr; GrSimpleMesh* fMesh = nullptr; GrPrimitiveType fPrimitiveType; }; /** A specialization of InstanceHelper for quad rendering. * It only draws non-antialiased indexed quads. */ class QuadHelper : private PatternHelper { public: QuadHelper() = delete; QuadHelper(GrMeshDrawTarget*, size_t vertexStride, int quadsToDraw); using PatternHelper::mesh; using PatternHelper::recordDraw; using PatternHelper::vertices; private: using INHERITED = PatternHelper; }; static bool CombinedQuadCountWillOverflow(GrAAType aaType, bool willBeUpgradedToAA, int combinedQuadCount); virtual void onPrePrepareDraws(GrRecordingContext*, const GrSurfaceProxyView& writeView, GrAppliedClip*, const GrDstProxyView&, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp); private: virtual GrProgramInfo* programInfo() = 0; // This method is responsible for creating all the programInfos required // by this op. virtual void onCreateProgramInfo(const GrCaps*, SkArenaAlloc*, const GrSurfaceProxyView& writeView, bool usesMSAASurface, GrAppliedClip&&, const GrDstProxyView&, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp) = 0; void onPrePrepare(GrRecordingContext* context, const GrSurfaceProxyView& writeView, GrAppliedClip* clip, const GrDstProxyView& dstProxyView, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp) final { this->onPrePrepareDraws(context, writeView, clip, dstProxyView, renderPassXferBarriers, colorLoadOp); } void onPrepare(GrOpFlushState* state) final; virtual void onPrepareDraws(GrMeshDrawTarget*) = 0; using INHERITED = GrDrawOp; }; #endif
youtube/cobalt
third_party/skia_next/third_party/skia/src/gpu/ops/GrMeshDrawOp.h
C
bsd-3-clause
5,137
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @version $Id: Entry.php 20325 2010-01-16 00:17:59Z padraic $ */ /** * @namespace */ namespace Zend\Feed\Writer\Extension\Slash\Renderer; use Zend\Feed\Writer\Extension; /** * @uses \Zend\Feed\Writer\Extension\AbstractRenderer * @category Zend * @package Zend_Feed_Writer * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Entry extends Extension\AbstractRenderer { /** * Set to TRUE if a rendering method actually renders something. This * is used to prevent premature appending of a XML namespace declaration * until an element which requires it is actually appended. * * @var bool */ protected $_called = false; /** * Render entry * * @return void */ public function render() { if (strtolower($this->getType()) == 'atom') { return; // RSS 2.0 only } $this->_setCommentCount($this->_dom, $this->_base); if ($this->_called) { $this->_appendNamespaces(); } } /** * Append entry namespaces * * @return void */ protected function _appendNamespaces() { $this->getRootElement()->setAttribute('xmlns:slash', 'http://purl.org/rss/1.0/modules/slash/'); } /** * Set entry comment count * * @param DOMDocument $dom * @param DOMElement $root * @return void */ protected function _setCommentCount(\DOMDocument $dom, \DOMElement $root) { $count = $this->getDataContainer()->getCommentCount(); if (!$count) { $count = 0; } $tcount = $this->_dom->createElement('slash:comments'); $tcount->nodeValue = $count; $root->appendChild($tcount); $this->_called = true; } }
ornicar/zf2
library/Zend/Feed/Writer/Extension/Slash/Renderer/Entry.php
PHP
bsd-3-clause
2,582
<?php namespace ZfcAcl\Model; class EventGuardDefMap extends \ArrayObject { }
heronour/Frame
vendor/ZfcAcl/src/ZfcAcl/Model/EventGuardDefMap.php
PHP
bsd-3-clause
79
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\Console\Prompt; use Zend\Console\Prompt\Number; use ZendTest\Console\TestAssets\ConsoleAdapter; /** * @group Zend_Console */ class NumberTest extends \PHPUnit_Framework_TestCase { /** * @var ConsoleAdapter */ protected $adapter; public function setUp() { $this->adapter = new ConsoleAdapter(); $this->adapter->stream = fopen('php://memory', 'w+'); } public function tearDown() { fclose($this->adapter->stream); } public function testCanReadNumber() { fwrite($this->adapter->stream, "123"); $number = new Number(); $number->setConsole($this->adapter); ob_start(); $response = $number->show(); $text = ob_get_clean(); $this->assertEquals($text, "Please enter a number: "); $this->assertEquals('123', $response); } public function testCanReadNumberOnMultilign() { fwrite($this->adapter->stream, "a" . PHP_EOL); fwrite($this->adapter->stream, "123" . PHP_EOL); rewind($this->adapter->stream); $this->adapter->autoRewind = false; $number = new Number(); $number->setConsole($this->adapter); ob_start(); $response = $number->show(); $text = ob_get_clean(); $this->assertContains('a is not a number', $text); $this->assertEquals('123', $response); } public function testCanNotReadFloatByDefault() { fwrite($this->adapter->stream, "1.23" . PHP_EOL); fwrite($this->adapter->stream, "123" . PHP_EOL); rewind($this->adapter->stream); $this->adapter->autoRewind = false; $number = new Number(); $number->setConsole($this->adapter); ob_start(); $response = $number->show(); $text = ob_get_clean(); $this->assertContains('Please enter a non-floating number', $text); $this->assertEquals('123', $response); } public function testCanForceToReadFloat() { fwrite($this->adapter->stream, "1.23" . PHP_EOL); fwrite($this->adapter->stream, "123" . PHP_EOL); rewind($this->adapter->stream); $this->adapter->autoRewind = false; $number = new Number('Give me a number', false, true); $number->setConsole($this->adapter); ob_start(); $response = $number->show(); $text = ob_get_clean(); $this->assertEquals($text, 'Give me a number'); $this->assertEquals('1.23', $response); } public function testCanDefineAMax() { fwrite($this->adapter->stream, "1" . PHP_EOL); fwrite($this->adapter->stream, "11" . PHP_EOL); fwrite($this->adapter->stream, "6" . PHP_EOL); rewind($this->adapter->stream); $this->adapter->autoRewind = false; $number = new Number('Give me a number', false, false, 5, 10); $number->setConsole($this->adapter); ob_start(); $response = $number->show(); $text = ob_get_clean(); $this->assertContains('Please enter a number not smaller than 5', $text); $this->assertContains('Please enter a number not greater than 10', $text); $this->assertEquals('6', $response); } }
campersau/zf2
tests/ZendTest/Console/Prompt/NumberTest.php
PHP
bsd-3-clause
3,564
/* =================================================== * bootstrap-transition.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#transitions * =================================================== * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* CSS TRANSITION SUPPORT (http://www.modernizr.com/) * ======================================================= */ $(function () { $.support.transition = (function () { var transitionEnd = (function () { var el = document.createElement('bootstrap') , transEndEventNames = { 'WebkitTransition' : 'webkitTransitionEnd' , 'MozTransition' : 'transitionend' , 'OTransition' : 'oTransitionEnd otransitionend' , 'transition' : 'transitionend' } , name for (name in transEndEventNames){ if (el.style[name] !== undefined) { return transEndEventNames[name] } } }()) return transitionEnd && { end: transitionEnd } })() }) }(window.jQuery);/* ========================================================== * bootstrap-alert.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#alerts * ========================================================== * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* ALERT CLASS DEFINITION * ====================== */ var dismiss = '[data-dismiss="alert"]' , Alert = function (el) { $(el).on('click', dismiss, this.close) } Alert.prototype.close = function (e) { var $this = $(this) , selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } $parent = $(selector) e && e.preventDefault() $parent.length || ($parent = $this.hasClass('alert') ? $this : $this.parent()) $parent.trigger(e = $.Event('close')) if (e.isDefaultPrevented()) return $parent.removeClass('in') function removeElement() { $parent .trigger('closed') .remove() } $.support.transition && $parent.hasClass('fade') ? $parent.on($.support.transition.end, removeElement) : removeElement() } /* ALERT PLUGIN DEFINITION * ======================= */ var old = $.fn.alert $.fn.alert = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('alert') if (!data) $this.data('alert', (data = new Alert(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.alert.Constructor = Alert /* ALERT NO CONFLICT * ================= */ $.fn.alert.noConflict = function () { $.fn.alert = old return this } /* ALERT DATA-API * ============== */ $(document).on('click.alert.data-api', dismiss, Alert.prototype.close) }(window.jQuery);/* ============================================================ * bootstrap-button.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#buttons * ============================================================ * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* BUTTON PUBLIC CLASS DEFINITION * ============================== */ var Button = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.button.defaults, options) } Button.prototype.setState = function (state) { var d = 'disabled' , $el = this.$element , data = $el.data() , val = $el.is('input') ? 'val' : 'html' state = state + 'Text' data.resetText || $el.data('resetText', $el[val]()) $el[val](data[state] || this.options[state]) // push to event loop to allow forms to submit setTimeout(function () { state == 'loadingText' ? $el.addClass(d).attr(d, d) : $el.removeClass(d).removeAttr(d) }, 0) } Button.prototype.toggle = function () { var $parent = this.$element.closest('[data-toggle="buttons-radio"]') $parent && $parent .find('.active') .removeClass('active') this.$element.toggleClass('active') } /* BUTTON PLUGIN DEFINITION * ======================== */ var old = $.fn.button $.fn.button = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('button') , options = typeof option == 'object' && option if (!data) $this.data('button', (data = new Button(this, options))) if (option == 'toggle') data.toggle() else if (option) data.setState(option) }) } $.fn.button.defaults = { loadingText: 'loading...' } $.fn.button.Constructor = Button /* BUTTON NO CONFLICT * ================== */ $.fn.button.noConflict = function () { $.fn.button = old return this } /* BUTTON DATA-API * =============== */ $(document).on('click.button.data-api', '[data-toggle^=button]', function (e) { var $btn = $(e.target) if (!$btn.hasClass('btn')) $btn = $btn.closest('.btn') $btn.button('toggle') }) }(window.jQuery);/* ========================================================== * bootstrap-carousel.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#carousel * ========================================================== * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* CAROUSEL CLASS DEFINITION * ========================= */ var Carousel = function (element, options) { this.$element = $(element) this.$indicators = this.$element.find('.carousel-indicators') this.options = options this.options.pause == 'hover' && this.$element .on('mouseenter', $.proxy(this.pause, this)) .on('mouseleave', $.proxy(this.cycle, this)) } Carousel.prototype = { cycle: function (e) { if (!e) this.paused = false this.options.interval && !this.paused && (this.interval = setInterval($.proxy(this.next, this), this.options.interval)) return this } , getActiveIndex: function () { this.$active = this.$element.find('.item.active') this.$items = this.$active.parent().children() return this.$items.index(this.$active) } , to: function (pos) { var activeIndex = this.getActiveIndex() , that = this if (pos > (this.$items.length - 1) || pos < 0) return if (this.sliding) { return this.$element.one('slid', function () { that.to(pos) }) } if (activeIndex == pos) { return this.pause().cycle() } return this.slide(pos > activeIndex ? 'next' : 'prev', $(this.$items[pos])) } , pause: function (e) { if (!e) this.paused = true if (this.$element.find('.next, .prev').length && $.support.transition.end) { this.$element.trigger($.support.transition.end) this.cycle() } clearInterval(this.interval) this.interval = null return this } , next: function () { if (this.sliding) return return this.slide('next') } , prev: function () { if (this.sliding) return return this.slide('prev') } , slide: function (type, next) { var $active = this.$element.find('.item.active') , $next = next || $active[type]() , isCycling = this.interval , direction = type == 'next' ? 'left' : 'right' , fallback = type == 'next' ? 'first' : 'last' , that = this , e this.sliding = true isCycling && this.pause() $next = $next.length ? $next : this.$element.find('.item')[fallback]() e = $.Event('slide', { relatedTarget: $next[0] , direction: direction }) if ($next.hasClass('active')) return if (this.$indicators.length) { this.$indicators.find('.active').removeClass('active') this.$element.one('slid', function () { var $nextIndicator = $(that.$indicators.children()[that.getActiveIndex()]) $nextIndicator && $nextIndicator.addClass('active') }) } if ($.support.transition && this.$element.hasClass('slide')) { this.$element.trigger(e) if (e.isDefaultPrevented()) return $next.addClass(type) $next[0].offsetWidth // force reflow $active.addClass(direction) $next.addClass(direction) this.$element.one($.support.transition.end, function () { $next.removeClass([type, direction].join(' ')).addClass('active') $active.removeClass(['active', direction].join(' ')) that.sliding = false setTimeout(function () { that.$element.trigger('slid') }, 0) }) } else { this.$element.trigger(e) if (e.isDefaultPrevented()) return $active.removeClass('active') $next.addClass('active') this.sliding = false this.$element.trigger('slid') } isCycling && this.cycle() return this } } /* CAROUSEL PLUGIN DEFINITION * ========================== */ var old = $.fn.carousel $.fn.carousel = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('carousel') , options = $.extend({}, $.fn.carousel.defaults, typeof option == 'object' && option) , action = typeof option == 'string' ? option : options.slide if (!data) $this.data('carousel', (data = new Carousel(this, options))) if (typeof option == 'number') data.to(option) else if (action) data[action]() else if (options.interval) data.pause().cycle() }) } $.fn.carousel.defaults = { interval: 5000 , pause: 'hover' } $.fn.carousel.Constructor = Carousel /* CAROUSEL NO CONFLICT * ==================== */ $.fn.carousel.noConflict = function () { $.fn.carousel = old return this } /* CAROUSEL DATA-API * ================= */ $(document).on('click.carousel.data-api', '[data-slide], [data-slide-to]', function (e) { var $this = $(this), href , $target = $($this.attr('data-target') || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 , options = $.extend({}, $target.data(), $this.data()) , slideIndex $target.carousel(options) if (slideIndex = $this.attr('data-slide-to')) { $target.data('carousel').pause().to(slideIndex).cycle() } e.preventDefault() }) }(window.jQuery);/* ============================================================= * bootstrap-collapse.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#collapse * ============================================================= * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* COLLAPSE PUBLIC CLASS DEFINITION * ================================ */ var Collapse = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.collapse.defaults, options) if (this.options.parent) { this.$parent = $(this.options.parent) } this.options.toggle && this.toggle() } Collapse.prototype = { constructor: Collapse , dimension: function () { var hasWidth = this.$element.hasClass('width') return hasWidth ? 'width' : 'height' } , show: function () { var dimension , scroll , actives , hasData if (this.transitioning || this.$element.hasClass('in')) return dimension = this.dimension() scroll = $.camelCase(['scroll', dimension].join('-')) actives = this.$parent && this.$parent.find('> .accordion-group > .in') if (actives && actives.length) { hasData = actives.data('collapse') if (hasData && hasData.transitioning) return actives.collapse('hide') hasData || actives.data('collapse', null) } this.$element[dimension](0) this.transition('addClass', $.Event('show'), 'shown') $.support.transition && this.$element[dimension](this.$element[0][scroll]) } , hide: function () { var dimension if (this.transitioning) return dimension = this.dimension() this.reset(this.$element[dimension]()) this.transition('removeClass', $.Event('hide'), 'hidden') this.$element[dimension](0) } , reset: function (size) { var dimension = this.dimension() this.$element .removeClass('collapse') [dimension](size || 'auto') [0].offsetWidth this.$element[size !== null ? 'addClass' : 'removeClass']('collapse') return this } , transition: function (method, startEvent, completeEvent) { var that = this , complete = function () { if (startEvent.type == 'show') that.reset() that.transitioning = 0 that.$element.trigger(completeEvent) } this.$element.trigger(startEvent) if (startEvent.isDefaultPrevented()) return this.transitioning = 1 this.$element[method]('in') $.support.transition && this.$element.hasClass('collapse') ? this.$element.one($.support.transition.end, complete) : complete() } , toggle: function () { this[this.$element.hasClass('in') ? 'hide' : 'show']() } } /* COLLAPSE PLUGIN DEFINITION * ========================== */ var old = $.fn.collapse $.fn.collapse = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('collapse') , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option) if (!data) $this.data('collapse', (data = new Collapse(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.collapse.defaults = { toggle: true } $.fn.collapse.Constructor = Collapse /* COLLAPSE NO CONFLICT * ==================== */ $.fn.collapse.noConflict = function () { $.fn.collapse = old return this } /* COLLAPSE DATA-API * ================= */ $(document).on('click.collapse.data-api', '[data-toggle=collapse]', function (e) { var $this = $(this), href , target = $this.attr('data-target') || e.preventDefault() || (href = $this.attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '') //strip for ie7 , option = $(target).data('collapse') ? 'toggle' : $this.data() $this[$(target).hasClass('in') ? 'addClass' : 'removeClass']('collapsed') $(target).collapse(option) }) }(window.jQuery);/* ============================================================ * bootstrap-dropdown.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#dropdowns * ============================================================ * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* DROPDOWN CLASS DEFINITION * ========================= */ var toggle = '[data-toggle=dropdown]' , Dropdown = function (element) { var $el = $(element).on('click.dropdown.data-api', this.toggle) $('html').on('click.dropdown.data-api', function () { $el.parent().removeClass('open') }) } Dropdown.prototype = { constructor: Dropdown , toggle: function (e) { var $this = $(this) , $parent , isActive if ($this.is('.disabled, :disabled')) return $parent = getParent($this) isActive = $parent.hasClass('open') clearMenus() if (!isActive) { $parent.toggleClass('open') } $this.focus() return false } , keydown: function (e) { var $this , $items , $active , $parent , isActive , index if (!/(38|40|27)/.test(e.keyCode)) return $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return $parent = getParent($this) isActive = $parent.hasClass('open') if (!isActive || (isActive && e.keyCode == 27)) { if (e.which == 27) $parent.find(toggle).focus() return $this.click() } $items = $('[role=menu] li:not(.divider):visible a', $parent) if (!$items.length) return index = $items.index($items.filter(':focus')) if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (!~index) index = 0 $items .eq(index) .focus() } } function clearMenus() { $(toggle).each(function () { getParent($(this)).removeClass('open') }) } function getParent($this) { var selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } $parent = selector && $(selector) if (!$parent || !$parent.length) $parent = $this.parent() return $parent } /* DROPDOWN PLUGIN DEFINITION * ========================== */ var old = $.fn.dropdown $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('dropdown') if (!data) $this.data('dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.dropdown.Constructor = Dropdown /* DROPDOWN NO CONFLICT * ==================== */ $.fn.dropdown.noConflict = function () { $.fn.dropdown = old return this } /* APPLY TO STANDARD DROPDOWN ELEMENTS * =================================== */ $(document) .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) .on('click.dropdown.data-api touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('touchstart.dropdown.data-api', '.dropdown-menu', function (e) { e.stopPropagation() }) .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) }(window.jQuery);/* ========================================================= * bootstrap-modal.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#modals * ========================================================= * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================= */ !function ($) { "use strict"; // jshint ;_; /* MODAL CLASS DEFINITION * ====================== */ var Modal = function (element, options) { this.options = options this.$element = $(element) .delegate('[data-dismiss="modal"]', 'click.dismiss.modal', $.proxy(this.hide, this)) this.options.remote && this.$element.find('.modal-body').load(this.options.remote) } Modal.prototype = { constructor: Modal , toggle: function () { return this[!this.isShown ? 'show' : 'hide']() } , show: function () { var that = this , e = $.Event('show') this.$element.trigger(e) if (this.isShown || e.isDefaultPrevented()) return this.isShown = true this.escape() this.backdrop(function () { var transition = $.support.transition && that.$element.hasClass('fade') if (!that.$element.parent().length) { that.$element.appendTo(document.body) //don't move modals dom position } that.$element.show() if (transition) { that.$element[0].offsetWidth // force reflow } that.$element .addClass('in') .attr('aria-hidden', false) that.enforceFocus() transition ? that.$element.one($.support.transition.end, function () { that.$element.focus().trigger('shown') }) : that.$element.focus().trigger('shown') }) } , hide: function (e) { e && e.preventDefault() var that = this e = $.Event('hide') this.$element.trigger(e) if (!this.isShown || e.isDefaultPrevented()) return this.isShown = false this.escape() $(document).off('focusin.modal') this.$element .removeClass('in') .attr('aria-hidden', true) $.support.transition && this.$element.hasClass('fade') ? this.hideWithTransition() : this.hideModal() } , enforceFocus: function () { var that = this $(document).on('focusin.modal', function (e) { if (that.$element[0] !== e.target && !that.$element.has(e.target).length) { that.$element.focus() } }) } , escape: function () { var that = this if (this.isShown && this.options.keyboard) { this.$element.on('keyup.dismiss.modal', function ( e ) { e.which == 27 && that.hide() }) } else if (!this.isShown) { this.$element.off('keyup.dismiss.modal') } } , hideWithTransition: function () { var that = this , timeout = setTimeout(function () { that.$element.off($.support.transition.end) that.hideModal() }, 500) this.$element.one($.support.transition.end, function () { clearTimeout(timeout) that.hideModal() }) } , hideModal: function (that) { this.$element .hide() .trigger('hidden') this.backdrop() } , removeBackdrop: function () { this.$backdrop.remove() this.$backdrop = null } , backdrop: function (callback) { var that = this , animate = this.$element.hasClass('fade') ? 'fade' : '' if (this.isShown && this.options.backdrop) { var doAnimate = $.support.transition && animate this.$backdrop = $('<div class="modal-backdrop ' + animate + '" />') .appendTo(document.body) this.$backdrop.click( this.options.backdrop == 'static' ? $.proxy(this.$element[0].focus, this.$element[0]) : $.proxy(this.hide, this) ) if (doAnimate) this.$backdrop[0].offsetWidth // force reflow this.$backdrop.addClass('in') doAnimate ? this.$backdrop.one($.support.transition.end, callback) : callback() } else if (!this.isShown && this.$backdrop) { this.$backdrop.removeClass('in') $.support.transition && this.$element.hasClass('fade')? this.$backdrop.one($.support.transition.end, $.proxy(this.removeBackdrop, this)) : this.removeBackdrop() } else if (callback) { callback() } } } /* MODAL PLUGIN DEFINITION * ======================= */ var old = $.fn.modal $.fn.modal = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('modal') , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option) if (!data) $this.data('modal', (data = new Modal(this, options))) if (typeof option == 'string') data[option]() else if (options.show) data.show() }) } $.fn.modal.defaults = { backdrop: true , keyboard: true , show: true } $.fn.modal.Constructor = Modal /* MODAL NO CONFLICT * ================= */ $.fn.modal.noConflict = function () { $.fn.modal = old return this } /* MODAL DATA-API * ============== */ $(document).on('click.modal.data-api', '[data-toggle="modal"]', function (e) { var $this = $(this) , href = $this.attr('href') , $target = $($this.attr('data-target') || (href && href.replace(/.*(?=#[^\s]+$)/, ''))) //strip for ie7 , option = $target.data('modal') ? 'toggle' : $.extend({ remote:!/#/.test(href) && href }, $target.data(), $this.data()) e.preventDefault() $target .modal(option) .one('hide', function () { $this.focus() }) }) }(window.jQuery); /* =========================================================== * bootstrap-tooltip.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#tooltips * Inspired by the original jQuery.tipsy by Jason Frame * =========================================================== * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* TOOLTIP PUBLIC CLASS DEFINITION * =============================== */ var Tooltip = function (element, options) { this.init('tooltip', element, options) } Tooltip.prototype = { constructor: Tooltip , init: function (type, element, options) { var eventIn , eventOut , triggers , trigger , i this.type = type this.$element = $(element) this.options = this.getOptions(options) this.enabled = true triggers = this.options.trigger.split(' ') for (i = triggers.length; i--;) { trigger = triggers[i] if (trigger == 'click') { this.$element.on('click.' + this.type, this.options.selector, $.proxy(this.toggle, this)) } else if (trigger != 'manual') { eventIn = trigger == 'hover' ? 'mouseenter' : 'focus' eventOut = trigger == 'hover' ? 'mouseleave' : 'blur' this.$element.on(eventIn + '.' + this.type, this.options.selector, $.proxy(this.enter, this)) this.$element.on(eventOut + '.' + this.type, this.options.selector, $.proxy(this.leave, this)) } } this.options.selector ? (this._options = $.extend({}, this.options, { trigger: 'manual', selector: '' })) : this.fixTitle() } , getOptions: function (options) { options = $.extend({}, $.fn[this.type].defaults, options, this.$element.data()) if (options.delay && typeof options.delay == 'number') { options.delay = { show: options.delay , hide: options.delay } } return options } , enter: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) if (!self.options.delay || !self.options.delay.show) return self.show() clearTimeout(this.timeout) self.hoverState = 'in' this.timeout = setTimeout(function() { if (self.hoverState == 'in') self.show() }, self.options.delay.show) } , leave: function (e) { var self = $(e.currentTarget)[this.type](this._options).data(this.type) if (this.timeout) clearTimeout(this.timeout) if (!self.options.delay || !self.options.delay.hide) return self.hide() self.hoverState = 'out' this.timeout = setTimeout(function() { if (self.hoverState == 'out') self.hide() }, self.options.delay.hide) } , show: function () { var $tip , pos , actualWidth , actualHeight , placement , tp , e = $.Event('show') if (this.hasContent() && this.enabled) { this.$element.trigger(e) if (e.isDefaultPrevented()) return $tip = this.tip() this.setContent() if (this.options.animation) { $tip.addClass('fade') } placement = typeof this.options.placement == 'function' ? this.options.placement.call(this, $tip[0], this.$element[0]) : this.options.placement $tip .detach() .css({ top: 0, left: 0, display: 'block' }) this.options.container ? $tip.appendTo(this.options.container) : $tip.insertAfter(this.$element) pos = this.getPosition() actualWidth = $tip[0].offsetWidth actualHeight = $tip[0].offsetHeight switch (placement) { case 'bottom': tp = {top: pos.top + pos.height, left: pos.left + pos.width / 2 - actualWidth / 2} break case 'top': tp = {top: pos.top - actualHeight, left: pos.left + pos.width / 2 - actualWidth / 2} break case 'left': tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left - actualWidth} break case 'right': tp = {top: pos.top + pos.height / 2 - actualHeight / 2, left: pos.left + pos.width} break } $tip .offset(tp) .addClass(placement) .addClass('in') this.$element.trigger('shown') } } , setContent: function () { var $tip = this.tip() , title = this.getTitle() $tip.find('.tooltip-inner')[this.options.html ? 'html' : 'text'](title) $tip.removeClass('fade in top bottom left right') } , hide: function () { var that = this , $tip = this.tip() , e = $.Event('hide') this.$element.trigger(e) if (e.isDefaultPrevented()) return $tip.removeClass('in') function removeWithAnimation() { var timeout = setTimeout(function () { $tip.off($.support.transition.end).detach() }, 500) $tip.one($.support.transition.end, function () { clearTimeout(timeout) $tip.detach() }) } $.support.transition && this.$tip.hasClass('fade') ? removeWithAnimation() : $tip.detach() this.$element.trigger('hidden') return this } , fixTitle: function () { var $e = this.$element if ($e.attr('title') || typeof($e.attr('data-original-title')) != 'string') { $e.attr('data-original-title', $e.attr('title') || '').removeAttr('title') } } , hasContent: function () { return this.getTitle() } , getPosition: function () { var el = this.$element[0] return $.extend({}, el.getBoundingClientRect ? el.getBoundingClientRect() : { width: el.offsetWidth , height: el.offsetHeight }, this.$element.offset()) } , getTitle: function () { var title , $e = this.$element , o = this.options title = $e.attr('data-original-title') || (typeof o.title == 'function' ? o.title.call($e[0]) : o.title) return title } , tip: function () { return this.$tip = this.$tip || $(this.options.template) } , validate: function () { if (!this.$element[0].parentNode) { this.hide() this.$element = null this.options = null } } , enable: function () { this.enabled = true } , disable: function () { this.enabled = false } , toggleEnabled: function () { this.enabled = !this.enabled } , toggle: function (e) { var self = e ? $(e.currentTarget)[this.type](this._options).data(this.type) : this self.tip().hasClass('in') ? self.hide() : self.show() } , destroy: function () { this.hide().$element.off('.' + this.type).removeData(this.type) } } /* TOOLTIP PLUGIN DEFINITION * ========================= */ var old = $.fn.tooltip $.fn.tooltip = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tooltip') , options = typeof option == 'object' && option if (!data) $this.data('tooltip', (data = new Tooltip(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.tooltip.Constructor = Tooltip $.fn.tooltip.defaults = { animation: true , placement: 'top' , selector: false , template: '<div class="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>' , trigger: 'hover focus' , title: '' , delay: 0 , html: false , container: false } /* TOOLTIP NO CONFLICT * =================== */ $.fn.tooltip.noConflict = function () { $.fn.tooltip = old return this } }(window.jQuery); /* =========================================================== * bootstrap-popover.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#popovers * =========================================================== * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * =========================================================== */ !function ($) { "use strict"; // jshint ;_; /* POPOVER PUBLIC CLASS DEFINITION * =============================== */ var Popover = function (element, options) { this.init('popover', element, options) } /* NOTE: POPOVER EXTENDS BOOTSTRAP-TOOLTIP.js ========================================== */ Popover.prototype = $.extend({}, $.fn.tooltip.Constructor.prototype, { constructor: Popover , setContent: function () { var $tip = this.tip() , title = this.getTitle() , content = this.getContent() $tip.find('.popover-title')[this.options.html ? 'html' : 'text'](title) $tip.find('.popover-content')[this.options.html ? 'html' : 'text'](content) $tip.removeClass('fade top bottom left right in') } , hasContent: function () { return this.getTitle() || this.getContent() } , getContent: function () { var content , $e = this.$element , o = this.options content = $e.attr('data-content') || (typeof o.content == 'function' ? o.content.call($e[0]) : o.content) return content } , tip: function () { if (!this.$tip) { this.$tip = $(this.options.template) } return this.$tip } , destroy: function () { this.hide().$element.off('.' + this.type).removeData(this.type) } }) /* POPOVER PLUGIN DEFINITION * ======================= */ var old = $.fn.popover $.fn.popover = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('popover') , options = typeof option == 'object' && option if (!data) $this.data('popover', (data = new Popover(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.popover.Constructor = Popover $.fn.popover.defaults = $.extend({} , $.fn.tooltip.defaults, { placement: 'right' , trigger: 'click' , content: '' , template: '<div class="popover"><div class="arrow"></div><div class="popover-inner"><h3 class="popover-title"></h3><div class="popover-content"></div></div></div>' }) /* POPOVER NO CONFLICT * =================== */ $.fn.popover.noConflict = function () { $.fn.popover = old return this } }(window.jQuery);/* ============================================================= * bootstrap-scrollspy.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#scrollspy * ============================================================= * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================== */ !function ($) { "use strict"; // jshint ;_; /* SCROLLSPY CLASS DEFINITION * ========================== */ function ScrollSpy(element, options) { var process = $.proxy(this.process, this) , $element = $(element).is('body') ? $(window) : $(element) , href this.options = $.extend({}, $.fn.scrollspy.defaults, options) this.$scrollElement = $element.on('scroll.scroll-spy.data-api', process) this.selector = (this.options.target || ((href = $(element).attr('href')) && href.replace(/.*(?=#[^\s]+$)/, '')) //strip for ie7 || '') + ' .nav li > a' this.$body = $('body') this.refresh() this.process() } ScrollSpy.prototype = { constructor: ScrollSpy , refresh: function () { var self = this , $targets this.offsets = $([]) this.targets = $([]) $targets = this.$body .find(this.selector) .map(function () { var $el = $(this) , href = $el.data('target') || $el.attr('href') , $href = /^#\w/.test(href) && $(href) return ( $href && $href.length && [[ $href.position().top + (!$.isWindow(self.$scrollElement.get(0)) && self.$scrollElement.scrollTop()), href ]] ) || null }) .sort(function (a, b) { return a[0] - b[0] }) .each(function () { self.offsets.push(this[0]) self.targets.push(this[1]) }) } , process: function () { var scrollTop = this.$scrollElement.scrollTop() + this.options.offset , scrollHeight = this.$scrollElement[0].scrollHeight || this.$body[0].scrollHeight , maxScroll = scrollHeight - this.$scrollElement.height() , offsets = this.offsets , targets = this.targets , activeTarget = this.activeTarget , i if (scrollTop >= maxScroll) { return activeTarget != (i = targets.last()[0]) && this.activate ( i ) } for (i = offsets.length; i--;) { activeTarget != targets[i] && scrollTop >= offsets[i] && (!offsets[i + 1] || scrollTop <= offsets[i + 1]) && this.activate( targets[i] ) } } , activate: function (target) { var active , selector this.activeTarget = target $(this.selector) .parent('.active') .removeClass('active') selector = this.selector + '[data-target="' + target + '"],' + this.selector + '[href="' + target + '"]' active = $(selector) .parent('li') .addClass('active') if (active.parent('.dropdown-menu').length) { active = active.closest('li.dropdown').addClass('active') } active.trigger('activate') } } /* SCROLLSPY PLUGIN DEFINITION * =========================== */ var old = $.fn.scrollspy $.fn.scrollspy = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('scrollspy') , options = typeof option == 'object' && option if (!data) $this.data('scrollspy', (data = new ScrollSpy(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.scrollspy.Constructor = ScrollSpy $.fn.scrollspy.defaults = { offset: 10 } /* SCROLLSPY NO CONFLICT * ===================== */ $.fn.scrollspy.noConflict = function () { $.fn.scrollspy = old return this } /* SCROLLSPY DATA-API * ================== */ $(window).on('load', function () { $('[data-spy="scroll"]').each(function () { var $spy = $(this) $spy.scrollspy($spy.data()) }) }) }(window.jQuery);/* ======================================================== * bootstrap-tab.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#tabs * ======================================================== * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================== */ !function ($) { "use strict"; // jshint ;_; /* TAB CLASS DEFINITION * ==================== */ var Tab = function (element) { this.element = $(element) } Tab.prototype = { constructor: Tab , show: function () { var $this = this.element , $ul = $this.closest('ul:not(.dropdown-menu)') , selector = $this.attr('data-target') , previous , $target , e if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } if ( $this.parent('li').hasClass('active') ) return previous = $ul.find('.active:last a')[0] e = $.Event('show', { relatedTarget: previous }) $this.trigger(e) if (e.isDefaultPrevented()) return $target = $(selector) this.activate($this.parent('li'), $ul) this.activate($target, $target.parent(), function () { $this.trigger({ type: 'shown' , relatedTarget: previous }) }) } , activate: function ( element, container, callback) { var $active = container.find('> .active') , transition = callback && $.support.transition && $active.hasClass('fade') function next() { $active .removeClass('active') .find('> .dropdown-menu > .active') .removeClass('active') element.addClass('active') if (transition) { element[0].offsetWidth // reflow for transition element.addClass('in') } else { element.removeClass('fade') } if ( element.parent('.dropdown-menu') ) { element.closest('li.dropdown').addClass('active') } callback && callback() } transition ? $active.one($.support.transition.end, next) : next() $active.removeClass('in') } } /* TAB PLUGIN DEFINITION * ===================== */ var old = $.fn.tab $.fn.tab = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tab') if (!data) $this.data('tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } $.fn.tab.Constructor = Tab /* TAB NO CONFLICT * =============== */ $.fn.tab.noConflict = function () { $.fn.tab = old return this } /* TAB DATA-API * ============ */ $(document).on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() $(this).tab('show') }) }(window.jQuery);/* ============================================================= * bootstrap-typeahead.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#typeahead * ============================================================= * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function($){ "use strict"; // jshint ;_; /* TYPEAHEAD PUBLIC CLASS DEFINITION * ================================= */ var Typeahead = function (element, options) { this.$element = $(element) this.options = $.extend({}, $.fn.typeahead.defaults, options) this.matcher = this.options.matcher || this.matcher this.sorter = this.options.sorter || this.sorter this.highlighter = this.options.highlighter || this.highlighter this.updater = this.options.updater || this.updater this.source = this.options.source this.$menu = $(this.options.menu) this.shown = false this.listen() } Typeahead.prototype = { constructor: Typeahead , select: function () { var val = this.$menu.find('.active').attr('data-value') this.$element .val(this.updater(val)) .change() return this.hide() } , updater: function (item) { return item } , show: function () { var pos = $.extend({}, this.$element.position(), { height: this.$element[0].offsetHeight }) this.$menu .insertAfter(this.$element) .css({ top: pos.top + pos.height , left: pos.left }) .show() this.shown = true return this } , hide: function () { this.$menu.hide() this.shown = false return this } , lookup: function (event) { var items this.query = this.$element.val() if (!this.query || this.query.length < this.options.minLength) { return this.shown ? this.hide() : this } items = $.isFunction(this.source) ? this.source(this.query, $.proxy(this.process, this)) : this.source return items ? this.process(items) : this } , process: function (items) { var that = this items = $.grep(items, function (item) { return that.matcher(item) }) items = this.sorter(items) if (!items.length) { return this.shown ? this.hide() : this } return this.render(items.slice(0, this.options.items)).show() } , matcher: function (item) { return ~item.toLowerCase().indexOf(this.query.toLowerCase()) } , sorter: function (items) { var beginswith = [] , caseSensitive = [] , caseInsensitive = [] , item while (item = items.shift()) { if (!item.toLowerCase().indexOf(this.query.toLowerCase())) beginswith.push(item) else if (~item.indexOf(this.query)) caseSensitive.push(item) else caseInsensitive.push(item) } return beginswith.concat(caseSensitive, caseInsensitive) } , highlighter: function (item) { var query = this.query.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, '\\$&') return item.replace(new RegExp('(' + query + ')', 'ig'), function ($1, match) { return '<strong>' + match + '</strong>' }) } , render: function (items) { var that = this items = $(items).map(function (i, item) { i = $(that.options.item).attr('data-value', item) i.find('a').html(that.highlighter(item)) return i[0] }) items.first().addClass('active') this.$menu.html(items) return this } , next: function (event) { var active = this.$menu.find('.active').removeClass('active') , next = active.next() if (!next.length) { next = $(this.$menu.find('li')[0]) } next.addClass('active') } , prev: function (event) { var active = this.$menu.find('.active').removeClass('active') , prev = active.prev() if (!prev.length) { prev = this.$menu.find('li').last() } prev.addClass('active') } , listen: function () { this.$element .on('focus', $.proxy(this.focus, this)) .on('blur', $.proxy(this.blur, this)) .on('keypress', $.proxy(this.keypress, this)) .on('keyup', $.proxy(this.keyup, this)) if (this.eventSupported('keydown')) { this.$element.on('keydown', $.proxy(this.keydown, this)) } this.$menu .on('click', $.proxy(this.click, this)) .on('mouseenter', 'li', $.proxy(this.mouseenter, this)) .on('mouseleave', 'li', $.proxy(this.mouseleave, this)) } , eventSupported: function(eventName) { var isSupported = eventName in this.$element if (!isSupported) { this.$element.setAttribute(eventName, 'return;') isSupported = typeof this.$element[eventName] === 'function' } return isSupported } , move: function (e) { if (!this.shown) return switch(e.keyCode) { case 9: // tab case 13: // enter case 27: // escape e.preventDefault() break case 38: // up arrow e.preventDefault() this.prev() break case 40: // down arrow e.preventDefault() this.next() break } e.stopPropagation() } , keydown: function (e) { this.suppressKeyPressRepeat = ~$.inArray(e.keyCode, [40,38,9,13,27]) this.move(e) } , keypress: function (e) { if (this.suppressKeyPressRepeat) return this.move(e) } , keyup: function (e) { switch(e.keyCode) { case 40: // down arrow case 38: // up arrow case 16: // shift case 17: // ctrl case 18: // alt break case 9: // tab case 13: // enter if (!this.shown) return this.select() break case 27: // escape if (!this.shown) return this.hide() break default: this.lookup() } e.stopPropagation() e.preventDefault() } , focus: function (e) { this.focused = true } , blur: function (e) { this.focused = false if (!this.mousedover && this.shown) this.hide() } , click: function (e) { e.stopPropagation() e.preventDefault() this.select() this.$element.focus() } , mouseenter: function (e) { this.mousedover = true this.$menu.find('.active').removeClass('active') $(e.currentTarget).addClass('active') } , mouseleave: function (e) { this.mousedover = false if (!this.focused && this.shown) this.hide() } } /* TYPEAHEAD PLUGIN DEFINITION * =========================== */ var old = $.fn.typeahead $.fn.typeahead = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('typeahead') , options = typeof option == 'object' && option if (!data) $this.data('typeahead', (data = new Typeahead(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.typeahead.defaults = { source: [] , items: 8 , menu: '<ul class="typeahead dropdown-menu"></ul>' , item: '<li><a href="#"></a></li>' , minLength: 1 } $.fn.typeahead.Constructor = Typeahead /* TYPEAHEAD NO CONFLICT * =================== */ $.fn.typeahead.noConflict = function () { $.fn.typeahead = old return this } /* TYPEAHEAD DATA-API * ================== */ $(document).on('focus.typeahead.data-api', '[data-provide="typeahead"]', function (e) { var $this = $(this) if ($this.data('typeahead')) return e.preventDefault() $this.typeahead($this.data()) }) }(window.jQuery); /* ========================================================== * bootstrap-affix.js v2.3.0 * http://twitter.github.com/bootstrap/javascript.html#affix * ========================================================== * Copyright 2012 Twitter, 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 to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* AFFIX CLASS DEFINITION * ====================== */ var Affix = function (element, options) { this.options = $.extend({}, $.fn.affix.defaults, options) this.$window = $(window) .on('scroll.affix.data-api', $.proxy(this.checkPosition, this)) .on('click.affix.data-api', $.proxy(function () { setTimeout($.proxy(this.checkPosition, this), 1) }, this)) this.$element = $(element) this.checkPosition() } Affix.prototype.checkPosition = function () { if (!this.$element.is(':visible')) return var scrollHeight = $(document).height() , scrollTop = this.$window.scrollTop() , position = this.$element.offset() , offset = this.options.offset , offsetBottom = offset.bottom , offsetTop = offset.top , reset = 'affix affix-top affix-bottom' , affix if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top() if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : offsetTop != null && scrollTop <= offsetTop ? 'top' : false if (this.affixed === affix) return this.affixed = affix this.unpin = affix == 'bottom' ? position.top - scrollTop : null this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : '')) } /* AFFIX PLUGIN DEFINITION * ======================= */ var old = $.fn.affix $.fn.affix = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('affix') , options = typeof option == 'object' && option if (!data) $this.data('affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.affix.Constructor = Affix $.fn.affix.defaults = { offset: 0 } /* AFFIX NO CONFLICT * ================= */ $.fn.affix.noConflict = function () { $.fn.affix = old return this } /* AFFIX DATA-API * ============== */ $(window).on('load', function () { $('[data-spy="affix"]').each(function () { var $spy = $(this) , data = $spy.data() data.offset = data.offset || {} data.offsetBottom && (data.offset.bottom = data.offsetBottom) data.offsetTop && (data.offset.top = data.offsetTop) $spy.affix(data) }) }) }(window.jQuery);
jpardobl/django-haweb
haweb/static/bootstrap-2.3.0-wip/docs/assets/js/bootstrap.js
JavaScript
bsd-3-clause
60,241
#undef I3__FILE__ #define I3__FILE__ "manage.c" /* * vim:ts=4:sw=4:expandtab * * i3 - an improved dynamic tiling window manager * © 2009-2013 Michael Stapelberg and contributors (see also: LICENSE) * * manage.c: Initially managing new windows (or existing ones on restart). * */ #include "all.h" #include "yajl_utils.h" #include <yajl/yajl_gen.h> /* * Go through all existing windows (if the window manager is restarted) and manage them * */ void manage_existing_windows(xcb_window_t root) { xcb_query_tree_reply_t *reply; int i, len; xcb_window_t *children; xcb_get_window_attributes_cookie_t *cookies; /* Get the tree of windows whose parent is the root window (= all) */ if ((reply = xcb_query_tree_reply(conn, xcb_query_tree(conn, root), 0)) == NULL) return; len = xcb_query_tree_children_length(reply); cookies = smalloc(len * sizeof(*cookies)); /* Request the window attributes for every window */ children = xcb_query_tree_children(reply); for (i = 0; i < len; ++i) cookies[i] = xcb_get_window_attributes(conn, children[i]); /* Call manage_window with the attributes for every window */ for (i = 0; i < len; ++i) manage_window(children[i], cookies[i], true); free(reply); free(cookies); } /* * Restores the geometry of each window by reparenting it to the root window * at the position of its frame. * * This is to be called *only* before exiting/restarting i3 because of evil * side-effects which are to be expected when continuing to run i3. * */ void restore_geometry(void) { DLOG("Restoring geometry\n"); Con *con; TAILQ_FOREACH(con, &all_cons, all_cons) if (con->window) { DLOG("Re-adding X11 border of %d px\n", con->border_width); con->window_rect.width += (2 * con->border_width); con->window_rect.height += (2 * con->border_width); xcb_set_window_rect(conn, con->window->id, con->window_rect); DLOG("placing window %08x at %d %d\n", con->window->id, con->rect.x, con->rect.y); xcb_reparent_window(conn, con->window->id, root, con->rect.x, con->rect.y); } /* Strictly speaking, this line doesn’t really belong here, but since we * are syncing, let’s un-register as a window manager first */ xcb_change_window_attributes(conn, root, XCB_CW_EVENT_MASK, (uint32_t[]){ XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT }); /* Make sure our changes reach the X server, we restart/exit now */ xcb_aux_sync(conn); } /* * The following function sends a new window event, which consists * of fields "change" and "container", the latter containing a dump * of the window's container. * */ static void ipc_send_window_new_event(Con *con) { setlocale(LC_NUMERIC, "C"); yajl_gen gen = ygenalloc(); y(map_open); ystr("change"); ystr("new"); ystr("container"); dump_node(gen, con, false); y(map_close); const unsigned char *payload; ylength length; y(get_buf, &payload, &length); ipc_send_event("window", I3_IPC_EVENT_WINDOW, (const char *)payload); y(free); setlocale(LC_NUMERIC, ""); } /* * Do some sanity checks and then reparent the window. * */ void manage_window(xcb_window_t window, xcb_get_window_attributes_cookie_t cookie, bool needs_to_be_mapped) { xcb_drawable_t d = { window }; xcb_get_geometry_cookie_t geomc; xcb_get_geometry_reply_t *geom; xcb_get_window_attributes_reply_t *attr = NULL; xcb_get_property_cookie_t wm_type_cookie, strut_cookie, state_cookie, utf8_title_cookie, title_cookie, class_cookie, leader_cookie, transient_cookie, role_cookie, startup_id_cookie, wm_hints_cookie; geomc = xcb_get_geometry(conn, d); /* Check if the window is mapped (it could be not mapped when intializing and calling manage_window() for every window) */ if ((attr = xcb_get_window_attributes_reply(conn, cookie, 0)) == NULL) { DLOG("Could not get attributes\n"); xcb_discard_reply(conn, geomc.sequence); return; } if (needs_to_be_mapped && attr->map_state != XCB_MAP_STATE_VIEWABLE) { xcb_discard_reply(conn, geomc.sequence); goto out; } /* Don’t manage clients with the override_redirect flag */ if (attr->override_redirect) { xcb_discard_reply(conn, geomc.sequence); goto out; } /* Check if the window is already managed */ if (con_by_window_id(window) != NULL) { DLOG("already managed (by con %p)\n", con_by_window_id(window)); xcb_discard_reply(conn, geomc.sequence); goto out; } /* Get the initial geometry (position, size, …) */ if ((geom = xcb_get_geometry_reply(conn, geomc, 0)) == NULL) { DLOG("could not get geometry\n"); goto out; } uint32_t values[1]; /* Set a temporary event mask for the new window, consisting only of * PropertyChange and StructureNotify. We need to be notified of * PropertyChanges because the client can change its properties *after* we * requested them but *before* we actually reparented it and have set our * final event mask. * We need StructureNotify because the client may unmap the window before * we get to re-parent it. * If this request fails, we assume the client has already unmapped the * window between the MapRequest and our event mask change. */ values[0] = XCB_EVENT_MASK_PROPERTY_CHANGE | XCB_EVENT_MASK_STRUCTURE_NOTIFY; xcb_void_cookie_t event_mask_cookie = xcb_change_window_attributes_checked(conn, window, XCB_CW_EVENT_MASK, values); if (xcb_request_check(conn, event_mask_cookie) != NULL) { LOG("Could not change event mask, the window probably already disappeared.\n"); goto out; } #define GET_PROPERTY(atom, len) xcb_get_property(conn, false, window, atom, XCB_GET_PROPERTY_TYPE_ANY, 0, len) wm_type_cookie = GET_PROPERTY(A__NET_WM_WINDOW_TYPE, UINT32_MAX); strut_cookie = GET_PROPERTY(A__NET_WM_STRUT_PARTIAL, UINT32_MAX); state_cookie = GET_PROPERTY(A__NET_WM_STATE, UINT32_MAX); utf8_title_cookie = GET_PROPERTY(A__NET_WM_NAME, 128); leader_cookie = GET_PROPERTY(A_WM_CLIENT_LEADER, UINT32_MAX); transient_cookie = GET_PROPERTY(XCB_ATOM_WM_TRANSIENT_FOR, UINT32_MAX); title_cookie = GET_PROPERTY(XCB_ATOM_WM_NAME, 128); class_cookie = GET_PROPERTY(XCB_ATOM_WM_CLASS, 128); role_cookie = GET_PROPERTY(A_WM_WINDOW_ROLE, 128); startup_id_cookie = GET_PROPERTY(A__NET_STARTUP_ID, 512); wm_hints_cookie = xcb_icccm_get_wm_hints(conn, window); /* TODO: also get wm_normal_hints here. implement after we got rid of xcb-event */ DLOG("Managing window 0x%08x\n", window); i3Window *cwindow = scalloc(sizeof(i3Window)); cwindow->id = window; cwindow->depth = get_visual_depth(attr->visual); /* We need to grab the mouse buttons for click to focus */ xcb_grab_button(conn, false, window, XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, root, XCB_NONE, 1 /* left mouse button */, XCB_BUTTON_MASK_ANY /* don’t filter for any modifiers */); xcb_grab_button(conn, false, window, XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, root, XCB_NONE, 2 /* middle mouse button */, XCB_BUTTON_MASK_ANY /* don’t filter for any modifiers */); xcb_grab_button(conn, false, window, XCB_EVENT_MASK_BUTTON_PRESS, XCB_GRAB_MODE_SYNC, XCB_GRAB_MODE_ASYNC, root, XCB_NONE, 3 /* right mouse button */, XCB_BUTTON_MASK_ANY /* don’t filter for any modifiers */); /* update as much information as possible so far (some replies may be NULL) */ window_update_class(cwindow, xcb_get_property_reply(conn, class_cookie, NULL), true); window_update_name_legacy(cwindow, xcb_get_property_reply(conn, title_cookie, NULL), true); window_update_name(cwindow, xcb_get_property_reply(conn, utf8_title_cookie, NULL), true); window_update_leader(cwindow, xcb_get_property_reply(conn, leader_cookie, NULL)); window_update_transient_for(cwindow, xcb_get_property_reply(conn, transient_cookie, NULL)); window_update_strut_partial(cwindow, xcb_get_property_reply(conn, strut_cookie, NULL)); window_update_role(cwindow, xcb_get_property_reply(conn, role_cookie, NULL), true); bool urgency_hint; window_update_hints(cwindow, xcb_get_property_reply(conn, wm_hints_cookie, NULL), &urgency_hint); xcb_get_property_reply_t *startup_id_reply; startup_id_reply = xcb_get_property_reply(conn, startup_id_cookie, NULL); char *startup_ws = startup_workspace_for_window(cwindow, startup_id_reply); DLOG("startup workspace = %s\n", startup_ws); /* check if the window needs WM_TAKE_FOCUS */ cwindow->needs_take_focus = window_supports_protocol(cwindow->id, A_WM_TAKE_FOCUS); /* Where to start searching for a container that swallows the new one? */ Con *search_at = croot; xcb_get_property_reply_t *reply = xcb_get_property_reply(conn, wm_type_cookie, NULL); if (xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_DOCK)) { LOG("This window is of type dock\n"); Output *output = get_output_containing(geom->x, geom->y); if (output != NULL) { DLOG("Starting search at output %s\n", output->name); search_at = output->con; } /* find out the desired position of this dock window */ if (cwindow->reserved.top > 0 && cwindow->reserved.bottom == 0) { DLOG("Top dock client\n"); cwindow->dock = W_DOCK_TOP; } else if (cwindow->reserved.top == 0 && cwindow->reserved.bottom > 0) { DLOG("Bottom dock client\n"); cwindow->dock = W_DOCK_BOTTOM; } else { DLOG("Ignoring invalid reserved edges (_NET_WM_STRUT_PARTIAL), using position as fallback:\n"); if (geom->y < (search_at->rect.height / 2)) { DLOG("geom->y = %d < rect.height / 2 = %d, it is a top dock client\n", geom->y, (search_at->rect.height / 2)); cwindow->dock = W_DOCK_TOP; } else { DLOG("geom->y = %d >= rect.height / 2 = %d, it is a bottom dock client\n", geom->y, (search_at->rect.height / 2)); cwindow->dock = W_DOCK_BOTTOM; } } } DLOG("Initial geometry: (%d, %d, %d, %d)\n", geom->x, geom->y, geom->width, geom->height); Con *nc = NULL; Match *match = NULL; Assignment *assignment; /* TODO: two matches for one container */ /* See if any container swallows this new window */ nc = con_for_window(search_at, cwindow, &match); if (nc == NULL) { /* If not, check if it is assigned to a specific workspace / output */ if ((assignment = assignment_for(cwindow, A_TO_WORKSPACE | A_TO_OUTPUT))) { DLOG("Assignment matches (%p)\n", match); if (assignment->type == A_TO_WORKSPACE) { Con *assigned_ws = workspace_get(assignment->dest.workspace, NULL); nc = con_descend_tiling_focused(assigned_ws); DLOG("focused on ws %s: %p / %s\n", assigned_ws->name, nc, nc->name); if (nc->type == CT_WORKSPACE) nc = tree_open_con(nc, cwindow); else nc = tree_open_con(nc->parent, cwindow); /* set the urgency hint on the window if the workspace is not visible */ if (!workspace_is_visible(assigned_ws)) urgency_hint = true; } /* TODO: handle assignments with type == A_TO_OUTPUT */ } else if (startup_ws) { /* If it’s not assigned, but was started on a specific workspace, * we want to open it there */ DLOG("Using workspace on which this application was started (%s)\n", startup_ws); nc = con_descend_tiling_focused(workspace_get(startup_ws, NULL)); DLOG("focused on ws %s: %p / %s\n", startup_ws, nc, nc->name); if (nc->type == CT_WORKSPACE) nc = tree_open_con(nc, cwindow); else nc = tree_open_con(nc->parent, cwindow); } else { /* If not, insert it at the currently focused position */ if (focused->type == CT_CON && con_accepts_window(focused)) { LOG("using current container, focused = %p, focused->name = %s\n", focused, focused->name); nc = focused; } else nc = tree_open_con(NULL, cwindow); } } else { /* M_BELOW inserts the new window as a child of the one which was * matched (e.g. dock areas) */ if (match != NULL && match->insert_where == M_BELOW) { nc = tree_open_con(nc, cwindow); } } DLOG("new container = %p\n", nc); nc->window = cwindow; x_reinit(nc); nc->border_width = geom->border_width; char *name; sasprintf(&name, "[i3 con] container around %p", cwindow); x_set_name(nc, name); free(name); /* handle fullscreen containers */ Con *ws = con_get_workspace(nc); Con *fs = (ws ? con_get_fullscreen_con(ws, CF_OUTPUT) : NULL); if (fs == NULL) fs = con_get_fullscreen_con(croot, CF_GLOBAL); xcb_get_property_reply_t *state_reply = xcb_get_property_reply(conn, state_cookie, NULL); if (xcb_reply_contains_atom(state_reply, A__NET_WM_STATE_FULLSCREEN)) { fs = NULL; con_toggle_fullscreen(nc, CF_OUTPUT); } FREE(state_reply); if (fs == NULL) { DLOG("Not in fullscreen mode, focusing\n"); if (!cwindow->dock) { /* Check that the workspace is visible and on the same output as * the current focused container. If the window was assigned to an * invisible workspace, we should not steal focus. */ Con *current_output = con_get_output(focused); Con *target_output = con_get_output(ws); if (workspace_is_visible(ws) && current_output == target_output) { if (!match || !match->restart_mode) { con_focus(nc); } else DLOG("not focusing, matched with restart_mode == true\n"); } else DLOG("workspace not visible, not focusing\n"); } else DLOG("dock, not focusing\n"); } else { DLOG("fs = %p, ws = %p, not focusing\n", fs, ws); /* Insert the new container in focus stack *after* the currently * focused (fullscreen) con. This way, the new container will be * focused after we return from fullscreen mode */ Con *first = TAILQ_FIRST(&(nc->parent->focus_head)); if (first != nc) { /* We only modify the focus stack if the container is not already * the first one. This can happen when existing containers swallow * new windows, for example when restarting. */ TAILQ_REMOVE(&(nc->parent->focus_head), nc, focused); TAILQ_INSERT_AFTER(&(nc->parent->focus_head), first, nc, focused); } } /* set floating if necessary */ bool want_floating = false; if (xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_DIALOG) || xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_UTILITY) || xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_TOOLBAR) || xcb_reply_contains_atom(reply, A__NET_WM_WINDOW_TYPE_SPLASH)) { LOG("This window is a dialog window, setting floating\n"); want_floating = true; } FREE(reply); if (cwindow->transient_for != XCB_NONE || (cwindow->leader != XCB_NONE && cwindow->leader != cwindow->id && con_by_window_id(cwindow->leader) != NULL)) { LOG("This window is transient for another window, setting floating\n"); want_floating = true; if (config.popup_during_fullscreen == PDF_LEAVE_FULLSCREEN && fs != NULL) { LOG("There is a fullscreen window, leaving fullscreen mode\n"); con_toggle_fullscreen(fs, CF_OUTPUT); } else if (config.popup_during_fullscreen == PDF_SMART && fs != NULL && fs->window != NULL) { i3Window *transient_win = cwindow; while (transient_win != NULL && transient_win->transient_for != XCB_NONE) { if (transient_win->transient_for == fs->window->id) { LOG("This floating window belongs to the fullscreen window (popup_during_fullscreen == smart)\n"); con_focus(nc); break; } Con *next_transient = con_by_window_id(transient_win->transient_for); if (next_transient == NULL) break; transient_win = next_transient->window; } } } /* dock clients cannot be floating, that makes no sense */ if (cwindow->dock) want_floating = false; /* Store the requested geometry. The width/height gets raised to at least * 75x50 when entering floating mode, which is the minimum size for a * window to be useful (smaller windows are usually overlays/toolbars/… * which are not managed by the wm anyways). We store the original geometry * here because it’s used for dock clients. */ nc->geometry = (Rect){ geom->x, geom->y, geom->width, geom->height }; if (want_floating) { DLOG("geometry = %d x %d\n", nc->geometry.width, nc->geometry.height); floating_enable(nc, true); } /* to avoid getting an UnmapNotify event due to reparenting, we temporarily * declare no interest in any state change event of this window */ values[0] = XCB_NONE; xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values); xcb_void_cookie_t rcookie = xcb_reparent_window_checked(conn, window, nc->frame, 0, 0); if (xcb_request_check(conn, rcookie) != NULL) { LOG("Could not reparent the window, aborting\n"); goto geom_out; } values[0] = CHILD_EVENT_MASK & ~XCB_EVENT_MASK_ENTER_WINDOW; xcb_change_window_attributes(conn, window, XCB_CW_EVENT_MASK, values); xcb_flush(conn); /* Put the client inside the save set. Upon termination (whether killed or * normal exit does not matter) of the window manager, these clients will * be correctly reparented to their most closest living ancestor (= * cleanup) */ xcb_change_save_set(conn, XCB_SET_MODE_INSERT, window); /* Check if any assignments match */ run_assignments(cwindow); /* 'ws' may be invalid because of the assignments, e.g. when the user uses * "move window to workspace 1", but had it assigned to workspace 2. */ ws = con_get_workspace(nc); /* If this window was put onto an invisible workspace (via assignments), we * render this workspace. It wouldn’t be rendered in our normal code path * because only the visible workspaces get rendered. * * By rendering the workspace, we assign proper coordinates (read: not * width=0, height=0) to the window, which is important for windows who * actually use them to position their GUI elements, e.g. rhythmbox. */ if (ws && !workspace_is_visible(ws)) { /* This is a bit hackish: we need to copy the content container’s rect * to the workspace, because calling render_con() on the content * container would also take the shortcut and not render the invisible * workspace at all. However, just calling render_con() on the * workspace isn’t enough either — it needs the rect. */ ws->rect = ws->parent->rect; render_con(ws, true); } tree_render(); /* Send an event about window creation */ ipc_send_window_new_event(nc); /* Windows might get managed with the urgency hint already set (Pidgin is * known to do that), so check for that and handle the hint accordingly. * This code needs to be in this part of manage_window() because the window * needs to be on the final workspace first. */ con_set_urgency(nc, urgency_hint); geom_out: free(geom); out: free(attr); return; }
grinchfox/i3
src/manage.c
C
bsd-3-clause
20,658
/////////////////////////////////////////////////////////////// // Copyright 2019 John Maddock. Distributed under the Boost // Software License, Version 1.0. (See accompanying file // LICENSE_1_0.txt or copy at https://www.boost.org/LICENSE_1_0.txt #include "../performance_test.hpp" #if defined(TEST_CPP_BIN_FLOAT) #include <boost/multiprecision/cpp_bin_float.hpp> #endif void test33() { #ifdef TEST_CPP_BIN_FLOAT test<boost::multiprecision::cpp_bin_float_100>("cpp_bin_float", 100); #endif }
stan-dev/math
lib/boost_1.75.0/libs/multiprecision/performance/performance_test_files/test33.cpp
C++
bsd-3-clause
502
/*------------------------------------------------------------------------- * * itup.h * POSTGRES index tuple definitions. * * * Portions Copyright (c) 1996-2017, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * * src/include/access/itup.h * *------------------------------------------------------------------------- */ #ifndef ITUP_H #define ITUP_H #include "access/tupdesc.h" #include "access/tupmacs.h" #include "storage/bufpage.h" #include "storage/itemptr.h" /* * Index tuple header structure * * All index tuples start with IndexTupleData. If the HasNulls bit is set, * this is followed by an IndexAttributeBitMapData. The index attribute * values follow, beginning at a MAXALIGN boundary. * * Note that the space allocated for the bitmap does not vary with the number * of attributes; that is because we don't have room to store the number of * attributes in the header. Given the MAXALIGN constraint there's no space * savings to be had anyway, for usual values of INDEX_MAX_KEYS. */ typedef struct IndexTupleData { ItemPointerData t_tid; /* reference TID to heap tuple */ /* --------------- * t_info is laid out in the following fashion: * * 15th (high) bit: has nulls * 14th bit: has var-width attributes * 13th bit: unused * 12-0 bit: size of tuple * --------------- */ unsigned short t_info; /* various info about tuple */ } IndexTupleData; /* MORE DATA FOLLOWS AT END OF STRUCT */ typedef IndexTupleData *IndexTuple; typedef struct IndexAttributeBitMapData { bits8 bits[(INDEX_MAX_KEYS + 8 - 1) / 8]; } IndexAttributeBitMapData; typedef IndexAttributeBitMapData * IndexAttributeBitMap; /* * t_info manipulation macros */ #define INDEX_SIZE_MASK 0x1FFF /* bit 0x2000 is reserved for index-AM specific usage */ #define INDEX_VAR_MASK 0x4000 #define INDEX_NULL_MASK 0x8000 #define IndexTupleSize(itup) ((Size) (((IndexTuple) (itup))->t_info & INDEX_SIZE_MASK)) #define IndexTupleDSize(itup) ((Size) ((itup).t_info & INDEX_SIZE_MASK)) #define IndexTupleHasNulls(itup) ((((IndexTuple) (itup))->t_info & INDEX_NULL_MASK)) #define IndexTupleHasVarwidths(itup) ((((IndexTuple) (itup))->t_info & INDEX_VAR_MASK)) /* * Takes an infomask as argument (primarily because this needs to be usable * at index_form_tuple time so enough space is allocated). */ #define IndexInfoFindDataOffset(t_info) \ ( \ (!((t_info) & INDEX_NULL_MASK)) ? \ ( \ (Size)MAXALIGN(sizeof(IndexTupleData)) \ ) \ : \ ( \ (Size)MAXALIGN(sizeof(IndexTupleData) + sizeof(IndexAttributeBitMapData)) \ ) \ ) /* ---------------- * index_getattr * * This gets called many times, so we macro the cacheable and NULL * lookups, and call nocache_index_getattr() for the rest. * * ---------------- */ #define index_getattr(tup, attnum, tupleDesc, isnull) \ ( \ AssertMacro(PointerIsValid(isnull) && (attnum) > 0), \ *(isnull) = false, \ !IndexTupleHasNulls(tup) ? \ ( \ (tupleDesc)->attrs[(attnum)-1]->attcacheoff >= 0 ? \ ( \ fetchatt((tupleDesc)->attrs[(attnum)-1], \ (char *) (tup) + IndexInfoFindDataOffset((tup)->t_info) \ + (tupleDesc)->attrs[(attnum)-1]->attcacheoff) \ ) \ : \ nocache_index_getattr((tup), (attnum), (tupleDesc)) \ ) \ : \ ( \ (att_isnull((attnum)-1, (char *)(tup) + sizeof(IndexTupleData))) ? \ ( \ *(isnull) = true, \ (Datum)NULL \ ) \ : \ ( \ nocache_index_getattr((tup), (attnum), (tupleDesc)) \ ) \ ) \ ) /* * MaxIndexTuplesPerPage is an upper bound on the number of tuples that can * fit on one index page. An index tuple must have either data or a null * bitmap, so we can safely assume it's at least 1 byte bigger than a bare * IndexTupleData struct. We arrive at the divisor because each tuple * must be maxaligned, and it must have an associated item pointer. */ #define MinIndexTupleSize MAXALIGN(sizeof(IndexTupleData) + 1) #define MaxIndexTuplesPerPage \ ((int) ((BLCKSZ - SizeOfPageHeaderData) / \ (MAXALIGN(sizeof(IndexTupleData) + 1) + sizeof(ItemIdData)))) /* routines in indextuple.c */ extern IndexTuple index_form_tuple(TupleDesc tupleDescriptor, Datum *values, bool *isnull); extern Datum nocache_index_getattr(IndexTuple tup, int attnum, TupleDesc tupleDesc); extern void index_deform_tuple(IndexTuple tup, TupleDesc tupleDescriptor, Datum *values, bool *isnull); extern IndexTuple CopyIndexTuple(IndexTuple source); #endif /* ITUP_H */
lfittl/libpg_query
src/postgres/include/access/itup.h
C
bsd-3-clause
4,492
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <!--NewPage--> <HTML> <HEAD> <!-- Generated by javadoc (build 1.6.0_20) on Fri Jan 14 02:47:13 GMT 2011 --> <TITLE> G-Index </TITLE> <META NAME="date" CONTENT="2011-01-14"> <LINK REL ="stylesheet" TYPE="text/css" HREF="../stylesheet.css" TITLE="Style"> <SCRIPT type="text/javascript"> function windowTitle() { if (location.href.indexOf('is-external=true') == -1) { parent.document.title="G-Index"; } } </SCRIPT> <NOSCRIPT> </NOSCRIPT> </HEAD> <BODY BGCOLOR="white" onload="windowTitle();"> <HR> <!-- ========= START OF TOP NAVBAR ======= --> <A NAME="navbar_top"><!-- --></A> <A HREF="#skip-navbar_top" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_top_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../uk/co/jamesy/Text2GPS/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="index-4.html"><B>PREV LETTER</B></A>&nbsp; &nbsp;<A HREF="index-6.html"><B>NEXT LETTER</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html?index-filesindex-5.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="index-5.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_top"></A> <!-- ========= END OF TOP NAVBAR ========= --> <A HREF="index-1.html">A</A> <A HREF="index-2.html">C</A> <A HREF="index-3.html">E</A> <A HREF="index-4.html">F</A> <A HREF="index-5.html">G</A> <A HREF="index-6.html">L</A> <A HREF="index-7.html">M</A> <A HREF="index-8.html">O</A> <A HREF="index-9.html">P</A> <A HREF="index-10.html">R</A> <A HREF="index-11.html">S</A> <A HREF="index-12.html">T</A> <A HREF="index-13.html">U</A> <A HREF="index-14.html">W</A> <HR> <A NAME="_G_"><!-- --></A><H2> <B>G</B></H2> <DL> <DT><A HREF="../uk/co/jamesy/Text2GPS/MainApp.html#getMd5Hash(java.lang.String)"><B>getMd5Hash(String)</B></A> - Static method in class uk.co.jamesy.Text2GPS.<A HREF="../uk/co/jamesy/Text2GPS/MainApp.html" title="class in uk.co.jamesy.Text2GPS">MainApp</A> <DD>Hashes a string </DL> <HR> <!-- ======= START OF BOTTOM NAVBAR ====== --> <A NAME="navbar_bottom"><!-- --></A> <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A> <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY=""> <TR> <TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A NAME="navbar_bottom_firstrow"><!-- --></A> <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY=""> <TR ALIGN="center" VALIGN="top"> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../uk/co/jamesy/Text2GPS/package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <FONT CLASS="NavBarFont1">Use</FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../overview-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD> <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Index</B></FONT>&nbsp;</TD> <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD> </TR> </TABLE> </TD> <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM> </EM> </TD> </TR> <TR> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> &nbsp;<A HREF="index-4.html"><B>PREV LETTER</B></A>&nbsp; &nbsp;<A HREF="index-6.html"><B>NEXT LETTER</B></A></FONT></TD> <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../index.html?index-filesindex-5.html" target="_top"><B>FRAMES</B></A> &nbsp; &nbsp;<A HREF="index-5.html" target="_top"><B>NO FRAMES</B></A> &nbsp; &nbsp;<SCRIPT type="text/javascript"> <!-- if(window==top) { document.writeln('<A HREF="../allclasses-noframe.html"><B>All Classes</B></A>'); } //--> </SCRIPT> <NOSCRIPT> <A HREF="../allclasses-noframe.html"><B>All Classes</B></A> </NOSCRIPT> </FONT></TD> </TR> </TABLE> <A NAME="skip-navbar_bottom"></A> <!-- ======== END OF BOTTOM NAVBAR ======= --> <A HREF="index-1.html">A</A> <A HREF="index-2.html">C</A> <A HREF="index-3.html">E</A> <A HREF="index-4.html">F</A> <A HREF="index-5.html">G</A> <A HREF="index-6.html">L</A> <A HREF="index-7.html">M</A> <A HREF="index-8.html">O</A> <A HREF="index-9.html">P</A> <A HREF="index-10.html">R</A> <A HREF="index-11.html">S</A> <A HREF="index-12.html">T</A> <A HREF="index-13.html">U</A> <A HREF="index-14.html">W</A> <HR> </BODY> </HTML>
Eymir/text2gps
doc/index-files/index-5.html
HTML
bsd-3-clause
6,308
/*----------------------------------------------------------------------------*/ /* Copyright (c) FIRST 2008-2017. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ package edu.wpi.first.wpilibj.buttons; /** * This class is intended to be used within a program. The programmer can manually set its value. * Also includes a setting for whether or not it should invert its value. */ public class InternalButton extends Button { private boolean m_pressed; private boolean m_inverted; /** * Creates an InternalButton that is not inverted. */ public InternalButton() { this(false); } /** * Creates an InternalButton which is inverted depending on the input. * * @param inverted if false, then this button is pressed when set to true, otherwise it is pressed * when set to false. */ public InternalButton(boolean inverted) { m_pressed = m_inverted = inverted; } public void setInverted(boolean inverted) { m_inverted = inverted; } public void setPressed(boolean pressed) { m_pressed = pressed; } public boolean get() { return m_pressed ^ m_inverted; } }
333fred/allwpilib
wpilibj/src/shared/java/edu/wpi/first/wpilibj/buttons/InternalButton.java
Java
bsd-3-clause
1,465
<?php /** * File MessageBox.php * * PHP version 5.4+ * * @author Philippe Gaultier <[email protected]> * @copyright 2010-2014 Sweelix * @license http://www.sweelix.net/license license * @version 3.1.0 * @link http://www.sweelix.net * @category widgets * @package sweelix.yii1.admin.core.widgets */ namespace sweelix\yii1\admin\core\widgets; use sweelix\yii1\web\helpers\Html; /** * Class MessageBox * * @author Philippe Gaultier <[email protected]> * @copyright 2010-2014 Sweelix * @license http://www.sweelix.net/license license * @version 3.1.0 * @link http://www.sweelix.net * @category widgets * @package sweelix.yii1.admin.core.widgets */ class MessageBox extends \CWidget { public $message; public $type = 'info'; public $objects; private $_errorMessage; public $displayMessage; /** * Init widget * Called by CController::beginWidget() * * @return void * @since 1.2.0 */ public function init() { \Yii::trace(__METHOD__.'()', 'sweelix.yii1.admin.core.widgets'); ob_start(); if($this->objects !== null) { if(is_array($this->objects) === false) { $this->objects = array($this->objects); } $errorMessage = null; foreach($this->objects as $object) { foreach($object->getErrors() as $errors) { foreach($errors as $error) { $errorMessage .= Html::tag('li', array(), $error).' '; } } } if($errorMessage !== null) { $this->_errorMessage = Html::tag('ul', array(), $errorMessage).' ';; $this->type = 'error'; } } } /** * Render widget * Called by CController::endWidget() * * @return void * @since 1.2.0 */ public function run() { \Yii::trace(__METHOD__.'()', 'sweelix.yii1.admin.core.widgets'); $content=ob_get_contents(); ob_end_clean(); if(strlen($content) > 0) { $this->message = $content; } if($this->_errorMessage !== null) { $this->message = $this->message.' '.$this->_errorMessage; } if(strlen($this->message)>0) { $this->message = str_replace(array("\r\n", "\n", "\r"), array(' ', ' ', ' '), $this->message); $message = array( 'type' => $this->type, 'message' => $this->message, 'close' => \Yii::t('sweelix', 'Close') ); switch($this->type) { case 'valid' : $message['title'] = \Yii::t('sweelix', 'Confirmation'); break; case 'warning' : $message['title'] = \Yii::t('sweelix', 'Warning'); break; case 'error' : $message['title'] = \Yii::t('sweelix', 'Error'); break; case 'info' : $message['title'] = \Yii::t('sweelix', 'Information'); break; } $js = Html::raiseEvent('showMessageBox', array( 'type' => $this->type, 'message' => $this->message, )); if(\Yii::app()->getRequest()->isAjaxRequest === false) { \Yii::app()->getClientScript()->registerSweelixScript('callback'); if($this->displayMessage === true) \Yii::app()->getClientScript()->registerScript('messageBoxDetail', $js); } else { if($this->displayMessage === true) echo Html::script($js); } } } }
pgaultier/sweelix-yii1-admin-core
widgets/MessageBox.php
PHP
bsd-3-clause
3,081
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef APP_WIN_IAT_PATCH_FUNCTION_H_ #define APP_WIN_IAT_PATCH_FUNCTION_H_ #pragma once #include <windows.h> #include "base/basictypes.h" namespace app { namespace win { // A class that encapsulates Import Address Table patching helpers and restores // the original function in the destructor. // // It will intercept functions for a specific DLL imported from another DLL. // This is the case when, for example, we want to intercept // CertDuplicateCertificateContext function (exported from crypt32.dll) called // by wininet.dll. class IATPatchFunction { public: IATPatchFunction(); ~IATPatchFunction(); // Intercept a function in an import table of a specific // module. Save the original function and the import // table address. These values will be used later // during Unpatch // // Arguments: // module Module to be intercepted // imported_from_module Module that exports the 'function_name' // function_name Name of the API to be intercepted // // Returns: Windows error code (winerror.h). NO_ERROR if successful // // Note: Patching a function will make the IAT patch take some "ownership" on // |module|. It will LoadLibrary(module) to keep the DLL alive until a call // to Unpatch(), which will call FreeLibrary() and allow the module to be // unloaded. The idea is to help prevent the DLL from going away while a // patch is still active. DWORD Patch(const wchar_t* module, const char* imported_from_module, const char* function_name, void* new_function); // Unpatch the IAT entry using internally saved original // function. // // Returns: Windows error code (winerror.h). NO_ERROR if successful DWORD Unpatch(); bool is_patched() const { return (NULL != intercept_function_); } private: HMODULE module_handle_; void* intercept_function_; void* original_function_; IMAGE_THUNK_DATA* iat_thunk_; DISALLOW_COPY_AND_ASSIGN(IATPatchFunction); }; } // namespace win } // namespace app #endif // APP_WIN_IAT_PATCH_FUNCTION_H_
meego-tablet-ux/meego-app-browser
app/win/iat_patch_function.h
C
bsd-3-clause
2,260
#include <stdint.h> void * memset(void * destination, int32_t c, uint64_t length) { uint8_t chr = (uint8_t)c; char * dst = (char*)destination; while(length--) dst[length] = chr; return destination; } void * memcpy(void * destination, const void * source, uint64_t length) { /* * memcpy does not support overlapping buffers, so always do it * forwards. (Don't change this without adjusting memmove.) * * For speedy copying, optimize the common case where both pointers * and the length are word-aligned, and copy word-at-a-time instead * of byte-at-a-time. Otherwise, copy by bytes. * * The alignment logic below should be portable. We rely on * the compiler to be reasonably intelligent about optimizing * the divides and modulos out. Fortunately, it is. */ uint64_t i; if ((uint64_t)destination % sizeof(uint32_t) == 0 && (uint64_t)source % sizeof(uint32_t) == 0 && length % sizeof(uint32_t) == 0) { uint32_t *d = (uint32_t *) destination; const uint32_t *s = (const uint32_t *)source; for (i = 0; i < length / sizeof(uint32_t); i++) d[i] = s[i]; } else { uint8_t * d = (uint8_t*)destination; const uint8_t * s = (const uint8_t*)source; for (i = 0; i < length; i++) d[i] = s[i]; } return destination; }
saques/fractalOS
Kernel/lib.c
C
bsd-3-clause
1,261
using System; using JetBrains.Annotations; using Orchard.ContentManagement; using Orchard.ContentManagement.Drivers; using Orchard.Core.Navigation.Models; using Orchard.Core.Navigation.Settings; using Orchard.Localization; using Orchard.Security; using Orchard.UI.Navigation; using Orchard.Utility; namespace Orchard.Core.Navigation.Drivers { [UsedImplicitly] public class AdminMenuPartDriver : ContentPartDriver<AdminMenuPart> { private readonly IAuthorizationService _authorizationService; private readonly INavigationManager _navigationManager; private readonly IOrchardServices _orchardServices; public AdminMenuPartDriver(IAuthorizationService authorizationService, INavigationManager navigationManager, IOrchardServices orchardServices) { _authorizationService = authorizationService; _navigationManager = navigationManager; _orchardServices = orchardServices; T = NullLocalizer.Instance; } public Localizer T { get; set; } private string GetDefaultPosition(ContentPart part) { var settings = part.Settings.GetModel<AdminMenuPartTypeSettings>(); var defaultPosition = settings == null ? "" : settings.DefaultPosition; var adminMenu = _navigationManager.BuildMenu("admin"); if (!string.IsNullOrEmpty(defaultPosition)) { int major; return int.TryParse(defaultPosition, out major) ? Position.GetNextMinor(major, adminMenu) : defaultPosition; } return Position.GetNext(adminMenu); } protected override DriverResult Editor(AdminMenuPart part, dynamic shapeHelper) { // todo: we need a 'ManageAdminMenu' too? if (!_authorizationService.TryCheckAccess(Permissions.ManageMenus, _orchardServices.WorkContext.CurrentUser, part)) { return null; } if (string.IsNullOrEmpty(part.AdminMenuPosition)) { part.AdminMenuPosition = GetDefaultPosition(part); } return ContentShape("Parts_Navigation_AdminMenu_Edit", () => shapeHelper.EditorTemplate(TemplateName: "Parts.Navigation.AdminMenu.Edit", Model: part, Prefix: Prefix)); } protected override DriverResult Editor(AdminMenuPart part, IUpdateModel updater, dynamic shapeHelper) { if (!_authorizationService.TryCheckAccess(Permissions.ManageMenus, _orchardServices.WorkContext.CurrentUser, part)) return null; updater.TryUpdateModel(part, Prefix, null, null); if (part.OnAdminMenu) { if (string.IsNullOrEmpty(part.AdminMenuText)) { updater.AddModelError("AdminMenuText", T("The AdminMenuText field is required")); } if (string.IsNullOrEmpty(part.AdminMenuPosition)) { part.AdminMenuPosition = GetDefaultPosition(part); } } else { part.AdminMenuPosition = ""; } return Editor(part, shapeHelper); } protected override void Importing(AdminMenuPart part, ContentManagement.Handlers.ImportContentContext context) { // Don't do anything if the tag is not specified. if (context.Data.Element(part.PartDefinition.Name) == null) { return; } context.ImportAttribute(part.PartDefinition.Name, "AdminMenuText", adminMenuText => part.AdminMenuText = adminMenuText ); context.ImportAttribute(part.PartDefinition.Name, "AdminMenuPosition", position => part.AdminMenuPosition = position ); context.ImportAttribute(part.PartDefinition.Name, "OnAdminMenu", onAdminMenu => part.OnAdminMenu = Convert.ToBoolean(onAdminMenu) ); } protected override void Exporting(AdminMenuPart part, ContentManagement.Handlers.ExportContentContext context) { context.Element(part.PartDefinition.Name).SetAttributeValue("AdminMenuText", part.AdminMenuText); context.Element(part.PartDefinition.Name).SetAttributeValue("AdminMenuPosition", part.AdminMenuPosition); context.Element(part.PartDefinition.Name).SetAttributeValue("OnAdminMenu", part.OnAdminMenu); } } }
qt1/Orchard
src/Orchard.Web/Core/Navigation/Drivers/AdminMenuPartDriver.cs
C#
bsd-3-clause
4,441
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2016, Image Engine Design Inc. All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // // * Redistributions of source code must retain the above // copyright notice, this list of conditions and the following // disclaimer. // // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following // disclaimer in the documentation and/or other materials provided with // the distribution. // // * Neither the name of Image Engine Design nor the names of // any other contributors to this software may be used to endorse or // promote products derived from this software without specific prior // written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // ////////////////////////////////////////////////////////////////////////// #include "GafferImage/VectorWarp.h" #include "GafferImage/FilterAlgo.h" #include "GafferImage/ImageAlgo.h" #include "Gaffer/Context.h" #include "OpenEXR/ImathFun.h" #include <cmath> using namespace Imath; using namespace IECore; using namespace Gaffer; using namespace GafferImage; ////////////////////////////////////////////////////////////////////////// // Engine implementation ////////////////////////////////////////////////////////////////////////// struct VectorWarp::Engine : public Warp::Engine { Engine( const Box2i &displayWindow, const Box2i &tileBound, const Box2i &validTileBound, ConstFloatVectorDataPtr xData, ConstFloatVectorDataPtr yData, ConstFloatVectorDataPtr aData, VectorMode vectorMode, VectorUnits vectorUnits ) : m_displayWindow( displayWindow ), m_tileBound( tileBound ), m_xData( xData ), m_yData( yData ), m_aData( aData ), m_x( xData->readable() ), m_y( yData->readable() ), m_a( aData->readable() ), m_vectorMode( vectorMode ), m_vectorUnits( vectorUnits ) { } Imath::V2f inputPixel( const Imath::V2f &outputPixel ) const override { const V2i outputPixelI( (int)floorf( outputPixel.x ), (int)floorf( outputPixel.y ) ); const size_t i = BufferAlgo::index( outputPixelI, m_tileBound ); if( m_a[i] == 0.0f ) { return black; } else { V2f result = m_vectorMode == Relative ? outputPixel : V2f( 0.0f ); result += m_vectorUnits == Screen ? screenToPixel( V2f( m_x[i], m_y[i] ) ) : V2f( m_x[i], m_y[i] ); if( !std::isfinite( result[0] ) || !std::isfinite( result[1] ) ) { return black; } return result; } } private : inline V2f screenToPixel( const V2f &vector ) const { return V2f( lerp<float>( m_displayWindow.min.x, m_displayWindow.max.x, vector.x ), lerp<float>( m_displayWindow.min.y, m_displayWindow.max.y, vector.y ) ); } const Box2i m_displayWindow; const Box2i m_tileBound; ConstFloatVectorDataPtr m_xData; ConstFloatVectorDataPtr m_yData; ConstFloatVectorDataPtr m_aData; const std::vector<float> &m_x; const std::vector<float> &m_y; const std::vector<float> &m_a; const VectorMode m_vectorMode; const VectorUnits m_vectorUnits; }; ////////////////////////////////////////////////////////////////////////// // VectorWarp implementation ////////////////////////////////////////////////////////////////////////// GAFFER_GRAPHCOMPONENT_DEFINE_TYPE( VectorWarp ); size_t VectorWarp::g_firstPlugIndex = 0; VectorWarp::VectorWarp( const std::string &name ) : Warp( name ) { storeIndexOfNextChild( g_firstPlugIndex ); addChild( new ImagePlug( "vector" ) ); addChild( new IntPlug( "vectorMode", Gaffer::Plug::In, (int)Absolute, (int)Relative, (int)Absolute ) ); addChild( new IntPlug( "vectorUnits", Gaffer::Plug::In, (int)Screen, (int)Pixels, (int)Screen ) ); outPlug()->formatPlug()->setInput( vectorPlug()->formatPlug() ); outPlug()->dataWindowPlug()->setInput( vectorPlug()->dataWindowPlug() ); } VectorWarp::~VectorWarp() { } ImagePlug *VectorWarp::vectorPlug() { return getChild<ImagePlug>( g_firstPlugIndex ); } const ImagePlug *VectorWarp::vectorPlug() const { return getChild<ImagePlug>( g_firstPlugIndex ); } IntPlug *VectorWarp::vectorModePlug() { return getChild<IntPlug>( g_firstPlugIndex + 1 ); } const IntPlug *VectorWarp::vectorModePlug() const { return getChild<IntPlug>( g_firstPlugIndex + 1 ); } IntPlug *VectorWarp::vectorUnitsPlug() { return getChild<IntPlug>( g_firstPlugIndex + 2 ); } const IntPlug *VectorWarp::vectorUnitsPlug() const { return getChild<IntPlug>( g_firstPlugIndex + 2 ); } void VectorWarp::affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const { Warp::affects( input, outputs ); if( input == vectorPlug()->deepPlug() ) { outputs.push_back( outPlug()->deepPlug() ); } } bool VectorWarp::affectsEngine( const Gaffer::Plug *input ) const { return Warp::affectsEngine( input ) || input == inPlug()->formatPlug() || input == vectorPlug()->channelNamesPlug() || input == vectorPlug()->channelDataPlug() || input == vectorModePlug() || input == vectorUnitsPlug(); } void VectorWarp::hashEngine( const Imath::V2i &tileOrigin, const Gaffer::Context *context, IECore::MurmurHash &h ) const { Warp::hashEngine( tileOrigin, context, h ); h.append( tileOrigin ); ConstStringVectorDataPtr channelNames; { ImagePlug::GlobalScope c( context ); channelNames = vectorPlug()->channelNamesPlug()->getValue(); vectorPlug()->dataWindowPlug()->hash( h ); inPlug()->formatPlug()->hash( h ); } ImagePlug::ChannelDataScope channelDataScope( context ); if( ImageAlgo::channelExists( channelNames->readable(), "R" ) ) { channelDataScope.setChannelName( "R" ); vectorPlug()->channelDataPlug()->hash( h ); } if( ImageAlgo::channelExists( channelNames->readable(), "G" ) ) { channelDataScope.setChannelName( "G" ); vectorPlug()->channelDataPlug()->hash( h ); } if( ImageAlgo::channelExists( channelNames->readable(), "A" ) ) { channelDataScope.setChannelName( "A" ); vectorPlug()->channelDataPlug()->hash( h ); } vectorModePlug()->hash( h ); vectorUnitsPlug()->hash( h ); } const Warp::Engine *VectorWarp::computeEngine( const Imath::V2i &tileOrigin, const Gaffer::Context *context ) const { const Box2i tileBound( tileOrigin, tileOrigin + V2i( ImagePlug::tileSize() ) ); Box2i validTileBound; ConstStringVectorDataPtr channelNames; Box2i displayWindow; { ImagePlug::GlobalScope c( context ); validTileBound = BufferAlgo::intersection( tileBound, vectorPlug()->dataWindowPlug()->getValue() ); channelNames = vectorPlug()->channelNamesPlug()->getValue(); displayWindow = inPlug()->formatPlug()->getValue().getDisplayWindow(); } ImagePlug::ChannelDataScope channelDataScope( context ); ConstFloatVectorDataPtr xData = ImagePlug::blackTile(); if( ImageAlgo::channelExists( channelNames->readable(), "R" ) ) { channelDataScope.setChannelName( "R" ); xData = vectorPlug()->channelDataPlug()->getValue(); } ConstFloatVectorDataPtr yData = ImagePlug::blackTile(); if( ImageAlgo::channelExists( channelNames->readable(), "G" ) ) { channelDataScope.setChannelName( "G" ); yData = vectorPlug()->channelDataPlug()->getValue(); } ConstFloatVectorDataPtr aData = ImagePlug::whiteTile(); if( ImageAlgo::channelExists( channelNames->readable(), "A" ) ) { channelDataScope.setChannelName( "A" ); aData = vectorPlug()->channelDataPlug()->getValue(); } if( xData->readable().size() != (unsigned int)ImagePlug::tilePixels() || yData->readable().size() != (unsigned int)ImagePlug::tilePixels() || aData->readable().size() != (unsigned int)ImagePlug::tilePixels() ) { throw IECore::Exception( "VectorWarp::computeEngine : Bad channel data size on vector plug. Maybe it's deep?" ); } return new Engine( displayWindow, tileBound, validTileBound, xData, yData, aData, (VectorMode)vectorModePlug()->getValue(), (VectorUnits)vectorUnitsPlug()->getValue() ); } void VectorWarp::hashDeep( const GafferImage::ImagePlug *parent, const Gaffer::Context *context, IECore::MurmurHash &h ) const { FlatImageProcessor::hashDeep( parent, context, h ); h.append( vectorPlug()->deepPlug()->hash() ); } bool VectorWarp::computeDeep( const Gaffer::Context *context, const ImagePlug *parent ) const { if( vectorPlug()->deepPlug()->getValue() ) { throw IECore::Exception( "Deep data not supported in input \"vector\"" ); } return false; }
lucienfostier/gaffer
src/GafferImage/VectorWarp.cpp
C++
bsd-3-clause
9,323
<html> <?php /*========================================================================= Program: CDash - Cross-Platform Dashboard System Module: $Id$ Language: PHP Date: $Date$ Version: $Revision$ Copyright (c) 2002 Kitware, Inc. All rights reserved. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notices for more information. =========================================================================*/ // To be able to access files in this CDash installation regardless // of getcwd() value: // $cdashpath = str_replace('\\', '/', dirname(dirname(__FILE__))); set_include_path($cdashpath . PATH_SEPARATOR . get_include_path()); require_once("cdash/config.php"); require_once("cdash/pdo.php"); require_once("cdash/common.php"); $noforcelogin = 1; include('login.php'); @$userid = $_GET["userid"]; if ($userid != NULL) { $userid = pdo_real_escape_numeric($userid); } if(!$userid && !isset($_SESSION['cdash'])) { echo "Not a valid user id"; return; } $buildid = pdo_real_escape_numeric($_GET["buildid"]); if(!isset($buildid) || !is_numeric($buildid)) { echo "Not a valid buildid!"; return; } $db = pdo_connect("$CDASH_DB_HOST", "$CDASH_DB_LOGIN","$CDASH_DB_PASS"); pdo_select_db("$CDASH_DB_NAME",$db); // Find the project variables $build = pdo_query("SELECT name,type,siteid,projectid FROM build WHERE id='$buildid'"); $build_array = pdo_fetch_array($build); $buildtype = $build_array["type"]; $buildname = $build_array["name"]; $siteid = $build_array["siteid"]; $projectid = $build_array["projectid"]; @$submit = $_POST["submit"]; @$groupid = $_POST["groupid"]; if ($groupid != NULL) { $groupid = pdo_real_escape_numeric($groupid); } @$expected = $_POST["expected"]; if ($expected != NULL) { $expected = pdo_real_escape_numeric($expected); } @$definerule = $_POST["definerule"]; @$markexpected = $_POST["markexpected"]; if($markexpected) { // If a rule already exists we update it $build2groupexpected = pdo_query("SELECT groupid FROM build2grouprule WHERE groupid='$groupid' AND buildtype='$buildtype' AND buildname='$buildname' AND siteid='$siteid' AND endtime='1980-01-01 00:00:00'"); if(pdo_num_rows($build2groupexpected) > 0 ) { pdo_query("UPDATE build2grouprule SET expected='$expected' WHERE groupid='$groupid' AND buildtype='$buildtype' AND buildname='$buildname' AND siteid='$siteid' AND endtime='1980-01-01 00:00:00'"); } else if($expected) // we add the grouprule { $now = gmdate(FMT_DATETIME); pdo_query("INSERT INTO build2grouprule(groupid,buildtype,buildname,siteid,expected,starttime,endtime) VALUES ('$groupid','$buildtype','$buildname','$siteid','$expected','$now','1980-01-01 00:00:00')"); } } @$removebuild = $_POST["removebuild"]; if($removebuild) { add_log("Build #".$buildid." removed manualy","addbuildgroup"); remove_build($buildid); } if($submit) { // Remove the group $prevgroup = pdo_fetch_array(pdo_query("SELECT groupid as id FROM build2group WHERE buildid='$buildid'")); $prevgroupid = $prevgroup["id"]; pdo_query("DELETE FROM build2group WHERE groupid='$prevgroupid' AND buildid='$buildid'"); // Insert into the group pdo_query("INSERT INTO build2group(groupid,buildid) VALUES ('$groupid','$buildid')"); if($definerule) { // Mark any previous rule as done $now = gmdate(FMT_DATETIME); pdo_query("UPDATE build2grouprule SET endtime='$now' WHERE groupid='$prevgroupid' AND buildtype='$buildtype' AND buildname='$buildname' AND siteid='$siteid' AND endtime='1980-01-01 00:00:00'"); // Add the new rule (begin time is set by default by mysql pdo_query("INSERT INTO build2grouprule(groupid,buildtype,buildname,siteid,expected,starttime,endtime) VALUES ('$groupid','$buildtype','$buildname','$siteid','$expected','$now','1980-01-01 00:00:00')"); } return; } // Find the groups available for this project $group = pdo_query("SELECT name,id FROM buildgroup WHERE id NOT IN (SELECT groupid as id FROM build2group WHERE buildid='$buildid') AND projectid='$projectid'"); ?> <head> <style type="text/css"> .submitLink { color: #00f; background-color: transparent; text-decoration: underline; border: none; cursor: pointer; cursor: hand; } </style> </head> <form method="post" action=""> <table width="100%" border="0"> <tr> <?php // If expected // Find the groups available for this project $currentgroup = pdo_query("SELECT g.name,g.id FROM buildgroup AS g,build2group as bg WHERE g.id=bg.groupid AND bg.buildid='$buildid'"); $currentgroup_array = pdo_fetch_array($currentgroup); $isexpected = 0; $currentgroupid = $currentgroup_array ["id"]; // This works only for the most recent dashboard (and future) $build2groupexpected = pdo_query("SELECT groupid FROM build2grouprule WHERE groupid='$currentgroupid' AND buildtype='$buildtype' AND buildname='$buildname' AND siteid='$siteid' AND endtime='1980-01-01 00:00:00' AND expected='1'"); if(pdo_num_rows($build2groupexpected) > 0 ) { $isexpected = 1; } ?> <td bgcolor="#DDDDDD" width="35%"><font size="2"><b><?php echo $currentgroup_array["name"] ?></b>: </font></td> <td bgcolor="#DDDDDD" width="65%" colspan="2"><font size="2"><a href="#" onclick="javascript:markasexpected_click(<?php echo $buildid ?>,<?php echo $currentgroup_array["id"]?>, <?php if($isexpected) {echo "0";} else {echo "1";} ?>)"> [<?php if($isexpected) { echo "mark as non expected"; } else { echo "mark as expected"; } ?>]</a> </font></td> </tr> <?php while($group_array = pdo_fetch_array($group)) { ?> <tr> <td bgcolor="#DDDDDD" width="35%"><font size="2"><b><?php echo $group_array["name"] ?></b>: </font></td> <td bgcolor="#DDDDDD" width="20%"><font size="2"><input id="expected_<?php echo $buildid."_".$group_array["id"] ?>" type="checkbox"/> expected</font></td> <td bgcolor="#DDDDDD" width="45%"><font size="2"> <a href="#" onclick="javascript:addbuildgroup_click(<?php echo $buildid ?>,<?php echo $group_array["id"]?>,1)">[move to group]</a> </font></td> </tr> <?php } ?> <tr> <td bgcolor="#DDDDDD" width="35%" colspan="3"><font size="2"> <a href="#" onclick="javascript:removebuild_click(<?php echo $buildid ?>)">[remove this build]</a> </font></td> </tr> </table> </form> </html>
cpatrick/CDash
ajax/addbuildgroup.php
PHP
bsd-3-clause
6,825
from datetime import datetime, timedelta from django.contrib.auth.models import Group from django.contrib.contenttypes.models import ContentType from django.utils.timezone import now import mock from nose.tools import eq_, ok_ from remo.base.tests import RemoTestCase from remo.dashboard.models import ActionItem from remo.events.models import Event from remo.events.tasks import notify_event_owners_to_input_metrics from remo.events.tests import EventFactory, EventMetricOutcomeFactory from remo.profiles.models import UserProfile from remo.profiles.tasks import (resolve_nomination_action_items, send_rotm_nomination_reminder) from remo.profiles.tests import UserFactory from remo.remozilla.models import Bug from remo.remozilla.tests import BugFactory from remo.reports import RECRUIT_MOZILLIAN from remo.reports.models import NGReport from remo.reports.tests import ActivityFactory, NGReportFactory from remo.voting.models import Poll from remo.voting.tasks import resolve_action_items from remo.voting.tests import PollFactory, VoteFactory class RemozillaActionItems(RemoTestCase): """Test related to new action items created from bugzilla.""" def test_waiting_receipts(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) whiteboard = '[waiting receipts]' user = UserFactory.create(groups=['Rep']) bug = BugFactory.build(whiteboard=whiteboard, assigned_to=user) bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) eq_(items.count(), 1) eq_(items[0].name, 'Add receipts for ' + bug.summary) eq_(items[0].user, user) eq_(items[0].priority, ActionItem.NORMAL) def test_waiting_multiple_documents(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) whiteboard = '[waiting receipts][waiting report][waiting photos]' user = UserFactory.create(groups=['Rep']) bug = BugFactory.build(whiteboard=whiteboard, assigned_to=user) bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) eq_(items.count(), 3) namelist = ['Add receipts for ' + bug.summary, 'Add report for ' + bug.summary, 'Add photos for ' + bug.summary] for item in items: ok_(item.name in namelist) eq_(item.user, user) eq_(item.priority, ActionItem.NORMAL) def test_update_bug_whiteboard(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) whiteboard = '[waiting receipts][waiting report][waiting photos]' user = UserFactory.create(groups=['Rep']) bug = BugFactory.build(whiteboard=whiteboard, assigned_to=user) bug.save() items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 3) bug.whiteboard = '' bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) for item in items: ok_(item.completed) ok_(item.resolved) def test_mentor_validation(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) mentor = UserFactory.create(groups=['Rep', 'Mentor']) UserFactory.create(groups=['Rep'], userprofile__mentor=mentor) bug = BugFactory.build(pending_mentor_validation=True, assigned_to=mentor) bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) eq_(items.count(), 1) eq_(items[0].name, 'Waiting mentor validation for ' + bug.summary) eq_(items[0].user, mentor) eq_(items[0].priority, ActionItem.BLOCKER) def test_change_assigned_user(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) user_1 = UserFactory.create(groups=['Rep']) user_2 = UserFactory.create(groups=['Rep']) bug = BugFactory.build(assigned_to=user_1, pending_mentor_validation=True) bug.save() item = ActionItem.objects.get(content_type=model, object_id=bug.id) eq_(item.user, user_1) bug.assigned_to = user_2 bug.save() item = ActionItem.objects.get(content_type=model, object_id=bug.id) eq_(item.user, user_2) def test_resolve_mentor_validation(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) mentor = UserFactory.create(groups=['Rep', 'Mentor']) UserFactory.create(groups=['Rep'], userprofile__mentor=mentor) bug = BugFactory.build(pending_mentor_validation=True, assigned_to=mentor) bug.save() items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) eq_(items[0].name, 'Waiting mentor validation for ' + bug.summary) eq_(items[0].user, mentor) eq_(items[0].priority, ActionItem.BLOCKER) bug.pending_mentor_validation = False bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) for item in items: ok_(item.completed) ok_(item.resolved) def test_needinfo(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) needinfo = UserFactory.create(groups=['Rep']) user = UserFactory.create(groups=['Rep']) bug = BugFactory.build(assigned_to=user) bug.save() bug.budget_needinfo.add(needinfo) bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) ok_(items.count(), 1) for item in items: eq_(item.name, 'Need info for ' + bug.summary) eq_(item.user, needinfo) ok_(item.priority, ActionItem.MINOR) def test_remove_needinfo(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) user = UserFactory.create(groups=['Rep']) bug = BugFactory.create() bug.budget_needinfo.add(user) bug.save() bug.budget_needinfo.clear() bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) for item in items: ok_(item.completed) ok_(item.resolved) def test_council_reviewer_assigned(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) user = UserFactory.create(groups=['Rep', 'Council']) bug = BugFactory.build(assigned_to=user, council_member_assigned=True) bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) eq_(items.count(), 1) eq_(items[0].name, 'Review budget request ' + bug.summary) eq_(items[0].user, user) eq_(items[0].priority, ActionItem.BLOCKER) def test_council_reviewer_removed(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) user = UserFactory.create(groups=['Council']) bug = BugFactory.build(assigned_to=user, council_member_assigned=True) bug.save() bug.council_member_assigned = False bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) for item in items: ok_(item.completed) ok_(item.resolved) def test_remove_assignee(self): model = ContentType.objects.get_for_model(Bug) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) user = UserFactory.create(groups=['Rep']) bug = BugFactory.build(pending_mentor_validation=True, assigned_to=user) bug.save() items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) eq_(items[0].name, 'Waiting mentor validation for ' + bug.summary) eq_(items[0].user, user) eq_(items[0].priority, ActionItem.BLOCKER) bug.assigned_to = None bug.save() items = ActionItem.objects.filter(content_type=model, object_id=bug.id) for item in items: ok_(item.resolved) ok_(not item.completed) class VotingActionItems(RemoTestCase): def test_vote_action_item(self): model = ContentType.objects.get_for_model(Poll) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) council = Group.objects.get(name='Council') user = UserFactory.create(groups=['Council']) start = now() - timedelta(hours=3) poll = PollFactory.create(valid_groups=council, start=start) items = ActionItem.objects.filter(content_type=model, object_id=poll.id) eq_(items.count(), 1) for item in items: eq_(item.name, 'Cast your vote for ' + poll.name) eq_(item.user, user) ok_(item.priority, ActionItem.NORMAL) ok_(not item.completed) def test_budget_vote_action_item(self): model = ContentType.objects.get_for_model(Poll) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) council = Group.objects.get(name='Council') user = UserFactory.create(groups=['Council']) bug = BugFactory.create() start = now() - timedelta(hours=3) poll = PollFactory.create(valid_groups=council, automated_poll=True, bug=bug, start=start) items = ActionItem.objects.filter(content_type=model, object_id=poll.id) eq_(items.count(), 1) for item in items: eq_(item.name, 'Cast your vote for budget request ' + poll.bug.summary) eq_(item.user, user) ok_(item.priority, ActionItem.NORMAL) ok_(not item.completed) def test_future_vote_action_item(self): model = ContentType.objects.get_for_model(Poll) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) council = Group.objects.get(name='Council') start = now() + timedelta(hours=3) PollFactory.create(valid_groups=council, start=start) items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 0) def test_resolve_vote_action_item(self): model = ContentType.objects.get_for_model(Poll) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) council = Group.objects.get(name='Council') user = UserFactory.create(groups=['Council']) start = now() - timedelta(hours=3) poll = PollFactory.create(valid_groups=council, start=start) VoteFactory.create(poll=poll, user=user) items = ActionItem.objects.filter(content_type=model, object_id=poll.id) eq_(items.count(), 1) for item in items: ok_(item.completed) ok_(item.resolved) def test_update_vote_due_date(self): model = ContentType.objects.get_for_model(Poll) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) council = Group.objects.get(name='Council') UserFactory.create(groups=['Council']) start = now() - timedelta(hours=3) poll = PollFactory.create(valid_groups=council, start=start) poll.end = poll.end + timedelta(days=4) poll.save() items = ActionItem.objects.filter(content_type=model, object_id=poll.id) eq_(items.count(), 1) for item in items: eq_(item.due_date, poll.end.date()) def test_resolved_past_vote(self): model = ContentType.objects.get_for_model(Poll) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) council = Group.objects.get(name='Council') UserFactory.create(groups=['Council']) start = now() - timedelta(hours=3) poll = PollFactory.create(valid_groups=council, end=now() - timedelta(days=1), start=start) items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) resolve_action_items() items = ActionItem.objects.filter(content_type=model, object_id=poll.id) for item in items: ok_(item.resolved) ok_(not item.completed) def test_update_valid_groups(self): model = ContentType.objects.get_for_model(Poll) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) council = Group.objects.get(name='Council') reps = Group.objects.get(name='Rep') UserFactory.create_batch(3, groups=['Council']) UserFactory.create_batch(4, groups=['Rep']) start = now() - timedelta(hours=3) poll = PollFactory.create(valid_groups=council, start=start) poll.valid_groups = reps poll.save() items = ActionItem.objects.filter(content_type=model, object_id=poll.id) eq_(items.count(), 4) for user in reps.user_set.all(): ok_(items.filter(user=user).exists()) for user in council.user_set.all(): ok_(not items.filter(user=user).exists()) def test_user_has_already_voted(self): model = ContentType.objects.get_for_model(Poll) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) council = Group.objects.get(name='Admin') user = UserFactory.create(groups=['Admin']) start = now() - timedelta(hours=3) poll = PollFactory.create(valid_groups=council, end=now() - timedelta(days=1), start=start) VoteFactory.create(poll=poll, user=user) # Check that there is only one action item and it's resolved items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) eq_(items[0].resolved, True) class EventActionItems(RemoTestCase): def test_post_event_metrics(self): model = ContentType.objects.get_for_model(Event) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) start = now() - timedelta(days=4) end = now() - timedelta(days=1) user = UserFactory.create(groups=['Rep']) event = EventFactory.create(owner=user, start=start, end=end) notify_event_owners_to_input_metrics() items = ActionItem.objects.filter(content_type=model, object_id=event.id) eq_(items.count(), 1) def test_resolve_post_event_metrics(self): model = ContentType.objects.get_for_model(Event) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) start = now() - timedelta(days=4) end = now() - timedelta(days=1) user = UserFactory.create(groups=['Rep']) event = EventFactory.create(owner=user, start=start, end=end) notify_event_owners_to_input_metrics() items = ActionItem.objects.filter(content_type=model, object_id=event.id) eq_(items.count(), 1) EventMetricOutcomeFactory.create(event=event) for item in items: ok_(item.completed) ok_(item.resolved) def test_update_event_owner(self): model = ContentType.objects.get_for_model(Event) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) start = now() - timedelta(days=4) end = now() - timedelta(days=1) user = UserFactory.create(groups=['Rep']) event = EventFactory.create(owner=user, start=start, end=end) notify_event_owners_to_input_metrics() items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) new_owner = UserFactory.create(groups=['Rep']) event.owner = new_owner event.save() items = ActionItem.objects.filter(content_type=model, object_id=event.id) eq_(items.count(), 1) eq_(items[0].user, new_owner) class ReportActionItems(RemoTestCase): def test_verify_activity(self): model = ContentType.objects.get_for_model(NGReport) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) activity = ActivityFactory.create(name=RECRUIT_MOZILLIAN) mentor = UserFactory.create() user = UserFactory.create(groups=['Rep'], userprofile__mentor=mentor) report = NGReportFactory.create(activity=activity, user=user, mentor=mentor) items = ActionItem.objects.filter(content_type=model, object_id=report.id, resolved=False) eq_(items.count(), 1) def test_resolve_verify_action_item(self): model = ContentType.objects.get_for_model(NGReport) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) activity = ActivityFactory.create(name=RECRUIT_MOZILLIAN) mentor = UserFactory.create() user = UserFactory.create(groups=['Rep'], userprofile__mentor=mentor) report = NGReportFactory.create(activity=activity, user=user, mentor=mentor) items = ActionItem.objects.filter(content_type=model, object_id=report.id, resolved=False) eq_(items.count(), 1) report.verified_activity = True report.save() for item in items: ok_(item.completed) ok_(item.resolved) class ROTMActionItems(RemoTestCase): @mock.patch('remo.profiles.tasks.now') def test_base(self, mocked_date): model = ContentType.objects.get_for_model(UserProfile) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) mentors = UserFactory.create_batch(2, groups=['Mentor']) mocked_date.return_value = datetime(now().year, now().month, 1) send_rotm_nomination_reminder() items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 2) eq_(set([mentor.id for mentor in mentors]), set(items.values_list('object_id', flat=True))) @mock.patch('remo.profiles.tasks.now') def test_invalid_date(self, mocked_date): model = ContentType.objects.get_for_model(UserProfile) items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) UserFactory.create_batch(2, groups=['Mentor']) mocked_date.return_value = datetime(now().year, now().month, 2) send_rotm_nomination_reminder() items = ActionItem.objects.filter(content_type=model) ok_(not items.exists()) @mock.patch('remo.profiles.tasks.now') def test_resolve_action_item(self, mocked_date): model = ContentType.objects.get_for_model(UserProfile) user = UserFactory.create(groups=['Mentor']) mocked_date.return_value = datetime(now().year, now().month, 1) ActionItem.create(user.userprofile) items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) eq_(items[0].resolved, False) mocked_date.return_value = datetime(now().year, now().month, 10) resolve_nomination_action_items() eq_(items.count(), 1) eq_(items[0].resolved, True) @mock.patch('remo.profiles.tasks.now') def test_resolve_action_item_invalid_date(self, mocked_date): model = ContentType.objects.get_for_model(UserProfile) user = UserFactory.create(groups=['Mentor']) mocked_date.return_value = datetime(now().year, now().month, 1) ActionItem.create(user.userprofile) items = ActionItem.objects.filter(content_type=model) eq_(items.count(), 1) eq_(items[0].resolved, False) mocked_date.return_value = datetime(now().year, now().month, 11) resolve_nomination_action_items() eq_(items.count(), 1) eq_(items[0].resolved, False)
chirilo/remo
remo/dashboard/tests/test_models.py
Python
bsd-3-clause
21,465
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title>Gaussian Process Classification</title> <link type="text/css" rel="stylesheet" href="style.css"> </head> <body> <h2>Gaussian Process Classification</h2> Exact inference in Gaussian process models with likelihood functions tailored to classification isn't tractable. Here we consider two procedures for approximate inference for binary classification: <ol> <li> Laplace's approximation is based on an expansion around the mode of the posterior: <ol> <li type="a"> a <a href="#laplace">description</a> of the implementation of the algorithm</li> <li type="a"> a <a href="#laplace-ex-toy">simple example</a> applying the algorithm to a 2-dimensional classification problem</li> <li type="a"> a somewhat <a href="#laplace-ex-usps">more involved</a> example, classifying images of hand-written digits.</li> </ol> </li> <li> The Expectation Propagation (EP) algorithm is based on matching moments approximations to the marginals of the posterior: <ol> <li type="a"> a <a href="#ep">description</a> of the implementation of the algorithm</li> <li type="a"> a <a href="#ep-ex-toy">simple example</a> applying the algorithm to a 2-dimensional classification problem</li> <li type="a"> a somewhat <a href="#ep-ex-usps">more involved<a> example, classifying images of hand-written digits.</li> </ol> </li> </ol> The code, demonstration scripts and documentation are all contained in the <a href="http://www.gaussianprocess.org/gpml/code/gpml-matlab.tar.gz">tar</a> or <a href="http://www.gaussianprocess.org/gpml/code/gpml-matlab.zip">zip</a> archive file. <h3 id="laplace">Laplace's Approximation</h3> <p>It is straight forward to implement Laplace's method for binary Gaussian process classification using matlab. Here we discuss an implementation which relies closely on Algorithm 3.1 (p. 46) for computing Laplace's approximation to the posterior, Algorithm 3.2 (p. 47) for making probabilistic predictions for test cases and Algorithm 5.1 (p. 126) for computing partial derivatives of the log marginal likelihood w.r.t. the hyperparameters (the parameters of the covariance function). Be aware that the <em>negative</em> of the log marginal likelihood is used.</p> <p>The implementation given in <a href="../gpml/binaryLaplaceGP.m">binaryLaplaceGP.m</a> can conveniently be used together with <a href="../gpml/minimize.m">minimize.m</a>. The program can do one of two things: <ol> <li> compute the negative log marginal likelihood and its partial derivatives wrt. the hyperparameters, usage</p> <pre> [nlml dnlml] = binaryLaplaceGP(logtheta, covfunc, lik, x, y) </pre>which is used when "training" the hyperparameters, or</li> <li> compute the (marginal) predictive distribution of test inputs, usage</p> <pre> [p mu s2 nlml] = binaryLaplaceGP(logtheta, covfunc, lik, x, y, xstar) </pre></li> </ol> Selection between the two modes is indicated by the presence (or absence) of test cases, <tt>xstar</tt>. The arguments to the <a href="../gpml/binaryLaplaceGP.m">binaryLaplaceGP.m</a> function are given in the table below where <tt>n</tt> is the number of training cases, <tt>D</tt> is the dimension of the input space and <tt>nn</tt> is the number of test cases:<br><br> <table border=0 cols=2 width="100%"> <tr><td width="15%"><b>inputs</b></td><td></td></tr> <tr><td><tt>logtheta</tt></td><td>a (column) vector containing the logarithm of the hyperparameters</td></tr> <tr><td><tt>covfunc</tt></td><td>the covariance function, see <a href="../gpml/covFunctions.m">covFunctions.m</a> <tr><td><tt>lik</tt></td><td>the likelihood function, built-in functions are: <tt> logistic</tt> and <tt>cumGauss</tt>.</td></tr> <tr><td><tt>x</tt></td><td>a <tt>n</tt> by <tt>D</tt> matrix of training inputs</td></tr> <tr><td><tt>y</tt></td><td>a (column) vector (of length <tt>n</tt>) of training set <tt>+1/-1</tt> binary targets</td></tr> <tr><td><tt>xstar</tt></td><td>(optional) a <tt>nn</tt> by <tt>D</tt> matrix of test inputs</td></tr> <tr><td>&nbsp;</td><td></td></tr> <tr><td><b>outputs</b></td><td></td></tr> <tr><td><tt>nlml</tt></td><td>the negative log marginal likelihood</td></tr> <tr><td><tt>dnlml</tt></td><td>(column) vector with the partial derivatives of the negative log marginal likelihood wrt. the logarithm of the hyperparameters.</td></tr> <tr><td><tt>mu</tt></td><td>(column) vector (of length <tt>nn</tt>) of predictive latent means</td></tr> <tr><td><tt>s2</tt></td><td>(column) vector (of length <tt>nn</tt>) of predictive latent variances</td></tr> <tr><td><tt>p</tt></td><td>(column) vector (of length <tt>nn</tt>) of predictive probabilities</td></tr> </table><br> The number of hyperparameters (and thus the length of the <tt>logtheta</tt> vector) depends on the choice of covariance function. Below we will used the squared exponential covariance function with isotropic distance measure, implemented in <a href="../gpml/covSEiso.m">covSEiso.m</a>; this covariance function has <tt>2</tt> parameters.</p> Properties of various covariance functions are discussed in section 4.2. For the details of the implementation of the above covariance functions, see <a href="../gpml/covFunctions.m">covFunctions.m</a> and the two likelihood functions <tt>logistic</tt> and <tt>cumGauss</tt> are placed at the end of the <a href="../gpml/binaryLaplaceGP.m">binaryLaplaceGP.m</a> file. In either mode (training or testing) the program first uses Newton's algorithm to find the maximum of the posterior over latent variables. In the first ever call of the function, the initial guess for the latent variables is the zero vector. If the function is called multiple times, it stores the optimum from the previous call in a persistent variable and attempts to use this value as a starting guess for Newton's algorithm. This is useful when training, e.g. using <a href="../gpml/minimize.m">minimize.m</a>, since the hyperparameters for consecutive calls will generally be similar, and one would expect the maximum over latent variables based on the previous setting of the hyperparameters as a reasonable starting guess. (If it turns out that this strategy leads to a very bad marginal likelihood value, then the function reverts to starting at zero.)</p> The Newton algorithm follows Algorithm 3.1, section 3.4, page 46<br></p> <center><img src="alg31.gif"></center><br> <p>The iterations are terminated when the improvement in log marginal likelihood drops below a small tolerance. During the iterations, it is checked that the log marginal likelihood never decreases; if this happens bisection is repeatedly applied (up to a maximum of 10 times) until the likelihood increases.</p> What happens next depends on whether we are in the training or prediction mode, as indicated by the absence or presence of test inputs <tt>xstar</tt>. If test cases are present, then predictions are computed following Algorithm 3.2, section 3.4, page 47<br></p><center><img src="alg32.gif"></center><br> Alternatively, if we are in the training mode, we proceed to compute the partial derivatives of the log marginal likelihood wrt the hyperparameters, using Algorithm 5.1, section 5.5.1, page 126<br></p> <center><img src="alg51.gif"></center><br> <h3 id="laplace-ex-toy">Example of Laplace's Approximation applied to a 2-dimensional classification problem</h3> You can either follow the example below or run the short <a href="../gpml-demo/demo_laplace_2d.m">demo_laplace_2d.m</a> script. First we generate a simple artificial classification dataset, by sampling data points from each of two classes from separate Gaussian distributions, as follows: <pre> n1=80; n2=40; % number of data points from each class S1 = eye(2); S2 = [1 0.95; 0.95 1]; % the two covariance matrices m1 = [0.75; 0]; m2 = [-0.75; 0]; % the two means randn('seed',17) x1 = chol(S1)'*randn(2,n1)+repmat(m1,1,n1); % samples from one class x2 = chol(S2)'*randn(2,n2)+repmat(m2,1,n2); % and from the other x = [x1 x2]'; % these are the inputs and y = [repmat(-1,1,n1) repmat(1,1,n2)]'; % outputs used a training data </pre> Below the samples are show together with the "Bayes Decision Probabilities", obtained from complete knowledge of the data generating process:</p> <center><img src="fig2d.gif"></center><br> Note, that the ideal predictive probabilities depend only on the relative density of the two classes, and not on the absolute density. We would, for example, expect that the structure in the upper right hand corner of the plot may be very difficult to obtain based on the samples, because the data density is very low. The contour plot is obtained by: <pre> [t1 t2] = meshgrid(-4:0.1:4,-4:0.1:4); t = [t1(:) t2(:)]; % these are the test inputs tt = sum((t-repmat(m1',length(t),1))*inv(S1).*(t-repmat(m1',length(t),1)),2); z1 = n1*exp(-tt/2)/sqrt(det(S1)); tt = sum((t-repmat(m2',length(t),1))*inv(S2).*(t-repmat(m2',length(t),1)),2); z2 = n2*exp(-tt/2)/sqrt(det(S2)); contour(t1,t2,reshape(z2./(z1+z2),size(t1)),[0.1:0.1:0.9]); hold on plot(x1(1,:),x1(2,:),'b+') plot(x2(1,:),x2(2,:),'r+') </pre> Now, we will fit a probabilistic Gaussian process classifier to this data, using an implementation of Laplace's method. We must specify a covariance function and a likelihood function. First, we will try the squared exponential covariance function <tt>covSEiso</tt>. We must specify the parameters of the covariance function (hyperparameters). For the isotropic squared exponential covariance function there are two hyperparameters, the lengthscale (kernel width) and the magnitude. We need to specify values for these hyperparameters (see below for how to learn them). Initially, we will simply set the log of these hyperparameters to zero, and see what happens. For the likelihood function, we use the cumulative Gaussian: <pre> loghyper = [0; 0]; p2 = binaryLaplaceGP(loghyper, 'covSEiso', 'cumGauss', x, y, t); clf contour(t1,t2,reshape(p2,size(t1)),[0.1:0.1:0.9]); hold on plot(x1(1,:),x1(2,:),'b+') plot(x2(1,:),x2(2,:),'r+') </pre> to produce predictive probabilities on the grid of test points:</p> <center><img src="fig2dl1.gif"></center><br> Although the predictive contours in this plot look quite different from the "Bayes Decision Probabilities" plotted above, note that the predictive probabilities in regions of high data density are not terribly different from those of the generating process. Recall, that this plot was made using hyperparameter which we essentially pulled out of thin air. Now, we find the values of the hyperparameters which maximize the marginal likelihood (or strictly, the Laplace approximation of the marginal likelihood): <pre> newloghyper = minimize(loghyper, 'binaryLaplaceGP', -20, 'covSEiso', 'cumGauss', x, y) p3 = binaryLaplaceGP(newloghyper, 'covSEiso', 'cumGauss', x, y, t); </pre> where the argument <tt>-20</tt> tells minimize to evaluate the function at most <tt>20</tt> times. The new hyperparameters have a fairly similar length scale, but a much larger magnitude for the latent function. This leads to more extreme predictive probabilities: <pre> clf contour(t1,t2,reshape(p3,size(t1)),[0.1:0.1:0.9]); hold on plot(x1(1,:),x1(2,:),'b+') plot(x2(1,:),x2(2,:),'r+') </pre> produces:</p> <center><img src="fig2dl2.gif"></center><br> Note, that this plot still shows that the predictive probabilities revert to one half, when we move away from the data (in stark contrast to the "Bayes Decision Probabilities" in this example). This may or may not be seen as an appropriate behaviour, depending on our prior expectations about the data. It is a direct consequence of the behaviour of the squared exponential covariance function. We can instead try a neural network covariance function <a href="../gpml/covNNiso.m">covNNiso.m</a>, which has the ability to saturate at specific latent values, as we move away from zero: <pre> newloghyper = minimize(loghyper, 'binaryLaplaceGP',-20,'covNNiso','cumGauss',x,y); p4 = binaryLaplaceGP(newloghyper, 'covNNiso','cumGauss', x, y, t); clf contour(t1,t2,reshape(p4,size(t1)),[0.1:0.1:0.9]); hold on plot(x1(1,:),x1(2,:),'b+') plot(x2(1,:),x2(2,:),'r+') </pre> to produce:</p> <center><img src="fig2dl3.gif"></center><br> which shows a somewhat less pronounced tendency for the predictive probabilities to tend to one half as we move towards the boundaries of the plot. <h3 id="laplace-ex-usps">Example of Laplace's Approximation applied to hand-written digit classification</h3> You can either follow the example below or run the short <a href="../gpml/gpml-demo/demo_laplace_usps.m">demo_laplace_usps.m</a> script. You will need the code form the <a href="http://www.gaussianprocess.org/gpml/code/gpml-matlab.tar.gz">tar</a> or <a href="http://www.gaussianprocess.org/gpml/code/gpml-matlab.zip">zip</a> archive and additionally the data, see below. Consider compiling the mex files (see <a href="../gpml/README">README</a> file), although the programs should work even without.</p> As an example application we will consider the USPS resampled data which can be found <a href="http://www.gaussianprocess.org/gpml/data">here</a>. Specifically, we will need to download <tt>usps_resampled.mat</tt> and unpack the data from <a href="http://www.gaussianprocess.org/gpml/data/usps_resampled.mat.bz2">bz2</a> (7.0 Mb) or <a href="http://www.gaussianprocess.org/gpml/data/usps_resampled.mat.zip">zip</a> (8.3 Mb) files. As an example, we will consider the binary classification task of separating images of the digit "3" from images of the digit "5". <pre> [x y xx yy] = loadBinaryUSPS(3,5); </pre> which will create the training inputs <tt>x</tt> (of size 767 by 256), binary (+1/-1) training targets <tt>y</tt> (of length 767), and <tt>xx</tt> and <tt>yy</tt> containing the test set (of size 773). Use e.g. <tt>imagesc(reshape(x(3,:),16,16)');</tt> to view an image (here the 3rd image of the training set).</p> Now, let us make predictions using the squared exponential covariance function <tt>covSEiso</tt> and the cumulative Gaussian likelihood function <tt>cumGauss</tt>. We must specify the parameters of the covariance function (hyperparameters). For the isotropic squared exponential covariance function there are two hyperparameters, the characteristic length-scale (kernel width) and the signal magnitude. We need to specify values for these hyperparameters (see below for how to learn them). One strategy, which is perhaps not too unreasonable would be to set the characteristic length-scale to be equal to the average pair-wise distance between points, which for this data is around 22; the signal variance can be set to unity, since this is the range at which the sigmoid non-linearity comes into play. Other strategies for setting initial guesses for the hyperparameters may be reasonable as well. We need to specify the logarithm of the hypers, roughly log(22)=3 and log(1)=0: <pre> loghyper = [3.0; 0.0]; % set the log hyperparameters p = binaryLaplaceGP(loghyper, 'covSEiso', 'cumGauss', x, y, xx); </pre> which may take a few seconds to compute. We can visualize the predictive test set probabilities using: <pre> plot(p,'.') hold on plot([1 length(p)],[0.5 0.5],'r') </pre> to get:</p><br><center><img src="figlapp.gif"></center><br> where we should keep in mind that the test cases are ordered according to their target class. Notice that there are misclassifications, but there are no very confident misclassifications. The number of test set errors (out of 773 test cases) when thresholding the predictive probability at 0.5 and the average amount of information about the test set labels in excess of a 50/50 model in bits are given by: <pre> sum((p>0.5)~=(yy>0)) mean((yy==1).*log2(p)+(yy==-1).*log2(1-p))+1 </pre> which shows test set 35 prediction errors (out of 773 test cases) and an average amount of information of about 0.71 bits, compare to Figure 3.7(b) and 3.7(d) on page 64.</p> More interestingly, we can also use the program to find the values for the hyperparameters which optimize the marginal likelihood, as follows: <pre> [loghyper' binaryLaplaceGP(loghyper, 'covSEiso', 'cumGauss', x, y)] [newloghyper logmarglik] = minimize(loghyper, 'binaryLaplaceGP', -20, 'covSEiso', 'cumGauss', x, y); [newloghyper' logmarglik(end)] </pre> where the third argument <tt>-20</tt> to the minimize function, tells minimize to evaluate the function at most 20 times (this is adequate when the parameter space is only 2-dimensional. Above, we first evaluate the negative log marginal likelihood at our initial guess for <tt>loghyper</tt> (which is about <tt>222</tt>), then minimize the negative log marginal likelihood w.r.t. the hyperparameters, to obtain new values of <tt>2.75</tt> for the log lengthscale and <tt>2.27</tt> for the log magnitude. The negative log marginal likelihood decreases to about <tt>99</tt> at the minimum, see also Figure 3.7(a) page 64. The marginal likelihood has thus increased by a factor of exp(222-99) or roughly 3e+53.</p> Finally, we can make test set predictions with the new hyperparameters: <pre> pp = binaryLaplaceGP(newloghyper, 'covSEiso', 'cumGauss', x, y, xx); plot(pp,'g.') </pre> to obtain:</p><br><center><img src="figlapp2.gif"></center><br> We note that the new predictions (in green) generally take more extreme values than the old ones (in blue). Evaluating the new test predictions: <pre> sum((pp>0.5)~=(yy>0)) mean((yy==1).*log2(pp)+(yy==-1).*log2(1-pp))+1 </pre> reveals that there are now 22 test set misclassifications (as opposed to 35) and the information about the test set labels has increased from 0.71 bits to 0.83 bits. <h3 id="ep">2. The Expectation Propagation Algorithm</h3> <p>It is straight forward to implement the Expectation Propagation (EP) algorithm for binary Gaussian process classification using matlab. Here we discuss an implementation which relies closely on Algorithm 3.5 (p. 58) for computing the EP approximation to the posterior, Algorithm 3.6 (p. 59) for making probabilistic predictions for test cases and Algorithm 5.2 (p. 127) for computing partial derivatives of the log marginal likelihood w.r.t. the hyperparameters (the parameters of the covariance function). Be aware that the <em>negative</em> of the log marginal likelihood is used.</p> <p>The implementation given in <a href="../gpml/binaryEPGP.m">binaryEPGP.m</a> can conveniently be used together with <a href="../gpml/minimize.m">minimize.m</a>. The program can do one of two things: <ol> <li> compute the negative log marginal likelihood and its partial derivatives wrt. the hyperparameters, usage</p> <pre> [nlml dnlml] = binaryEPGP(logtheta, covfunc, x, y) </pre>which is used when "training" the hyperparameters, or</li> <li> compute the (marginal) predictive distribution of test inputs, usage</p> <pre> [p mu s2 nlml] = binaryEPGP(logtheta, cov, x, y, xstar) </pre></li> </ol> Selection between the two modes is indicated by the presence (or absence) of test cases, <tt>xstar</tt>. The arguments to the <a href="../gpml/binaryEPGP.m">binaryEPGP.m</a> function are given in the table below where <tt>n</tt> is the number of training cases, <tt>D</tt> is the dimension of the input space and <tt>nn</tt> is the number of test cases:<br><br> <table border=0 cols=2 width="100%"> <tr><td width="15%"><b>inputs</b></td><td></td></tr> <tr><td><tt>logtheta</tt></td><td>a (column) vector containing the logarithm of the hyperparameters</td></tr> <tr><td><tt>covfunc</tt></td><td>the covariance function, see <a href="../gpml/covFunctions.m">covFunctions.m</a> <tr><td><tt>x</tt></td><td>a <tt>n</tt> by <tt>D</tt> matrix of training inputs</td></tr> <tr><td><tt>y</tt></td><td>a (column) vector (of length <tt>n</tt>) of training set <tt>+1/-1</tt> binary targets</td></tr> <tr><td><tt>xstar</tt></td><td>(optional) a <tt>nn</tt> by <tt>D</tt> matrix of test inputs</td></tr> <tr><td>&nbsp;</td><td></td></tr> <tr><td><b>outputs</b></td><td></td></tr> <tr><td><tt>nlml</tt></td><td>the negative log marginal likelihood</td></tr> <tr><td><tt>dnlml</tt></td><td>(column) vector with the partial derivatives of the negative log marginal likelihood wrt. the logarithm of the hyperparameters.</td></tr> <tr><td><tt>mu</tt></td><td>(column) vector (of length <tt>nn</tt>) of predictive latent means</td></tr> <tr><td><tt>s2</tt></td><td>(column) vector (of length <tt>nn</tt>) of predictive latent variances</td></tr> <tr><td><tt>p</tt></td><td>(column) vector (of length <tt>nn</tt>) of predictive probabilities</td></tr> </table><br> The number of hyperparameters (and thus the length of the <tt>logtheta</tt> vector) depends on the choice of covariance function. Below we will use the squared exponential covariance functions with isotropic distance measure, implemented in <a href="../gpml/covSEiso.m">covSEiso.m</a>: this covariance function has <tt>2</tt> parameters.</p> Properties of various covariance functions are discussed in section 4.2. For the details of the implementation of the above covariance functions, see <a href="../gpml/covFunctions.m">covFunctions.m</a>. In either mode (training or testing) the program first uses sweeps of EP updates to each latent variable in turn. Every update recomputes new values for the tilde parameters <tt>ttau</tt> and <tt>tnu</tt> (and updates the parameters of the posterior <tt>mu</tt> and <tt>Sigma</tt>. In the first ever call of the function, the initial guess for the tilde parameters <tt>ttau</tt> and <tt>tnu</tt> are both the zero vector. If the function is called multiple times, it stores the optimum from the previous call in a persistent variable and attempts to use these values as a starting guess for subsequent EP updates. This is useful when training, e.g. using <a href="../gpml/minimize.m">minimize.m</a>, since the hyperparameters for consecutive calls will generally be similar, and one would expect the best value of the tilde parameters from the previous setting of the hyperparameters as a reasonable starting guess. (If it turns out that this strategy leads to a very bad marginal likelihood value, then the function reverts to starting at zero.)</p> The Expectation Propagation implementation follows Algorithm 3.5, section 3.6, page 58<br></p> <center><img src="alg35.gif"></center><br> The iterations are terminated when the improvement in log marginal likelihood drops below a small tolerance, or a prespecified maximum (10) number of sweeps is reached (causing a warning message to be issued). About five sweeps is often sufficient when starting from zero, less if a reasonable starting point is available.</p> What happens next depends on whether we are in the training or prediction mode, as indicated by the absence or presence of test inputs <tt>xstar</tt>. If test cases are present, then predictions are computed following Algorithm 3.6, section 3.6, page 59<br></p> <center><img src="alg36.gif"></center><br> Alternatively, if we are in the training mode, we proceed to compute the partial derivatives of the log marginal likelihood wrt the hyperparameters, using Algorithm 5.2, section 5.5, page 127<br></p> <center><img src="alg52.gif"></center><br> <h3 id="ep-ex-toy">Example of Laplace's Approximation applied to a 2-dimensional classification problem</h3> You can either follow the example below or run the short <a href="../gpml-demo/demo_ep_2d.m">demo_ep_2d.m</a> script. First we generate a simple artificial classification dataset, by sampling data points from each of two classes from separate Gaussian distributions, as follows: <pre> n1=80; n2=40; % number of data points from each class randn('seed',17) S1 = eye(2); S2 = [1 0.95; 0.95 1]; % the two covariance matrices m1 = [0.75; 0]; m2 = [-0.75; 0]; % the two means x1 = chol(S1)'*randn(2,n1)+repmat(m1,1,n1); % samples from one class x2 = chol(S2)'*randn(2,n2)+repmat(m2,1,n2); % and from the other x = [x1 x2]'; % these are the inputs and y = [repmat(-1,1,n1) repmat(1,1,n2)]'; % outputs used a training data </pre> Below the samples are show together with the "Bayes Decision Probabilities", obtained from complete knowledge of the data generating process:</p> <center><img src="fig2d.gif"></center><br> Note, that the ideal predictive probabilities depend only on the relative density of the two classes, and not on the absolute density. We would eg expect that the structure in the upper right hand corner of the plot may be very difficult to obtain based on the samples, because the data density is very low. The contour plot is obtained by: <pre> [t1 t2] = meshgrid(-4:0.1:4,-4:0.1:4); t = [t1(:) t2(:)]; % these are the test inputs tt = sum((t-repmat(m1',length(t),1))*inv(S1).*(t-repmat(m1',length(t),1)),2); z1 = n1*exp(-tt/2)/sqrt(det(S1)); tt = sum((t-repmat(m2',length(t),1))*inv(S2).*(t-repmat(m2',length(t),1)),2); z2 = n2*exp(-tt/2)/sqrt(det(S2)); contour(t1,t2,reshape(z2./(z1+z2),size(t1)),[0.1:0.1:0.9]); hold on plot(x1(1,:),x1(2,:),'b+') plot(x2(1,:),x2(2,:),'r+') </pre> Now, we will fit a probabilistic Gaussian process classifier to this data, using an implementation of the Expectation Propagation (EP) algorithm. We must specify a covariance function. First, we will try the squared exponential covariance function <tt>covSEiso</tt>. We must specify the parameters of the covariance function (hyperparameters). For the isotropic squared exponential covariance function there are two hyperparameters, the lengthscale (kernel width) and the magnitude. We need to specify values for these hyperparameters (see below for how to learn them). Initially, we will simply set the log of these hyperparameters to zero, and see what happens. For the likelihood function, we use the cumulative Gaussian: <pre> loghyper = [0; 0]; p2 = binaryEPGP(loghyper, 'covSEiso', x, y, t); clf contour(t1,t2,reshape(p2,size(t1)),[0.1:0.1:0.9]); hold on plot(x1(1,:),x1(2,:),'b+') plot(x2(1,:),x2(2,:),'r+') </pre> to produce predictive probabilities on the grid of test points:</p> <center><img src="fig2de1.gif"></center><br> Although the predictive contours in this plot look quite different from the "Bayes Decision Probabilities" plotted above, note that the predictive probabilities in regions of high data density are not terribly different from those of the generating process. Recall, that this plot was made using hyperparameter which we essentially pulled out of thin air. Now, we find the values of the hyperparameters which maximize the marginal likelihood (or strictly, the EP approximation of the marginal likelihood): <pre> newloghyper = minimize(loghyper, 'binaryEPGP', -20, 'covSEiso', x, y) p3 = binaryEPGP(newloghyper, 'covSEiso', x, y, t); </pre> where the argument <tt>-20</tt> tells minimize to evaluate the function at most <tt>20</tt> times. The new hyperparameters have a fairly similar length scale, but a much larger magnitude for the latent function. This leads to more extreme predictive probabilities: <pre> clf contour(t1,t2,reshape(p3,size(t1)),[0.1:0.1:0.9]); hold on plot(x1(1,:),x1(2,:),'b+') plot(x2(1,:),x2(2,:),'r+') </pre> produces:</p> <center><img src="fig2de2.gif"></center><br> Note, that this plot still shows that the predictive probabilities revert to one half, when we move away from the data (in stark contrast to the "Bayes Decision Probabilities" in this example). This may or may not be seen as an appropriate behaviour, depending on our prior expectations about the data. It is a direct consequence of the behaviour of the squared exponential covariance function. We can instead try a neural network covariance function, which has the ability to saturate at specific latent values, as we move away from zero: <pre> newloghyper = minimize(loghyper, 'binaryEPGP', -20, 'covNN', x, y); p4 = binaryEPGP(newloghyper, 'covNN', x, y, t); clf contour(t1,t2,reshape(p4,size(t1)),[0.1:0.1:0.9]); hold on plot(x1(1,:),x1(2,:),'b+') plot(x2(1,:),x2(2,:),'r+') </pre> to produce:</p> <center><img src="fig2de3.gif"></center><br> which shows extreme probabilities even at the boundaries of the plot. <h3 id="ep-ex-usps">Example of the Expectation Propagation Algorithm applied to hand-written digit classification</h3> You can either follow the example below or run the short <a href="../gpml/gpml-demo/demo_ep_usps.m">demo_ep_usps.m</a> script. You will need the code form the <a href="http://www.gaussianprocess.org/gpml/code/gpml-matlab.tar.gz">gpml-matlab.tar.gz</a> archive and additionally the data, see below. Consider compiling the mex files (see <a href="../gpml/README">README</a> file), although the programs should work even without.</p> As an example application we will consider the USPS resampled data which can be found <a href="http://www.gaussianprocess.org/gpml/data">here</a>. Specifically, we will need to download <tt>usps_resampled.mat</tt> and unpack the data from <a href="http://www.gaussianprocess.org/gpml/data/usps_resampled.mat.bz2">bz2</a> (7.0 Mb) or <a href="http://www.gaussianprocess.org/gpml/data/usps_resampled.mat.zip">zip</a> (8.3 Mb) files. As an example, we will consider the binary classification task of separating images of the digit "3" from images of the digit "5". <pre> cd gpml-demo % you need to be in the gpml-demo directory cd ..; w=pwd; addpath([w,'/gpml']); cd gpml-demo % add the path for the code [x y xx yy] = loadBinaryUSPS(3,5); </pre> which will create the training inputs <tt>x</tt> (of size 767 by 256), binary (+1/-1) training targets <tt>y</tt> (of length 767), and <tt>xx</tt> and <tt>yy</tt> containing the test set (of size 773). Use e.g. <tt>imagesc(reshape(x(3,:),16,16)');</tt> to view an image (here the 3rd image of the training set).</p> Now, let us make predictions using the squared exponential covariance function <tt>covSEiso</tt>. We must specify the parameters of the covariance function (hyperparameters). For the isotropic squared exponential covariance function there are two hyperparameters, the lengthscale (kernel width) and the magnitude. We need to specify values for these hyperparameters (see below for how to learn them). One strategy, which is perhaps not too unreasonable would be to set the characteristic length-scale to be equal to the average pair-wise distance between points, which for this data is around 22; the signal variance can be set to unity, since this is the range at which the sigmoid non-linearity comes into play. Other strategies for setting initial guesses for the hyperparameters may be reasonable as well. We need to specify the logarithm of the hypers, roughly log(22)=3 and log(1)=0: <pre> loghyper = [3.0; 0.0]; % set the log hyperparameters p = binaryEPGP(loghyper, 'covSEiso', x, y, xx); </pre> which may take a few minutes to compute. We can visualize the predictive probabilities for the test cases using: <pre> plot(p,'.') hold on plot([1 length(p)],[0.5 0.5],'r') </pre> to get:</p><br><center><img src="figepp.gif"></center><br> where we should keep in mind that the test cases are ordered according to their target class. Notice that there are misclassifications, but there are no very confident misclassifications. The number of test set errors (out of 773 test cases) when thresholding the predictive probability at 0.5 and the average amount of information about the test set labels in excess of a 50/50 model in bits are given by: <pre> sum((p>0.5)~=(yy>0)) mean((yy==1).*log2(p)+(yy==-1).*log2(1-p))+1 </pre> which shows test set 35 prediction errors (out of 773 test cases) and an average amount of information of about 0.72 bits, compare to Figure 3.8(b) and 3.8(d) on page 65.</p> More interestingly, we can also use the program to find the values for the hyperparameters which optimize the marginal likelihood, as follows: <pre> [loghyper' binaryEPGP(loghyper, 'covSEiso', x, y)] [newloghyper logmarglik] = minimize(loghyper, 'binaryEPGP', -20, 'covSEiso', x, y); [newloghyper' logmarglik(end)] </pre> where the third argument <tt>-20</tt> to the minimize function, tells minimize to evaluate the function at most 20 times (this is adequate when the parameter space is only 2-dimensional. Warning: the optimization above may take about an hour depending on your machine and whether you have compiled the mex files. If you don't want to wait that long, you can train on a subset of the data (but note that the cases are ordered according to class).</p> Above, we first evaluate the negative log marginal likelihood at our initial guess for <tt>loghyper</tt> (which is about <tt>222</tt>), then minimize the negative log marginal likelihood w.r.t. the hyperparameters, to obtain new values of <tt>2.55</tt> for the log lengthscale and <tt>3.96</tt> for the log magnitude. The negative log marginal likelihood decreases to about <tt>90</tt> at the minimum, see also Figure 3.8(a) page 65. The negative log marginal likelihood decreases to about <tt>90</tt> at the minimum, see also Figure 3.7(a) page 64. The marginal likelihood has thus increased by a factor of exp(222-90) or roughly 2e+57.</p> Finally, we can make test set predictions with the new hyperparameters: <pre> pp = binaryEPGP(newloghyper, 'covSEiso', x, y, xx); plot(pp,'g.') </pre> to obtain:</p><br><center><img src="figepp2.gif"></center><br> We note that the new predictions (in green) are much more extreme than the old ones (in blue). Evaluating the new test predictions: <pre> sum((pp>0.5)~=(yy>0)) mean((yy==1).*log2(pp)+(yy==-1).*log2(1-pp))+1 </pre> reveals that there are now 19 test set misclassifications (as opposed to 35) and the information about the test set labels has increased from 0.72 bits to 0.89 bits.</p> <br><br> Go back to the <a href="http://www.gaussianprocess.org/gpml">web page</a> for Gaussian Processes for Machine Learning. <hr> <!-- Created: Mon Nov 7 09:52:03 CET 2005 --> <!-- hhmts start --> Last modified: Thu Mar 23 15:23:00 CET 2006 <!-- hhmts end --> </body> </html>
iqbalu/3D_Pose_Estimation_CVPR2016
tools_intern/toolboxes/gpml-matlab/doc/classification.html
HTML
bsd-3-clause
34,439
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ namespace ZendTest\I18n\Filter; use Zend\I18n\Filter\Alpha as AlphaFilter; use Locale; /** * @group Zend_Filter */ class AlphaTest extends \PHPUnit_Framework_TestCase { /** * AlphaFilter object * * @var AlphaFilter */ protected $filter; /** * Is PCRE is compiled with UTF-8 and Unicode support * * @var mixed **/ protected static $unicodeEnabled; /** * Locale in browser. * * @var string */ protected $locale; /** * The Alphabet means english alphabet. * * @var bool */ protected static $meansEnglishAlphabet; /** * Creates a new AlnumFilter object for each test method * * @return void */ public function setUp() { if (!extension_loaded('intl')) { $this->markTestSkipped('ext/intl not enabled'); } $this->filter = new AlphaFilter(); $this->locale = Locale::getDefault(); $language = Locale::getPrimaryLanguage($this->locale); self::$meansEnglishAlphabet = in_array($language, array('ja')); self::$unicodeEnabled = (@preg_match('/\pL/u', 'a')) ? true : false; } /** * Ensures that the filter follows expected behavior * * @return void */ public function testBasic() { if (!self::$unicodeEnabled) { // POSIX named classes are not supported, use alternative a-zA-Z match $valuesExpected = array( 'abc123' => 'abc', 'abc 123' => 'abc', 'abcxyz' => 'abcxyz', '' => '' ); } elseif (self::$meansEnglishAlphabet) { //The Alphabet means english alphabet. /** * The first element contains multibyte alphabets. * But , AlphaFilter is expected to return only singlebyte alphabets. * The second contains multibyte or singlebyte space. * The third contains multibyte or singlebyte digits. * The forth contains various multibyte or singlebyte characters. * The last contains only singlebyte alphabets. */ $valuesExpected = array( 'aABbc' => 'aBc', 'z Y x' => 'zx', 'W1v3U4t' => 'vt', ',sй.rλ:qν_p' => 'srqp', 'onml' => 'onml' ); } else { //The Alphabet means each language's alphabet. $valuesExpected = array( 'abc123' => 'abc', 'abc 123' => 'abc', 'abcxyz' => 'abcxyz', 'četně' => 'četně', 'لعربية' => 'لعربية', 'grzegżółka' => 'grzegżółka', 'België' => 'België', '' => '' ); } foreach ($valuesExpected as $input => $expected) { $actual = $this->filter->filter($input); $this->assertEquals($expected, $actual); } } /** * Ensures that the filter follows expected behavior * * @return void */ public function testAllowWhiteSpace() { $this->filter->setAllowWhiteSpace(true); if (!self::$unicodeEnabled) { // POSIX named classes are not supported, use alternative a-zA-Z match $valuesExpected = array( 'abc123' => 'abc', 'abc 123' => 'abc ', 'abcxyz' => 'abcxyz', '' => '', "\n" => "\n", " \t " => " \t " ); } if (self::$meansEnglishAlphabet) { //The Alphabet means english alphabet. $valuesExpected = array( 'a B' => 'a B', 'zY x' => 'zx' ); } else { //The Alphabet means each language's alphabet. $valuesExpected = array( 'abc123' => 'abc', 'abc 123' => 'abc ', 'abcxyz' => 'abcxyz', 'četně' => 'četně', 'لعربية' => 'لعربية', 'grzegżółka' => 'grzegżółka', 'België' => 'België', '' => '', "\n" => "\n", " \t " => " \t " ); } foreach ($valuesExpected as $input => $expected) { $actual = $this->filter->filter($input); $this->assertEquals($expected, $actual); } } public function testFilterSupportArray() { $filter = new AlphaFilter(); $values = array( 'abc123' => 'abc', 'abc 123' => 'abc', 'abcxyz' => 'abcxyz', '' => '' ); $actual = $filter->filter(array_keys($values)); $this->assertEquals(array_values($values), $actual); } public function returnUnfilteredDataProvider() { return array( array(null), array(new \stdClass()) ); } /** * @dataProvider returnUnfilteredDataProvider * @return void */ public function testReturnUnfiltered($input) { $filter = new AlphaFilter(); $this->assertEquals($input, $filter->filter($input)); } }
exclie/Imagenologia
vendor/zendframework/zendframework/tests/ZendTest/I18n/Filter/AlphaTest.php
PHP
bsd-3-clause
5,950
// Copyright 2013 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. #ifndef REMOTING_HOST_IT2ME_IT2ME_HOST_H_ #define REMOTING_HOST_IT2ME_IT2ME_HOST_H_ #include <memory> #include "base/macros.h" #include "base/memory/ref_counted.h" #include "base/memory/weak_ptr.h" #include "base/single_thread_task_runner.h" #include "remoting/host/host_status_observer.h" #include "remoting/host/it2me/it2me_confirmation_dialog.h" #include "remoting/host/it2me/it2me_confirmation_dialog_proxy.h" #include "remoting/signaling/xmpp_signal_strategy.h" namespace base { class DictionaryValue; } namespace policy { class PolicyService; } // namespace policy namespace remoting { class ChromotingHost; class ChromotingHostContext; class DesktopEnvironmentFactory; class HostEventLogger; class HostNPScriptObject; class HostStatusLogger; class PolicyWatcher; class RegisterSupportHostRequest; class RsaKeyPair; // These state values are duplicated in host_session.js and the Android Java // It2MeObserver class. Remember to update all copies when making changes. enum It2MeHostState { kDisconnected, kStarting, kRequestedAccessCode, kReceivedAccessCode, kConnected, kError, kInvalidDomainError }; // Internal implementation of the plugin's It2Me host function. class It2MeHost : public base::RefCountedThreadSafe<It2MeHost>, public HostStatusObserver { public: class Observer { public: virtual void OnClientAuthenticated(const std::string& client_username) = 0; virtual void OnStoreAccessCode(const std::string& access_code, base::TimeDelta access_code_lifetime) = 0; virtual void OnNatPolicyChanged(bool nat_traversal_enabled) = 0; virtual void OnStateChanged(It2MeHostState state, const std::string& error_message) = 0; }; It2MeHost(std::unique_ptr<ChromotingHostContext> context, std::unique_ptr<PolicyWatcher> policy_watcher, std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory, base::WeakPtr<It2MeHost::Observer> observer, const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, const std::string& directory_bot_jid); // Methods called by the script object, from the plugin thread. // Creates It2Me host structures and starts the host. virtual void Connect(); // Disconnects and shuts down the host. virtual void Disconnect(); // TODO (weitaosu): Remove RequestNatPolicy from It2MeHost. // Request a NAT policy notification. virtual void RequestNatPolicy(); // remoting::HostStatusObserver implementation. void OnAccessDenied(const std::string& jid) override; void OnClientConnected(const std::string& jid) override; void OnClientDisconnected(const std::string& jid) override; void SetStateForTesting(It2MeHostState state, const std::string& error_message) { SetState(state, error_message); } protected: friend class base::RefCountedThreadSafe<It2MeHost>; ~It2MeHost() override; ChromotingHostContext* host_context() { return host_context_.get(); } scoped_refptr<base::SingleThreadTaskRunner> task_runner() { return task_runner_; } base::WeakPtr<It2MeHost::Observer> observer() { return observer_; } private: // Updates state of the host. Can be called only on the network thread. void SetState(It2MeHostState state, const std::string& error_message); // Returns true if the host is connected. bool IsConnected() const; // Presents a confirmation dialog to the user before starting the connection // process. void ShowConfirmationPrompt(); // Processes the result of the confirmation dialog. void OnConfirmationResult(It2MeConfirmationDialog::Result result); // Called by Connect() to check for policies and start connection process. void ReadPolicyAndConnect(); // Called by ReadPolicyAndConnect once policies have been read. void FinishConnect(); // Called when the support host registration completes. void OnReceivedSupportID(const std::string& support_id, const base::TimeDelta& lifetime, const std::string& error_message); // Called when initial policies are read, and when they change. void OnPolicyUpdate(std::unique_ptr<base::DictionaryValue> policies); // Called when malformed policies are detected. void OnPolicyError(); // Handlers for NAT traversal and domain policies. void UpdateNatPolicy(bool nat_traversal_enabled); void UpdateHostDomainPolicy(const std::string& host_domain); void UpdateClientDomainPolicy(const std::string& client_domain); void Shutdown(); // Caller supplied fields. std::unique_ptr<ChromotingHostContext> host_context_; scoped_refptr<base::SingleThreadTaskRunner> task_runner_; base::WeakPtr<It2MeHost::Observer> observer_; XmppSignalStrategy::XmppServerConfig xmpp_server_config_; std::string directory_bot_jid_; It2MeHostState state_; scoped_refptr<RsaKeyPair> host_key_pair_; std::unique_ptr<SignalStrategy> signal_strategy_; std::unique_ptr<RegisterSupportHostRequest> register_request_; std::unique_ptr<HostStatusLogger> host_status_logger_; std::unique_ptr<DesktopEnvironmentFactory> desktop_environment_factory_; std::unique_ptr<HostEventLogger> host_event_logger_; std::unique_ptr<ChromotingHost> host_; int failed_login_attempts_; std::unique_ptr<PolicyWatcher> policy_watcher_; std::unique_ptr<It2MeConfirmationDialogFactory> confirmation_dialog_factory_; std::unique_ptr<It2MeConfirmationDialogProxy> confirmation_dialog_proxy_; // Host the current nat traversal policy setting. bool nat_traversal_enabled_; // The client and host domain policy setting. std::string required_client_domain_; std::string required_host_domain_; // Indicates whether or not a policy has ever been read. This is to ensure // that on startup, we do not accidentally start a connection before we have // queried our policy restrictions. bool policy_received_; // On startup, it is possible to have Connect() called before the policy read // is completed. Rather than just failing, we thunk the connection call so // it can be executed after at least one successful policy read. This // variable contains the thunk if it is necessary. base::Closure pending_connect_; DISALLOW_COPY_AND_ASSIGN(It2MeHost); }; // Having a factory interface makes it possible for the test to provide a mock // implementation of the It2MeHost. class It2MeHostFactory { public: It2MeHostFactory(); virtual ~It2MeHostFactory(); // |policy_service| is used for creating the policy watcher for new // instances of It2MeHost on ChromeOS. The caller must ensure that // |policy_service| is valid throughout the lifetime of the It2MeHostFactory // and each created It2MeHost object. This is currently possible because // |policy_service| is a global singleton available from the browser process. virtual void set_policy_service(policy::PolicyService* policy_service); virtual scoped_refptr<It2MeHost> CreateIt2MeHost( std::unique_ptr<ChromotingHostContext> context, base::WeakPtr<It2MeHost::Observer> observer, const XmppSignalStrategy::XmppServerConfig& xmpp_server_config, const std::string& directory_bot_jid); private: policy::PolicyService* policy_service_; DISALLOW_COPY_AND_ASSIGN(It2MeHostFactory); }; } // namespace remoting #endif // REMOTING_HOST_IT2ME_IT2ME_HOST_H_
axinging/chromium-crosswalk
remoting/host/it2me/it2me_host.h
C
bsd-3-clause
7,632
// 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. #ifndef CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_TYPES_H_ #define CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_TYPES_H_ #include <map> #include <string> #include "base/basictypes.h" #include "base/strings/string16.h" #include "content/common/content_export.h" #include "content/common/service_worker/service_worker_types.h" // This file is to have common definitions that are to be shared by // browser and child process. namespace content { // Controls how requests are matched in the Cache API. struct CONTENT_EXPORT CacheStorageCacheQueryParams { CacheStorageCacheQueryParams(); bool ignore_search; bool ignore_method; bool ignore_vary; base::string16 cache_name; }; // The type of a single batch operation in the Cache API. enum CacheStorageCacheOperationType { CACHE_STORAGE_CACHE_OPERATION_TYPE_UNDEFINED, CACHE_STORAGE_CACHE_OPERATION_TYPE_PUT, CACHE_STORAGE_CACHE_OPERATION_TYPE_DELETE, CACHE_STORAGE_CACHE_OPERATION_TYPE_LAST = CACHE_STORAGE_CACHE_OPERATION_TYPE_DELETE }; // A single batch operation for the Cache API. struct CONTENT_EXPORT CacheStorageBatchOperation { CacheStorageBatchOperation(); CacheStorageCacheOperationType operation_type; ServiceWorkerFetchRequest request; ServiceWorkerResponse response; CacheStorageCacheQueryParams match_params; }; } // namespace content #endif // CONTENT_COMMON_CACHE_STORAGE_CACHE_STORAGE_TYPES_H_
mou4e/zirconium
content/common/cache_storage/cache_storage_types.h
C
bsd-3-clause
1,568
<html lang="en"> <head> <title>Multi-threaded FFTW - FFTW 3.3alpha1</title> <meta http-equiv="Content-Type" content="text/html"> <meta name="description" content="FFTW 3.3alpha1"> <meta name="generator" content="makeinfo 4.13"> <link title="Top" rel="start" href="index.html#Top"> <link rel="prev" href="FFTW-Reference.html#FFTW-Reference" title="FFTW Reference"> <link rel="next" href="Distributed_002dmemory-FFTW-with-MPI.html#Distributed_002dmemory-FFTW-with-MPI" title="Distributed-memory FFTW with MPI"> <link href="http://www.gnu.org/software/texinfo/" rel="generator-home" title="Texinfo Homepage"> <!-- This manual is for FFTW (version 3.3alpha1, 25 October 2008). Copyright (C) 2003 Matteo Frigo. Copyright (C) 2003 Massachusetts Institute of Technology. Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, except that this permission notice may be stated in a translation approved by the Free Software Foundation. --> <meta http-equiv="Content-Style-Type" content="text/css"> <style type="text/css"><!-- pre.display { font-family:inherit } pre.format { font-family:inherit } pre.smalldisplay { font-family:inherit; font-size:smaller } pre.smallformat { font-family:inherit; font-size:smaller } pre.smallexample { font-size:smaller } pre.smalllisp { font-size:smaller } span.sc { font-variant:small-caps } span.roman { font-family:serif; font-weight:normal; } span.sansserif { font-family:sans-serif; font-weight:normal; } --></style> </head> <body> <div class="node"> <a name="Multi-threaded-FFTW"></a> <a name="Multi_002dthreaded-FFTW"></a> <p> Next:&nbsp;<a rel="next" accesskey="n" href="Distributed_002dmemory-FFTW-with-MPI.html#Distributed_002dmemory-FFTW-with-MPI">Distributed-memory FFTW with MPI</a>, Previous:&nbsp;<a rel="previous" accesskey="p" href="FFTW-Reference.html#FFTW-Reference">FFTW Reference</a>, Up:&nbsp;<a rel="up" accesskey="u" href="index.html#Top">Top</a> <hr> </div> <h2 class="chapter">5 Multi-threaded FFTW</h2> <p><a name="index-parallel-transform-316"></a>In this chapter we document the parallel FFTW routines for shared-memory parallel hardware. These routines, which support parallel one- and multi-dimensional transforms of both real and complex data, are the easiest way to take advantage of multiple processors with FFTW. They work just like the corresponding uniprocessor transform routines, except that you have an extra initialization routine to call, and there is a routine to set the number of threads to employ. Any program that uses the uniprocessor FFTW can therefore be trivially modified to use the multi-threaded FFTW. <p>A shared-memory machine is one in which all CPUs can directly access the same main memory, and such machines are now common due to the ubiquity of multi-core CPUs. FFTW's multi-threading support allows you to utilize these additional CPUs transparently from a single program. However, this does not necessarily translate into performance gains&mdash;when multiple threads/CPUs are employed, there is an overhead required for synchronization that may outweigh the computatational parallelism. Therefore, you can only benefit from threads if your problem is sufficiently large. <a name="index-shared_002dmemory-317"></a><a name="index-threads-318"></a> <ul class="menu"> <li><a accesskey="1" href="Installation-and-Supported-Hardware_002fSoftware.html#Installation-and-Supported-Hardware_002fSoftware">Installation and Supported Hardware/Software</a> <li><a accesskey="2" href="Usage-of-Multi_002dthreaded-FFTW.html#Usage-of-Multi_002dthreaded-FFTW">Usage of Multi-threaded FFTW</a> <li><a accesskey="3" href="How-Many-Threads-to-Use_003f.html#How-Many-Threads-to-Use_003f">How Many Threads to Use?</a> <li><a accesskey="4" href="Thread-safety.html#Thread-safety">Thread safety</a> </ul> <!-- --> </body></html>
gemusehaken/sunflower-simulator
benchmarks/source/superh/fftw-3.3alpha1/doc/html/Multi_002dthreaded-FFTW.html
HTML
bsd-3-clause
4,404
# The olsr.org Optimized Link-State Routing daemon(olsrd) # Copyright (c) 2004, Andreas Tonnesen([email protected]) # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in # the documentation and/or other materials provided with the # distribution. # * Neither the name of olsr.org, olsrd nor the names of its # contributors may be used to endorse or promote products derived # from this software without specific prior written permission. # # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE # COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE # POSSIBILITY OF SUCH DAMAGE. # # Visit http://www.olsr.org for more information. # # If you find this software useful feel free to make a donation # to the project. For more information see the website or contact # the copyright holders. # OLSRD_PLUGIN = true PLUGIN_NAME = olsrd_jsoninfo PLUGIN_VER = 0.0 TOPDIR = ../.. include $(TOPDIR)/Makefile.inc default_target: $(PLUGIN_FULLNAME) $(PLUGIN_FULLNAME): $(OBJS) version-script.txt @echo "[LD] $@" @$(CC) $(LDFLAGS) -o $(PLUGIN_FULLNAME) $(OBJS) $(LIBS) install: $(PLUGIN_FULLNAME) $(STRIP) $(PLUGIN_FULLNAME) $(INSTALL_LIB) uninstall: $(UNINSTALL_LIB) clean: rm -f $(OBJS) $(SRCS:%.c=%.d) $(PLUGIN_FULLNAME)
zioproto/olsrd-gsoc2012
lib/jsoninfo/Makefile
Makefile
bsd-3-clause
2,289
<?php /* * This file is part of Respect/Validation. * * (c) Alexandre Gomes Gaigalas <[email protected]> * * For the full copyright and license information, please view the "LICENSE.md" * file that was distributed with this source code. */ namespace Respect\Validation\Exceptions\SubdivisionCode; use Respect\Validation\Exceptions\SubdivisionCodeException; /** * Exception class for Wallis and Futuna subdivision code. * * ISO 3166-1 alpha-2: WF */ class WfSubdivisionCodeException extends SubdivisionCodeException { public static $defaultTemplates = array( self::MODE_DEFAULT => array( self::STANDARD => '{{name}} must be a subdivision code of Wallis and Futuna', ), self::MODE_NEGATIVE => array( self::STANDARD => '{{name}} must not be a subdivision code of Wallis and Futuna', ), ); }
zinovyev/Validation
library/Exceptions/SubdivisionCode/WfSubdivisionCodeException.php
PHP
bsd-3-clause
872
<?php require_once '../../lib/config.inc.php'; require_once '../../lib/app.inc.php'; /****************************************** * Begin Form configuration ******************************************/ $list_def_file = "list/web_sites_stats.list.php"; /****************************************** * End Form configuration ******************************************/ //* Check permissions for module $app->auth->check_module_permissions('sites'); $app->load('listform_actions'); class list_action extends listform_actions { private $sum_this_month = 0; private $sum_this_year = 0; private $sum_last_month = 0; private $sum_last_year = 0; function prepareDataRow($rec) { global $app; $rec = $app->listform->decode($rec); //* Alternating datarow colors $this->DataRowColor = ($this->DataRowColor == '#FFFFFF') ? '#EEEEEE' : '#FFFFFF'; $rec['bgcolor'] = $this->DataRowColor; //* Set the statistics colums //** Traffic of the current month $tmp_year = date('Y'); $tmp_month = date('m'); $tmp_rec = $app->db->queryOneRecord("SELECT SUM(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'"); $rec['this_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); $this->sum_this_month += ($tmp_rec['t']/1024/1024); //** Traffic of the current year $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year'"); $rec['this_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); $this->sum_this_year += ($tmp_rec['t']/1024/1024); //** Traffic of the last month $tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year' AND MONTH(traffic_date) = '$tmp_month'"); $rec['last_month'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); $this->sum_last_month += ($tmp_rec['t']/1024/1024); //** Traffic of the last year $tmp_year = date('Y', mktime(0, 0, 0, date("m"), date("d"), date("Y")-1)); $tmp_rec = $app->db->queryOneRecord("SELECT sum(traffic_bytes) as t FROM web_traffic WHERE hostname = '".$app->db->quote($rec['domain'])."' AND YEAR(traffic_date) = '$tmp_year'"); $rec['last_year'] = number_format($tmp_rec['t']/1024/1024, 0, '.', ' '); $this->sum_last_year += ($tmp_rec['t']/1024/1024); //* The variable "id" contains always the index variable $rec['id'] = $rec[$this->idx_key]; return $rec; } function onShowEnd() { global $app; $app->tpl->setVar('sum_this_month', number_format($app->functions->intval($this->sum_this_month), 0, '.', ' ')); $app->tpl->setVar('sum_this_year', number_format($app->functions->intval($this->sum_this_year), 0, '.', ' ')); $app->tpl->setVar('sum_last_month', number_format($app->functions->intval($this->sum_last_month), 0, '.', ' ')); $app->tpl->setVar('sum_last_year', number_format($app->functions->intval($this->sum_last_year), 0, '.', ' ')); $app->tpl->setVar('sum_txt', $app->listform->lng('sum_txt')); $app->tpl_defaults(); $app->tpl->pparse(); } function getQueryString($no_limit = false) { global $app; $sql_where = ''; //* Generate the search sql if($app->listform->listDef['auth'] != 'no') { if($_SESSION['s']['user']['typ'] == "admin") { $sql_where = ''; } else { $sql_where = $app->tform->getAuthSQL('r', $app->listform->listDef['table']).' and'; //$sql_where = $app->tform->getAuthSQL('r').' and'; } } if($this->SQLExtWhere != '') { $sql_where .= ' '.$this->SQLExtWhere.' and'; } $sql_where = $app->listform->getSearchSQL($sql_where); if($app->listform->listDef['join_sql']) $sql_where .= ' AND '.$app->listform->listDef['join_sql']; $app->tpl->setVar($app->listform->searchValues); $order_by_sql = $this->SQLOrderBy; //* Generate SQL for paging $limit_sql = $app->listform->getPagingSQL($sql_where); $app->tpl->setVar('paging', $app->listform->pagingHTML); $extselect = ''; $join = ''; if(!empty($_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order'])){ $order = str_replace(' DESC', '', $_SESSION['search'][$_SESSION['s']['module']['name'].$app->listform->listDef["name"].$app->listform->listDef['table']]['order']); list($tmp_table, $order) = explode('.', $order); if($order == 'web_traffic_last_month'){ $tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $tmp_month = date('m', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $extselect .= ', SUM(wt.traffic_bytes) as calctraffic'; $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname '; $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'"; $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_month', 'calctraffic', $order_by_sql); $order_by_sql = "GROUP BY domain ".$order_by_sql; } elseif($order == 'web_traffic_this_month'){ $tmp_year = date('Y'); $tmp_month = date('m'); $extselect .= ', SUM(wt.traffic_bytes) as calctraffic'; $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname '; $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year' AND MONTH(wt.traffic_date) = '$tmp_month'"; $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_month', 'calctraffic', $order_by_sql); $order_by_sql = "GROUP BY domain ".$order_by_sql; } elseif($order == 'web_traffic_last_year'){ $tmp_year = date('Y', mktime(0, 0, 0, date("m")-1, date("d"), date("Y"))); $extselect .= ', SUM(wt.traffic_bytes) as calctraffic'; $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname '; $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'"; $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_last_year', 'calctraffic', $order_by_sql); $order_by_sql = "GROUP BY domain ".$order_by_sql; } elseif($order == 'web_traffic_this_year'){ $tmp_year = date('Y'); $extselect .= ', SUM(wt.traffic_bytes) as calctraffic'; $join .= ' INNER JOIN web_traffic as wt ON '.$app->listform->listDef['table'].'.domain = wt.hostname '; $sql_where .= " AND YEAR(wt.traffic_date) = '$tmp_year'"; $order_by_sql = str_replace($app->listform->listDef['table'].'.web_traffic_this_year', 'calctraffic', $order_by_sql); $order_by_sql = "GROUP BY domain ".$order_by_sql; } } if($this->SQLExtSelect != '') { if(substr($this->SQLExtSelect, 0, 1) != ',') $this->SQLExtSelect = ','.$this->SQLExtSelect; $extselect .= $this->SQLExtSelect; } $table_selects = array(); $table_selects[] = trim($app->listform->listDef['table']).'.*'; $app->listform->listDef['additional_tables'] = trim($app->listform->listDef['additional_tables']); if($app->listform->listDef['additional_tables'] != ''){ $additional_tables = explode(',', $app->listform->listDef['additional_tables']); foreach($additional_tables as $additional_table){ $table_selects[] = trim($additional_table).'.*'; } } $select = implode(', ', $table_selects); $sql = 'SELECT '.$select.$extselect.' FROM '.$app->listform->listDef['table'].($app->listform->listDef['additional_tables'] != ''? ','.$app->listform->listDef['additional_tables'] : '')."$join WHERE $sql_where $order_by_sql $limit_sql"; return $sql; } } $list = new list_action; $list->SQLExtWhere = "(web_domain.type = 'vhost' or web_domain.type = 'vhostsubdomain')"; $list->SQLOrderBy = 'ORDER BY web_domain.domain'; $list->onLoad(); ?>
idrassi/ispconfig_ovh_hosting
ispconfig3_install/interface/web/sites/web_sites_stats.php
PHP
bsd-3-clause
8,017
// Copyright 2014 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/sync/sessions2/sessions_util.h" #include "chrome/browser/sync/glue/synced_tab_delegate.h" #include "chrome/browser/sync/glue/synced_window_delegate.h" #include "chrome/common/url_constants.h" #include "content/public/browser/navigation_entry.h" #include "url/gurl.h" namespace browser_sync { namespace sessions_util { bool ShouldSyncTab(const SyncedTabDelegate& tab) { if (SyncedWindowDelegate::FindSyncedWindowDelegateWithId( tab.GetWindowId()) == NULL) { return false; } // Does the tab have a valid NavigationEntry? if (tab.ProfileIsManaged() && tab.GetBlockedNavigations()->size() > 0) return true; int entry_count = tab.GetEntryCount(); if (entry_count == 0) return false; // This deliberately ignores a new pending entry. int pending_index = tab.GetPendingEntryIndex(); bool found_valid_url = false; for (int i = 0; i < entry_count; ++i) { const content::NavigationEntry* entry = (i == pending_index) ? tab.GetPendingEntry() : tab.GetEntryAtIndex(i); if (!entry) return false; const GURL& virtual_url = entry->GetVirtualURL(); if (virtual_url.is_valid() && !virtual_url.SchemeIs(content::kChromeUIScheme) && !virtual_url.SchemeIs(chrome::kChromeNativeScheme) && !virtual_url.SchemeIsFile()) { found_valid_url = true; } } return found_valid_url; } bool ShouldSyncWindow(const SyncedWindowDelegate* window) { if (window->IsApp()) return false; return window->IsTypeTabbed() || window->IsTypePopup(); } } // namespace sessions_util } // namespace browser_sync
ChromiumWebApps/chromium
chrome/browser/sync/sessions2/sessions_util.cc
C++
bsd-3-clause
1,782
/* * The Biomechanical ToolKit * Copyright (c) 2009-2014, Arnaud Barré * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * Neither the name(s) of the copyright holders nor the names * of its contributors may be used to endorse or promote products * derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ #include "btkMEXObjectHandle.h" #include <btkAcquisition.h> void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { if(nrhs!=2) mexErrMsgTxt("Two input required."); btkMXCheckNoOuput(nlhs, plhs); // Only when there is no output for the function. if (!mxIsChar(prhs[1]) && ((mxGetClassID(prhs[1]) != mxDOUBLE_CLASS) || mxIsEmpty(prhs[1]) || mxIsComplex(prhs[1]) || (mxGetNumberOfElements(prhs[1]) != 1))) mexErrMsgTxt("Analog resolution must be set by a single double value representing an integer."); int ar = static_cast<int>(mxGetScalar(prhs[1])); btk::Acquisition::AnalogResolution res = btk::Acquisition::Bit12; switch (ar) { case 8: res = btk::Acquisition::Bit8; break; case 10: res = btk::Acquisition::Bit10; break; case 12: break; case 14: res = btk::Acquisition::Bit14; break; case 16: res = btk::Acquisition::Bit16; break; default: mexErrMsgTxt("Unvalid analog resolution."); } btk::Acquisition::Pointer acq = btk_MOH_get_object<btk::Acquisition>(prhs[0]); acq->SetAnalogResolution(res); };
letaureau/b-tk.core
Wrapping/Matlab/btkSetAnalogResolution.cpp
C++
bsd-3-clause
2,824
""" MAILER APP This module describes how to display the mailer model in Django's admin. Classes: OutboundEmailAdmin Functions: n/a Created on 22 Oct 2013 @author: michael """ from django.contrib import admin from tunobase.mailer import models class OutboundEmailAdmin(admin.ModelAdmin): """Determine how to display the mailer model in admin.""" list_display = ( 'user', 'to_addresses', 'bcc_addresses', 'sent_timestamp', 'subject', 'site' ) list_filter = ( 'user', 'to_addresses', 'bcc_addresses', 'sent_timestamp', 'subject', 'site' ) search_fields = ( 'user__email', 'to_addresses', 'bcc_addresses', 'subject', 'site' ) admin.site.register(models.OutboundEmail, OutboundEmailAdmin)
unomena/tunobase-core
tunobase/mailer/admin.py
Python
bsd-3-clause
790
;(function ($) { $("a#event-do-invite").live("click", function() { GB_show( '', $(this).get(0).href, 400, 600, function() { var $field = $("#Form_EditForm_Invitations"); $.ajax({ url: $field.attr("href"), success: function(data) { $field.replaceWith($(data)); Behaviour.apply("Form_EditForm_Invitations", true); } }); }); return false; }); })(jQuery);
silverstripe-australia/silverstripe-eventmanagement
javascript/EventInvitationField.js
JavaScript
bsd-3-clause
397
// Copyright 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/ui/search/instant_loader.h" #include "chrome/browser/content_settings/tab_specific_content_settings.h" #include "chrome/browser/extensions/api/web_navigation/web_navigation_api.h" #include "chrome/browser/favicon/favicon_tab_helper.h" #include "chrome/browser/history/history_tab_helper.h" #include "chrome/browser/safe_browsing/safe_browsing_tab_observer.h" #include "chrome/browser/search/search.h" #include "chrome/browser/tab_contents/tab_util.h" #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" #include "chrome/browser/ui/bookmarks/bookmark_tab_helper.h" #include "chrome/browser/ui/search/search_tab_helper.h" #include "chrome/browser/ui/tab_contents/core_tab_helper.h" #include "content/public/browser/navigation_entry.h" #include "content/public/browser/notification_source.h" #include "content/public/browser/notification_types.h" #include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents_view.h" #include "grit/generated_resources.h" #include "ui/base/l10n/l10n_util.h" namespace { // This HTTP header and value are set on loads that originate from Instant. const char kInstantHeader[] = "X-Purpose: Instant"; } // namespace InstantLoader::Delegate::~Delegate() { } InstantLoader::InstantLoader(Delegate* delegate) : delegate_(delegate), stale_page_timer_(false, false) {} InstantLoader::~InstantLoader() { } void InstantLoader::Init(const GURL& instant_url, Profile* profile, const content::WebContents* active_tab, const base::Closure& on_stale_callback) { content::WebContents::CreateParams create_params(profile); create_params.site_instance = content::SiteInstance::CreateForURL( profile, chrome::GetPrivilegedURLForInstant(instant_url, profile)); SetContents(scoped_ptr<content::WebContents>( content::WebContents::Create(create_params))); instant_url_ = instant_url; on_stale_callback_ = on_stale_callback; } void InstantLoader::Load() { DVLOG(1) << "LoadURL: " << instant_url_; contents_->GetController().LoadURL( instant_url_, content::Referrer(), content::PAGE_TRANSITION_GENERATED, kInstantHeader); // Explicitly set the new tab title and virtual URL. // // This ensures that the title is set even before we get a title from the // page, preventing a potential flicker of the URL, and also ensures that // (unless overridden by the page) the new tab title matches the browser UI // locale. content::NavigationEntry* entry = contents_->GetController().GetActiveEntry(); if (entry) entry->SetTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); contents_->WasHidden(); int staleness_timeout_ms = chrome::GetInstantLoaderStalenessTimeoutSec() * 1000; if (staleness_timeout_ms > 0) { stale_page_timer_.Start( FROM_HERE, base::TimeDelta::FromMilliseconds(staleness_timeout_ms), on_stale_callback_); } } void InstantLoader::SetContents(scoped_ptr<content::WebContents> new_contents) { contents_.reset(new_contents.release()); contents_->SetDelegate(this); // Set up various tab helpers. The rest will get attached when (if) the // contents is added to the tab strip. // Tab helpers to control popups. BlockedContentTabHelper::CreateForWebContents(contents()); BlockedContentTabHelper::FromWebContents(contents())-> SetAllContentsBlocked(true); TabSpecificContentSettings::CreateForWebContents(contents()); TabSpecificContentSettings::FromWebContents(contents())-> SetPopupsBlocked(true); // Bookmarks (Users can bookmark the Instant NTP. This ensures the bookmarked // state is correctly set when the contents are swapped into a tab.) BookmarkTabHelper::CreateForWebContents(contents()); // A tab helper to catch prerender content swapping shenanigans. CoreTabHelper::CreateForWebContents(contents()); CoreTabHelper::FromWebContents(contents())->set_delegate(this); // Tab helpers used when committing an overlay. SearchTabHelper::CreateForWebContents(contents()); HistoryTabHelper::CreateForWebContents(contents()); // Observers. extensions::WebNavigationTabObserver::CreateForWebContents(contents()); // Favicons, required by the Task Manager. FaviconTabHelper::CreateForWebContents(contents()); // And some flat-out paranoia. safe_browsing::SafeBrowsingTabObserver::CreateForWebContents(contents()); #if defined(OS_MACOSX) // If |contents_| doesn't yet have a RWHV, SetTakesFocusOnlyOnMouseDown() will // be called later, when NOTIFICATION_RENDER_VIEW_HOST_CHANGED is received. if (content::RenderWidgetHostView* rwhv = contents_->GetRenderWidgetHostView()) rwhv->SetTakesFocusOnlyOnMouseDown(true); registrar_.Add(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, content::Source<content::NavigationController>( &contents_->GetController())); #endif // When the WebContents finishes loading it should be checked to ensure that // it is in the instant process. registrar_.Add(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::Source<content::WebContents>(contents_.get())); } scoped_ptr<content::WebContents> InstantLoader::ReleaseContents() { stale_page_timer_.Stop(); contents_->SetDelegate(NULL); // Undo tab helper work done in SetContents(). BlockedContentTabHelper::FromWebContents(contents())-> SetAllContentsBlocked(false); TabSpecificContentSettings::FromWebContents(contents())-> SetPopupsBlocked(false); CoreTabHelper::FromWebContents(contents())->set_delegate(NULL); #if defined(OS_MACOSX) if (content::RenderWidgetHostView* rwhv = contents_->GetRenderWidgetHostView()) rwhv->SetTakesFocusOnlyOnMouseDown(false); registrar_.Remove(this, content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED, content::Source<content::NavigationController>( &contents_->GetController())); #endif registrar_.Remove(this, content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME, content::Source<content::WebContents>(contents_.get())); return contents_.Pass(); } void InstantLoader::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_LOAD_COMPLETED_MAIN_FRAME) { const content::WebContents* web_contents = content::Source<content::WebContents>(source).ptr(); DCHECK_EQ(contents_.get(), web_contents); delegate_->LoadCompletedMainFrame(); return; } #if defined(OS_MACOSX) if (type == content::NOTIFICATION_RENDER_VIEW_HOST_CHANGED) { if (content::RenderWidgetHostView* rwhv = contents_->GetRenderWidgetHostView()) rwhv->SetTakesFocusOnlyOnMouseDown(true); return; } #endif NOTREACHED(); } void InstantLoader::SwapTabContents(content::WebContents* old_contents, content::WebContents* new_contents) { DCHECK_EQ(old_contents, contents()); // We release here without deleting since the caller has the responsibility // for deleting the old WebContents. ignore_result(ReleaseContents().release()); SetContents(scoped_ptr<content::WebContents>(new_contents)); delegate_->OnSwappedContents(); } bool InstantLoader::ShouldSuppressDialogs() { // Messages shown during Instant cancel Instant, so we suppress them. return true; } bool InstantLoader::ShouldFocusPageAfterCrash() { return false; } void InstantLoader::LostCapture() { delegate_->OnMouseUp(); } void InstantLoader::WebContentsFocused(content::WebContents* /* contents */) { delegate_->OnFocus(); } void InstantLoader::CanDownload(content::RenderViewHost* /* render_view_host */, int /* request_id */, const std::string& /* request_method */, const base::Callback<void(bool)>& callback) { // Downloads are disabled. callback.Run(false); } void InstantLoader::HandleMouseDown() { delegate_->OnMouseDown(); } void InstantLoader::HandleMouseUp() { delegate_->OnMouseUp(); } void InstantLoader::HandlePointerActivate() { delegate_->OnMouseDown(); } void InstantLoader::HandleGestureEnd() { delegate_->OnMouseUp(); } void InstantLoader::DragEnded() { // If the user drags, we won't get a mouse up (at least on Linux). Commit // the Instant result when the drag ends, so that during the drag the page // won't move around. delegate_->OnMouseUp(); } bool InstantLoader::OnGoToEntryOffset(int /* offset */) { return false; } content::WebContents* InstantLoader::OpenURLFromTab( content::WebContents* source, const content::OpenURLParams& params) { return delegate_->OpenURLFromTab(source, params); }
espadrine/opera
chromium/src/chrome/browser/ui/search/instant_loader.cc
C++
bsd-3-clause
9,140
// 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/chromeos/policy/device_local_account_policy_service.h" #include <vector> #include "base/bind.h" #include "base/file_util.h" #include "base/files/file_enumerator.h" #include "base/files/file_path.h" #include "base/logging.h" #include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop_proxy.h" #include "base/path_service.h" #include "base/sequenced_task_runner.h" #include "base/strings/string_number_conversions.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/chromeos/policy/device_local_account.h" #include "chrome/browser/chromeos/policy/device_local_account_external_data_service.h" #include "chrome/browser/chromeos/policy/device_local_account_policy_store.h" #include "chrome/browser/chromeos/settings/device_settings_service.h" #include "chrome/common/chrome_content_client.h" #include "chromeos/chromeos_paths.h" #include "chromeos/dbus/session_manager_client.h" #include "chromeos/settings/cros_settings_names.h" #include "chromeos/settings/cros_settings_provider.h" #include "components/policy/core/common/cloud/cloud_policy_client.h" #include "components/policy/core/common/cloud/cloud_policy_constants.h" #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" #include "components/policy/core/common/cloud/device_management_service.h" #include "components/policy/core/common/cloud/system_policy_request_context.h" #include "net/url_request/url_request_context_getter.h" #include "policy/policy_constants.h" #include "policy/proto/device_management_backend.pb.h" #include "url/gurl.h" namespace em = enterprise_management; namespace policy { namespace { // Creates and initializes a cloud policy client. Returns NULL if the device // doesn't have credentials in device settings (i.e. is not // enterprise-enrolled). scoped_ptr<CloudPolicyClient> CreateClient( chromeos::DeviceSettingsService* device_settings_service, DeviceManagementService* device_management_service, scoped_refptr<net::URLRequestContextGetter> system_request_context) { const em::PolicyData* policy_data = device_settings_service->policy_data(); if (!policy_data || !policy_data->has_request_token() || !policy_data->has_device_id() || !device_management_service) { return scoped_ptr<CloudPolicyClient>(); } scoped_refptr<net::URLRequestContextGetter> request_context = new SystemPolicyRequestContext( system_request_context, GetUserAgent()); scoped_ptr<CloudPolicyClient> client( new CloudPolicyClient(std::string(), std::string(), kPolicyVerificationKeyHash, USER_AFFILIATION_MANAGED, NULL, device_management_service, request_context)); client->SetupRegistration(policy_data->request_token(), policy_data->device_id()); return client.Pass(); } // Get the subdirectory of the cache directory in which force-installed // extensions are cached for |account_id|. std::string GetCacheSubdirectoryForAccountID(const std::string& account_id) { return base::HexEncode(account_id.c_str(), account_id.size()); } // Cleans up the cache directory by removing subdirectories that are not found // in |subdirectories_to_keep|. Only caches whose cache directory is found in // |subdirectories_to_keep| may be running while the clean-up is in progress. void DeleteOrphanedExtensionCaches( const std::set<std::string>& subdirectories_to_keep) { base::FilePath cache_root_dir; CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, &cache_root_dir)); base::FileEnumerator enumerator(cache_root_dir, false, base::FileEnumerator::DIRECTORIES); for (base::FilePath path = enumerator.Next(); !path.empty(); path = enumerator.Next()) { const std::string subdirectory(path.BaseName().MaybeAsASCII()); if (subdirectories_to_keep.find(subdirectory) == subdirectories_to_keep.end()) { base::DeleteFile(path, true); } } } // Removes the subdirectory belonging to |account_id_to_delete| from the cache // directory. No cache belonging to |account_id_to_delete| may be running while // the removal is in progress. void DeleteObsoleteExtensionCache(const std::string& account_id_to_delete) { base::FilePath cache_root_dir; CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, &cache_root_dir)); const base::FilePath path = cache_root_dir .Append(GetCacheSubdirectoryForAccountID(account_id_to_delete)); if (base::DirectoryExists(path)) base::DeleteFile(path, true); } } // namespace DeviceLocalAccountPolicyBroker::DeviceLocalAccountPolicyBroker( const DeviceLocalAccount& account, scoped_ptr<DeviceLocalAccountPolicyStore> store, scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager, const scoped_refptr<base::SequencedTaskRunner>& task_runner) : account_id_(account.account_id), user_id_(account.user_id), store_(store.Pass()), external_data_manager_(external_data_manager), core_(PolicyNamespaceKey(dm_protocol::kChromePublicAccountPolicyType, store_->account_id()), store_.get(), task_runner) { base::FilePath cache_root_dir; CHECK(PathService::Get(chromeos::DIR_DEVICE_LOCAL_ACCOUNT_EXTENSIONS, &cache_root_dir)); extension_loader_ = new chromeos::DeviceLocalAccountExternalPolicyLoader( store_.get(), cache_root_dir.Append( GetCacheSubdirectoryForAccountID(account.account_id))); } DeviceLocalAccountPolicyBroker::~DeviceLocalAccountPolicyBroker() { external_data_manager_->SetPolicyStore(NULL); external_data_manager_->Disconnect(); } void DeviceLocalAccountPolicyBroker::Initialize() { store_->Load(); } void DeviceLocalAccountPolicyBroker::ConnectIfPossible( chromeos::DeviceSettingsService* device_settings_service, DeviceManagementService* device_management_service, scoped_refptr<net::URLRequestContextGetter> request_context) { if (core_.client()) return; scoped_ptr<CloudPolicyClient> client(CreateClient(device_settings_service, device_management_service, request_context)); if (!client) return; core_.Connect(client.Pass()); external_data_manager_->Connect(request_context); core_.StartRefreshScheduler(); UpdateRefreshDelay(); } void DeviceLocalAccountPolicyBroker::UpdateRefreshDelay() { if (core_.refresh_scheduler()) { const base::Value* policy_value = store_->policy_map().GetValue(key::kPolicyRefreshRate); int delay = 0; if (policy_value && policy_value->GetAsInteger(&delay)) core_.refresh_scheduler()->SetRefreshDelay(delay); } } std::string DeviceLocalAccountPolicyBroker::GetDisplayName() const { std::string display_name; const base::Value* display_name_value = store_->policy_map().GetValue(policy::key::kUserDisplayName); if (display_name_value) display_name_value->GetAsString(&display_name); return display_name; } DeviceLocalAccountPolicyService::DeviceLocalAccountPolicyService( chromeos::SessionManagerClient* session_manager_client, chromeos::DeviceSettingsService* device_settings_service, chromeos::CrosSettings* cros_settings, scoped_refptr<base::SequencedTaskRunner> store_background_task_runner, scoped_refptr<base::SequencedTaskRunner> extension_cache_task_runner, scoped_refptr<base::SequencedTaskRunner> external_data_service_backend_task_runner, scoped_refptr<base::SequencedTaskRunner> io_task_runner, scoped_refptr<net::URLRequestContextGetter> request_context) : session_manager_client_(session_manager_client), device_settings_service_(device_settings_service), cros_settings_(cros_settings), device_management_service_(NULL), waiting_for_cros_settings_(false), orphan_cache_deletion_state_(NOT_STARTED), store_background_task_runner_(store_background_task_runner), extension_cache_task_runner_(extension_cache_task_runner), request_context_(request_context), local_accounts_subscription_(cros_settings_->AddSettingsObserver( chromeos::kAccountsPrefDeviceLocalAccounts, base::Bind(&DeviceLocalAccountPolicyService:: UpdateAccountListIfNonePending, base::Unretained(this)))), weak_factory_(this) { external_data_service_.reset(new DeviceLocalAccountExternalDataService( this, external_data_service_backend_task_runner, io_task_runner)); UpdateAccountList(); } DeviceLocalAccountPolicyService::~DeviceLocalAccountPolicyService() { DCHECK(!request_context_); DCHECK(policy_brokers_.empty()); } void DeviceLocalAccountPolicyService::Shutdown() { device_management_service_ = NULL; request_context_ = NULL; DeleteBrokers(&policy_brokers_); } void DeviceLocalAccountPolicyService::Connect( DeviceManagementService* device_management_service) { DCHECK(!device_management_service_); device_management_service_ = device_management_service; // Connect the brokers. for (PolicyBrokerMap::iterator it(policy_brokers_.begin()); it != policy_brokers_.end(); ++it) { it->second->ConnectIfPossible(device_settings_service_, device_management_service_, request_context_); } } DeviceLocalAccountPolicyBroker* DeviceLocalAccountPolicyService::GetBrokerForUser( const std::string& user_id) { PolicyBrokerMap::iterator entry = policy_brokers_.find(user_id); if (entry == policy_brokers_.end()) return NULL; return entry->second; } bool DeviceLocalAccountPolicyService::IsPolicyAvailableForUser( const std::string& user_id) { DeviceLocalAccountPolicyBroker* broker = GetBrokerForUser(user_id); return broker && broker->core()->store()->is_managed(); } void DeviceLocalAccountPolicyService::AddObserver(Observer* observer) { observers_.AddObserver(observer); } void DeviceLocalAccountPolicyService::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } void DeviceLocalAccountPolicyService::OnStoreLoaded(CloudPolicyStore* store) { DeviceLocalAccountPolicyBroker* broker = GetBrokerForStore(store); DCHECK(broker); if (!broker) return; broker->UpdateRefreshDelay(); FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(broker->user_id())); } void DeviceLocalAccountPolicyService::OnStoreError(CloudPolicyStore* store) { DeviceLocalAccountPolicyBroker* broker = GetBrokerForStore(store); DCHECK(broker); if (!broker) return; FOR_EACH_OBSERVER(Observer, observers_, OnPolicyUpdated(broker->user_id())); } bool DeviceLocalAccountPolicyService::IsExtensionCacheDirectoryBusy( const std::string& account_id) { return busy_extension_cache_directories_.find(account_id) != busy_extension_cache_directories_.end(); } void DeviceLocalAccountPolicyService::StartExtensionCachesIfPossible() { for (PolicyBrokerMap::iterator it = policy_brokers_.begin(); it != policy_brokers_.end(); ++it) { if (!it->second->extension_loader()->IsCacheRunning() && !IsExtensionCacheDirectoryBusy(it->second->account_id())) { it->second->extension_loader()->StartCache(extension_cache_task_runner_); } } } bool DeviceLocalAccountPolicyService::StartExtensionCacheForAccountIfPresent( const std::string& account_id) { for (PolicyBrokerMap::iterator it = policy_brokers_.begin(); it != policy_brokers_.end(); ++it) { if (it->second->account_id() == account_id) { DCHECK(!it->second->extension_loader()->IsCacheRunning()); it->second->extension_loader()->StartCache(extension_cache_task_runner_); return true; } } return false; } void DeviceLocalAccountPolicyService::OnOrphanedExtensionCachesDeleted() { DCHECK_EQ(IN_PROGRESS, orphan_cache_deletion_state_); orphan_cache_deletion_state_ = DONE; StartExtensionCachesIfPossible(); } void DeviceLocalAccountPolicyService::OnObsoleteExtensionCacheShutdown( const std::string& account_id) { DCHECK_NE(NOT_STARTED, orphan_cache_deletion_state_); DCHECK(IsExtensionCacheDirectoryBusy(account_id)); // The account with |account_id| was deleted and the broker for it has shut // down completely. if (StartExtensionCacheForAccountIfPresent(account_id)) { // If another account with the same ID was created in the meantime, its // extension cache is started, reusing the cache directory. The directory no // longer needs to be marked as busy in this case. busy_extension_cache_directories_.erase(account_id); return; } // If no account with |account_id| exists anymore, the cache directory should // be removed. The directory must stay marked as busy while the removal is in // progress. extension_cache_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DeleteObsoleteExtensionCache, account_id), base::Bind(&DeviceLocalAccountPolicyService:: OnObsoleteExtensionCacheDeleted, weak_factory_.GetWeakPtr(), account_id)); } void DeviceLocalAccountPolicyService::OnObsoleteExtensionCacheDeleted( const std::string& account_id) { DCHECK_EQ(DONE, orphan_cache_deletion_state_); DCHECK(IsExtensionCacheDirectoryBusy(account_id)); // The cache directory for |account_id| has been deleted. The directory no // longer needs to be marked as busy. busy_extension_cache_directories_.erase(account_id); // If another account with the same ID was created in the meantime, start its // extension cache, creating a new cache directory. StartExtensionCacheForAccountIfPresent(account_id); } void DeviceLocalAccountPolicyService::UpdateAccountListIfNonePending() { // Avoid unnecessary calls to UpdateAccountList(): If an earlier call is still // pending (because the |cros_settings_| are not trusted yet), the updated // account list will be processed by that call when it eventually runs. if (!waiting_for_cros_settings_) UpdateAccountList(); } void DeviceLocalAccountPolicyService::UpdateAccountList() { chromeos::CrosSettingsProvider::TrustedStatus status = cros_settings_->PrepareTrustedValues( base::Bind(&DeviceLocalAccountPolicyService::UpdateAccountList, weak_factory_.GetWeakPtr())); switch (status) { case chromeos::CrosSettingsProvider::TRUSTED: waiting_for_cros_settings_ = false; break; case chromeos::CrosSettingsProvider::TEMPORARILY_UNTRUSTED: waiting_for_cros_settings_ = true; return; case chromeos::CrosSettingsProvider::PERMANENTLY_UNTRUSTED: waiting_for_cros_settings_ = false; return; } // Update |policy_brokers_|, keeping existing entries. PolicyBrokerMap old_policy_brokers; policy_brokers_.swap(old_policy_brokers); std::set<std::string> subdirectories_to_keep; const std::vector<DeviceLocalAccount> device_local_accounts = GetDeviceLocalAccounts(cros_settings_); for (std::vector<DeviceLocalAccount>::const_iterator it = device_local_accounts.begin(); it != device_local_accounts.end(); ++it) { PolicyBrokerMap::iterator broker_it = old_policy_brokers.find(it->user_id); scoped_ptr<DeviceLocalAccountPolicyBroker> broker; bool broker_initialized = false; if (broker_it != old_policy_brokers.end()) { // Reuse the existing broker if present. broker.reset(broker_it->second); old_policy_brokers.erase(broker_it); broker_initialized = true; } else { scoped_ptr<DeviceLocalAccountPolicyStore> store( new DeviceLocalAccountPolicyStore(it->account_id, session_manager_client_, device_settings_service_, store_background_task_runner_)); store->AddObserver(this); scoped_refptr<DeviceLocalAccountExternalDataManager> external_data_manager = external_data_service_->GetExternalDataManager(it->account_id, store.get()); broker.reset(new DeviceLocalAccountPolicyBroker( *it, store.Pass(), external_data_manager, base::MessageLoopProxy::current())); } // Fire up the cloud connection for fetching policy for the account from // the cloud if this is an enterprise-managed device. broker->ConnectIfPossible(device_settings_service_, device_management_service_, request_context_); policy_brokers_[it->user_id] = broker.release(); if (!broker_initialized) { // The broker must be initialized after it has been added to // |policy_brokers_|. policy_brokers_[it->user_id]->Initialize(); } if (orphan_cache_deletion_state_ == NOT_STARTED) { subdirectories_to_keep.insert( GetCacheSubdirectoryForAccountID(it->account_id)); } } std::set<std::string> obsolete_account_ids; for (PolicyBrokerMap::const_iterator it = old_policy_brokers.begin(); it != old_policy_brokers.end(); ++it) { obsolete_account_ids.insert(it->second->account_id()); } if (orphan_cache_deletion_state_ == NOT_STARTED) { DCHECK(old_policy_brokers.empty()); DCHECK(busy_extension_cache_directories_.empty()); // If this method is running for the first time, no extension caches have // been started yet. Take this opportunity to do a clean-up by removing // orphaned cache directories not found in |subdirectories_to_keep| from the // cache directory. orphan_cache_deletion_state_ = IN_PROGRESS; extension_cache_task_runner_->PostTaskAndReply( FROM_HERE, base::Bind(&DeleteOrphanedExtensionCaches, subdirectories_to_keep), base::Bind(&DeviceLocalAccountPolicyService:: OnOrphanedExtensionCachesDeleted, weak_factory_.GetWeakPtr())); // Start the extension caches for all brokers. These belong to accounts in // |account_ids| and are not affected by the clean-up. StartExtensionCachesIfPossible(); } else { // If this method has run before, obsolete brokers may exist. Shut down // their extension caches and delete the brokers. DeleteBrokers(&old_policy_brokers); if (orphan_cache_deletion_state_ == DONE) { // If the initial clean-up of orphaned cache directories has been // complete, start any extension caches that are not running yet but can // be started now because their cache directories are not busy. StartExtensionCachesIfPossible(); } } FOR_EACH_OBSERVER(Observer, observers_, OnDeviceLocalAccountsChanged()); } void DeviceLocalAccountPolicyService::DeleteBrokers(PolicyBrokerMap* map) { for (PolicyBrokerMap::iterator it = map->begin(); it != map->end(); ++it) { it->second->core()->store()->RemoveObserver(this); scoped_refptr<chromeos::DeviceLocalAccountExternalPolicyLoader> extension_loader = it->second->extension_loader(); if (extension_loader->IsCacheRunning()) { DCHECK(!IsExtensionCacheDirectoryBusy(it->second->account_id())); busy_extension_cache_directories_.insert(it->second->account_id()); extension_loader->StopCache(base::Bind( &DeviceLocalAccountPolicyService::OnObsoleteExtensionCacheShutdown, weak_factory_.GetWeakPtr(), it->second->account_id())); } delete it->second; } map->clear(); } DeviceLocalAccountPolicyBroker* DeviceLocalAccountPolicyService::GetBrokerForStore( CloudPolicyStore* store) { for (PolicyBrokerMap::iterator it(policy_brokers_.begin()); it != policy_brokers_.end(); ++it) { if (it->second->core()->store() == store) return it->second; } return NULL; } } // namespace policy
patrickm/chromium.src
chrome/browser/chromeos/policy/device_local_account_policy_service.cc
C++
bsd-3-clause
20,392
/**************************************************************************** ** ** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3.0 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU General Public License version 3.0 requirements will be ** met: http://www.gnu.org/copyleft/gpl.html. ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QCOCOAHELPERS_H #define QCOCOAHELPERS_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It provides helper functions // for the Cocoa lighthouse plugin. This header file may // change from version to version without notice, or even be removed. // // We mean it. // #include "qt_mac_p.h" #include <private/qguiapplication_p.h> #include <QtGui/qscreen.h> QT_BEGIN_NAMESPACE class QPixmap; class QString; // Conversion functions QStringList qt_mac_NSArrayToQStringList(void *nsarray); void *qt_mac_QStringListToNSMutableArrayVoid(const QStringList &list); inline NSMutableArray *qt_mac_QStringListToNSMutableArray(const QStringList &qstrlist) { return reinterpret_cast<NSMutableArray *>(qt_mac_QStringListToNSMutableArrayVoid(qstrlist)); } CGImageRef qt_mac_image_to_cgimage(const QImage &image); NSImage *qt_mac_cgimage_to_nsimage(CGImageRef iamge); NSImage *qt_mac_create_nsimage(const QPixmap &pm); NSImage *qt_mac_create_nsimage(const QIcon &icon); NSSize qt_mac_toNSSize(const QSize &qtSize); NSRect qt_mac_toNSRect(const QRect &rect); QRect qt_mac_toQRect(const NSRect &rect); QColor qt_mac_toQColor(const NSColor *color); // Creates a mutable shape, it's the caller's responsibility to release. HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion &region); OSStatus qt_mac_drawCGImage(CGContextRef inContext, const CGRect *inBounds, CGImageRef inImage); QChar qt_mac_qtKey2CocoaKey(Qt::Key key); Qt::Key qt_mac_cocoaKey2QtKey(QChar keyCode); NSDragOperation qt_mac_mapDropAction(Qt::DropAction action); NSDragOperation qt_mac_mapDropActions(Qt::DropActions actions); Qt::DropAction qt_mac_mapNSDragOperation(NSDragOperation nsActions); Qt::DropActions qt_mac_mapNSDragOperations(NSDragOperation nsActions); // Misc void qt_mac_transformProccessToForegroundApplication(); QString qt_mac_removeMnemonics(const QString &original); CGColorSpaceRef qt_mac_genericColorSpace(); CGColorSpaceRef qt_mac_displayColorSpace(const QWidget *widget); CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice); QString qt_mac_applicationName(); inline int qt_mac_flipYCoordinate(int y) { return QGuiApplication::primaryScreen()->geometry().height() - y; } inline qreal qt_mac_flipYCoordinate(qreal y) { return QGuiApplication::primaryScreen()->geometry().height() - y; } inline QPointF qt_mac_flipPoint(const NSPoint &p) { return QPointF(p.x, qt_mac_flipYCoordinate(p.y)); } inline NSPoint qt_mac_flipPoint(const QPoint &p) { return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); } inline NSPoint qt_mac_flipPoint(const QPointF &p) { return NSMakePoint(p.x(), qt_mac_flipYCoordinate(p.y())); } NSRect qt_mac_flipRect(const QRect &rect, QWindow *window); Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); bool qt_mac_execute_apple_script(const char *script, long script_len, AEDesc *ret); bool qt_mac_execute_apple_script(const char *script, AEDesc *ret); bool qt_mac_execute_apple_script(const QString &script, AEDesc *ret); // strip out '&' characters, and convert "&&" to a single '&', in menu // text - since menu text is sometimes decorated with these for Windows // accelerators. QString qt_mac_removeAmpersandEscapes(QString s); enum { QtCocoaEventSubTypeWakeup = SHRT_MAX, QtCocoaEventSubTypePostMessage = SHRT_MAX-1 }; class QCocoaPostMessageArgs { public: id target; SEL selector; int argCount; id arg1; id arg2; QCocoaPostMessageArgs(id target, SEL selector, int argCount=0, id arg1=0, id arg2=0) : target(target), selector(selector), argCount(argCount), arg1(arg1), arg2(arg2) { [target retain]; [arg1 retain]; [arg2 retain]; } ~QCocoaPostMessageArgs() { [arg2 release]; [arg1 release]; [target release]; } }; CGContextRef qt_mac_cg_context(QPaintDevice *pdev); CGImageRef qt_mac_toCGImage(const QImage &qImage, bool isMask, uchar **dataCopy); QImage qt_mac_toQImage(CGImageRef image); QT_END_NAMESPACE #endif //QCOCOAHELPERS_H
klim-iv/phantomjs-qt5
src/qt/qtbase/src/plugins/platforms/cocoa/qcocoahelpers.h
C
bsd-3-clause
6,025
package org.hisp.dhis.dxf2.events; /* * Copyright (c) 2004-2015, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import com.google.common.collect.Lists; import org.hisp.dhis.DhisSpringTest; import org.hisp.dhis.common.IdentifiableObjectManager; import org.hisp.dhis.dxf2.events.trackedentity.TrackedEntityInstance; import org.hisp.dhis.dxf2.events.trackedentity.TrackedEntityInstanceService; import org.hisp.dhis.dxf2.importsummary.ImportStatus; import org.hisp.dhis.dxf2.importsummary.ImportSummary; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.program.Program; import org.hisp.dhis.program.ProgramInstanceService; import org.hisp.dhis.trackedentity.TrackedEntity; import org.hisp.dhis.trackedentity.TrackedEntityService; import org.junit.Ignore; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import java.util.HashSet; import java.util.List; import static org.junit.Assert.*; /** * @author Morten Olav Hansen <[email protected]> */ public class TrackedEntityInstanceServiceTest extends DhisSpringTest { @Autowired private TrackedEntityService trackedEntityService; @Autowired private TrackedEntityInstanceService trackedEntityInstanceService; @Autowired private ProgramInstanceService programInstanceService; @Autowired private IdentifiableObjectManager manager; private org.hisp.dhis.trackedentity.TrackedEntityInstance maleA; private org.hisp.dhis.trackedentity.TrackedEntityInstance maleB; private org.hisp.dhis.trackedentity.TrackedEntityInstance femaleA; private org.hisp.dhis.trackedentity.TrackedEntityInstance femaleB; private OrganisationUnit organisationUnitA; private OrganisationUnit organisationUnitB; private Program programA; @Override protected void setUpTest() throws Exception { organisationUnitA = createOrganisationUnit( 'A' ); organisationUnitB = createOrganisationUnit( 'B' ); organisationUnitB.setParent( organisationUnitA ); TrackedEntity trackedEntity = createTrackedEntity( 'A' ); trackedEntityService.addTrackedEntity( trackedEntity ); maleA = createTrackedEntityInstance( 'A', organisationUnitA ); maleB = createTrackedEntityInstance( 'B', organisationUnitB ); femaleA = createTrackedEntityInstance( 'C', organisationUnitA ); femaleB = createTrackedEntityInstance( 'D', organisationUnitB ); maleA.setTrackedEntity( trackedEntity ); maleB.setTrackedEntity( trackedEntity ); femaleA.setTrackedEntity( trackedEntity ); femaleB.setTrackedEntity( trackedEntity ); programA = createProgram( 'A', new HashSet<>(), organisationUnitA ); manager.save( organisationUnitA ); manager.save( organisationUnitB ); manager.save( maleA ); manager.save( maleB ); manager.save( femaleA ); manager.save( femaleB ); manager.save( programA ); programInstanceService.enrollTrackedEntityInstance( maleA, programA, null, null, organisationUnitA ); programInstanceService.enrollTrackedEntityInstance( femaleA, programA, null, null, organisationUnitA ); } @Test public void getPersonByUid() { assertEquals( maleA.getUid(), trackedEntityInstanceService.getTrackedEntityInstance( maleA.getUid() ).getTrackedEntityInstance() ); assertEquals( femaleB.getUid(), trackedEntityInstanceService.getTrackedEntityInstance( femaleB.getUid() ).getTrackedEntityInstance() ); assertNotEquals( femaleA.getUid(), trackedEntityInstanceService.getTrackedEntityInstance( femaleB.getUid() ).getTrackedEntityInstance() ); assertNotEquals( maleA.getUid(), trackedEntityInstanceService.getTrackedEntityInstance( maleB.getUid() ).getTrackedEntityInstance() ); } @Test public void getPersonByPatient() { assertEquals( maleA.getUid(), trackedEntityInstanceService.getTrackedEntityInstance( maleA ).getTrackedEntityInstance() ); assertEquals( femaleB.getUid(), trackedEntityInstanceService.getTrackedEntityInstance( femaleB ).getTrackedEntityInstance() ); assertNotEquals( femaleA.getUid(), trackedEntityInstanceService.getTrackedEntityInstance( femaleB ).getTrackedEntityInstance() ); assertNotEquals( maleA.getUid(), trackedEntityInstanceService.getTrackedEntityInstance( maleB ).getTrackedEntityInstance() ); } @Test @Ignore public void testUpdatePerson() { TrackedEntityInstance trackedEntityInstance = trackedEntityInstanceService.getTrackedEntityInstance( maleA.getUid() ); // person.setName( "UPDATED_NAME" ); ImportSummary importSummary = trackedEntityInstanceService.updateTrackedEntityInstance( trackedEntityInstance ); assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() ); // assertEquals( "UPDATED_NAME", personService.getTrackedEntityInstance( maleA.getUid() ).getName() ); } @Test @Ignore public void testSavePerson() { TrackedEntityInstance trackedEntityInstance = new TrackedEntityInstance(); // person.setName( "NAME" ); trackedEntityInstance.setOrgUnit( organisationUnitA.getUid() ); ImportSummary importSummary = trackedEntityInstanceService.addTrackedEntityInstance( trackedEntityInstance ); assertEquals( ImportStatus.SUCCESS, importSummary.getStatus() ); // assertEquals( "NAME", personService.getTrackedEntityInstance( importSummary.getReference() ).getName() ); } @Test public void testDeletePerson() { trackedEntityInstanceService.deleteTrackedEntityInstance( maleA.getUid() ); assertNull( trackedEntityInstanceService.getTrackedEntityInstance( maleA.getUid() ) ); assertNotNull( trackedEntityInstanceService.getTrackedEntityInstance( maleB.getUid() ) ); } @Test public void testDeleteTrackedEntityInstances() { List<String> uids = Lists.newArrayList( maleA.getUid(), maleB.getUid() ); trackedEntityInstanceService.deleteTrackedEntityInstances( uids ); assertNull( trackedEntityInstanceService.getTrackedEntityInstance( maleA.getUid() ) ); assertNull( trackedEntityInstanceService.getTrackedEntityInstance( maleB.getUid() ) ); } }
steffeli/inf5750-tracker-capture
dhis-services/dhis-service-dxf2/src/test/java/org/hisp/dhis/dxf2/events/TrackedEntityInstanceServiceTest.java
Java
bsd-3-clause
7,800
awk '{ gsub(/[ \t]+/, " ");print }' | cut -d ' ' -f $1
buaasun/grappa
applications/join/scripts/getcolumn.sh
Shell
bsd-3-clause
55
// Copyright 2014 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/chrome_content_browser_client_extensions_part.h" #include <set> #include "base/command_line.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/browser_permissions_policy_delegate.h" #include "chrome/browser/extensions/extension_service.h" #include "chrome/browser/extensions/extension_web_ui.h" #include "chrome/browser/extensions/extension_webkit_preferences.h" #include "chrome/browser/media_galleries/fileapi/media_file_system_backend.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_io_data.h" #include "chrome/browser/profiles/profile_manager.h" #include "chrome/browser/renderer_host/chrome_extension_message_filter.h" #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/extensions/extension_process_policy.h" #include "components/guest_view/browser/guest_view_message_filter.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_url_handler.h" #include "content/public/browser/render_process_host.h" #include "content/public/browser/render_view_host.h" #include "content/public/browser/site_instance.h" #include "content/public/browser/web_contents.h" #include "content/public/common/content_switches.h" #include "extensions/browser/api/web_request/web_request_api.h" #include "extensions/browser/api/web_request/web_request_api_helpers.h" #include "extensions/browser/extension_host.h" #include "extensions/browser/extension_message_filter.h" #include "extensions/browser/extension_registry.h" #include "extensions/browser/extension_system.h" #include "extensions/browser/guest_view/extensions_guest_view_message_filter.h" #include "extensions/browser/guest_view/web_view/web_view_renderer_state.h" #include "extensions/browser/info_map.h" #include "extensions/browser/io_thread_extension_message_filter.h" #include "extensions/browser/view_type_utils.h" #include "extensions/common/constants.h" #include "extensions/common/manifest_constants.h" #include "extensions/common/manifest_handlers/app_isolation_info.h" #include "extensions/common/manifest_handlers/background_info.h" #include "extensions/common/manifest_handlers/web_accessible_resources_info.h" #include "extensions/common/switches.h" using content::BrowserContext; using content::BrowserThread; using content::BrowserURLHandler; using content::RenderViewHost; using content::SiteInstance; using content::WebContents; using content::WebPreferences; namespace extensions { namespace { // Used by the GetPrivilegeRequiredByUrl() and GetProcessPrivilege() functions // below. Extension, and isolated apps require different privileges to be // granted to their RenderProcessHosts. This classification allows us to make // sure URLs are served by hosts with the right set of privileges. enum RenderProcessHostPrivilege { PRIV_NORMAL, PRIV_HOSTED, PRIV_ISOLATED, PRIV_EXTENSION, }; RenderProcessHostPrivilege GetPrivilegeRequiredByUrl( const GURL& url, ExtensionRegistry* registry) { // Default to a normal renderer cause it is lower privileged. This should only // occur if the URL on a site instance is either malformed, or uninitialized. // If it is malformed, then there is no need for better privileges anyways. // If it is uninitialized, but eventually settles on being an a scheme other // than normal webrenderer, the navigation logic will correct us out of band // anyways. if (!url.is_valid()) return PRIV_NORMAL; if (!url.SchemeIs(kExtensionScheme)) return PRIV_NORMAL; const Extension* extension = registry->enabled_extensions().GetByID(url.host()); if (extension && AppIsolationInfo::HasIsolatedStorage(extension)) return PRIV_ISOLATED; if (extension && extension->is_hosted_app()) return PRIV_HOSTED; return PRIV_EXTENSION; } RenderProcessHostPrivilege GetProcessPrivilege( content::RenderProcessHost* process_host, ProcessMap* process_map, ExtensionRegistry* registry) { std::set<std::string> extension_ids = process_map->GetExtensionsInProcess(process_host->GetID()); if (extension_ids.empty()) return PRIV_NORMAL; for (const std::string& extension_id : extension_ids) { const Extension* extension = registry->enabled_extensions().GetByID(extension_id); if (extension && AppIsolationInfo::HasIsolatedStorage(extension)) return PRIV_ISOLATED; if (extension && extension->is_hosted_app()) return PRIV_HOSTED; } return PRIV_EXTENSION; } } // namespace ChromeContentBrowserClientExtensionsPart:: ChromeContentBrowserClientExtensionsPart() { permissions_policy_delegate_.reset(new BrowserPermissionsPolicyDelegate()); } ChromeContentBrowserClientExtensionsPart:: ~ChromeContentBrowserClientExtensionsPart() { } // static GURL ChromeContentBrowserClientExtensionsPart::GetEffectiveURL( Profile* profile, const GURL& url) { // If the input |url| is part of an installed app, the effective URL is an // extension URL with the ID of that extension as the host. This has the // effect of grouping apps together in a common SiteInstance. ExtensionRegistry* registry = ExtensionRegistry::Get(profile); if (!registry) return url; const Extension* extension = registry->enabled_extensions().GetHostedAppByURL(url); if (!extension) return url; // Bookmark apps do not use the hosted app process model, and should be // treated as normal URLs. if (extension->from_bookmark()) return url; // If the URL is part of an extension's web extent, convert it to an // extension URL. return extension->GetResourceURL(url.path()); } // static bool ChromeContentBrowserClientExtensionsPart::ShouldUseProcessPerSite( Profile* profile, const GURL& effective_url) { if (!effective_url.SchemeIs(kExtensionScheme)) return false; ExtensionRegistry* registry = ExtensionRegistry::Get(profile); if (!registry) return false; const Extension* extension = registry->enabled_extensions().GetByID(effective_url.host()); if (!extension) return false; // If the URL is part of a hosted app that does not have the background // permission, or that does not allow JavaScript access to the background // page, we want to give each instance its own process to improve // responsiveness. if (extension->GetType() == Manifest::TYPE_HOSTED_APP) { if (!extension->permissions_data()->HasAPIPermission( APIPermission::kBackground) || !BackgroundInfo::AllowJSAccess(extension)) { return false; } } // Hosted apps that have script access to their background page must use // process per site, since all instances can make synchronous calls to the // background window. Other extensions should use process per site as well. return true; } // static bool ChromeContentBrowserClientExtensionsPart::ShouldLockToOrigin( content::BrowserContext* browser_context, const GURL& effective_site_url) { // https://crbug.com/160576 workaround: Origin lock to the chrome-extension:// // scheme for a hosted app would kill processes on legitimate requests for the // app's cookies. if (effective_site_url.SchemeIs(extensions::kExtensionScheme)) { const Extension* extension = ExtensionRegistry::Get(browser_context) ->enabled_extensions() .GetExtensionOrAppByURL(effective_site_url); if (extension && extension->is_hosted_app()) return false; } return true; } // static bool ChromeContentBrowserClientExtensionsPart::CanCommitURL( content::RenderProcessHost* process_host, const GURL& url) { DCHECK_CURRENTLY_ON(BrowserThread::UI); // We need to let most extension URLs commit in any process, since this can // be allowed due to web_accessible_resources. Most hosted app URLs may also // load in any process (e.g., in an iframe). However, the Chrome Web Store // cannot be loaded in iframes and should never be requested outside its // process. ExtensionRegistry* registry = ExtensionRegistry::Get(process_host->GetBrowserContext()); if (!registry) return true; const Extension* new_extension = registry->enabled_extensions().GetExtensionOrAppByURL(url); if (new_extension && new_extension->is_hosted_app() && new_extension->id() == kWebStoreAppId && !ProcessMap::Get(process_host->GetBrowserContext()) ->Contains(new_extension->id(), process_host->GetID())) { return false; } return true; } bool ChromeContentBrowserClientExtensionsPart::IsIllegalOrigin( content::ResourceContext* resource_context, int child_process_id, const GURL& origin) { DCHECK_CURRENTLY_ON(BrowserThread::IO); // Consider non-extension URLs safe; they will be checked elsewhere. if (!origin.SchemeIs(kExtensionScheme)) return false; // If there is no extension installed for the URL, it couldn't have committed. // (If the extension was recently uninstalled, the tab would have closed.) ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); const Extension* extension = extension_info_map->extensions().GetExtensionOrAppByURL(origin); if (!extension) return true; // Check for platform app origins. These can only be committed by the app // itself, or by one if its guests if there are accessible_resources. const ProcessMap& process_map = extension_info_map->process_map(); if (extension->is_platform_app() && !process_map.Contains(extension->id(), child_process_id)) { // This is a platform app origin not in the app's own process. If there are // no accessible resources, this is illegal. if (!extension->GetManifestData(manifest_keys::kWebviewAccessibleResources)) return true; // If there are accessible resources, the origin is only legal if the given // process is a guest of the app. std::string owner_extension_id; int owner_process_id; WebViewRendererState::GetInstance()->GetOwnerInfo( child_process_id, &owner_process_id, &owner_extension_id); const Extension* owner_extension = extension_info_map->extensions().GetByID(owner_extension_id); return !owner_extension || owner_extension != extension; } // With only the origin and not the full URL, we don't have enough information // to validate hosted apps or web_accessible_resources in normal extensions. // Assume they're legal. return false; } // static bool ChromeContentBrowserClientExtensionsPart::IsSuitableHost( Profile* profile, content::RenderProcessHost* process_host, const GURL& site_url) { DCHECK(profile); ExtensionRegistry* registry = ExtensionRegistry::Get(profile); ProcessMap* process_map = ProcessMap::Get(profile); // These may be NULL during tests. In that case, just assume any site can // share any host. if (!registry || !process_map) return true; // Otherwise, just make sure the process privilege matches the privilege // required by the site. RenderProcessHostPrivilege privilege_required = GetPrivilegeRequiredByUrl(site_url, registry); return GetProcessPrivilege(process_host, process_map, registry) == privilege_required; } // static bool ChromeContentBrowserClientExtensionsPart::ShouldTryToUseExistingProcessHost( Profile* profile, const GURL& url) { // This function is trying to limit the amount of processes used by extensions // with background pages. It uses a globally set percentage of processes to // run such extensions and if the limit is exceeded, it returns true, to // indicate to the content module to group extensions together. ExtensionRegistry* registry = profile ? ExtensionRegistry::Get(profile) : NULL; if (!registry) return false; // We have to have a valid extension with background page to proceed. const Extension* extension = registry->enabled_extensions().GetExtensionOrAppByURL(url); if (!extension) return false; if (!BackgroundInfo::HasBackgroundPage(extension)) return false; std::set<int> process_ids; size_t max_process_count = content::RenderProcessHost::GetMaxRendererProcessCount(); // Go through all profiles to ensure we have total count of extension // processes containing background pages, otherwise one profile can // starve the other. std::vector<Profile*> profiles = g_browser_process->profile_manager()-> GetLoadedProfiles(); for (size_t i = 0; i < profiles.size(); ++i) { ProcessManager* epm = ProcessManager::Get(profiles[i]); for (ExtensionHost* host : epm->background_hosts()) process_ids.insert(host->render_process_host()->GetID()); } return (process_ids.size() > (max_process_count * chrome::kMaxShareOfExtensionProcesses)); } // static bool ChromeContentBrowserClientExtensionsPart:: ShouldSwapBrowsingInstancesForNavigation(SiteInstance* site_instance, const GURL& current_url, const GURL& new_url) { // If we don't have an ExtensionRegistry, then rely on the SiteInstance logic // in RenderFrameHostManager to decide when to swap. ExtensionRegistry* registry = ExtensionRegistry::Get(site_instance->GetBrowserContext()); if (!registry) return false; // We must use a new BrowsingInstance (forcing a process swap and disabling // scripting by existing tabs) if one of the URLs is an extension and the // other is not the exact same extension. // // We ignore hosted apps here so that other tabs in their BrowsingInstance can // use postMessage with them. (The exception is the Chrome Web Store, which // is a hosted app that requires its own BrowsingInstance.) Navigations // to/from a hosted app will still trigger a SiteInstance swap in // RenderFrameHostManager. const Extension* current_extension = registry->enabled_extensions().GetExtensionOrAppByURL(current_url); if (current_extension && current_extension->is_hosted_app() && current_extension->id() != kWebStoreAppId) current_extension = NULL; const Extension* new_extension = registry->enabled_extensions().GetExtensionOrAppByURL(new_url); if (new_extension && new_extension->is_hosted_app() && new_extension->id() != kWebStoreAppId) new_extension = NULL; // First do a process check. We should force a BrowsingInstance swap if the // current process doesn't know about new_extension, even if current_extension // is somehow the same as new_extension. ProcessMap* process_map = ProcessMap::Get(site_instance->GetBrowserContext()); if (new_extension && site_instance->HasProcess() && !process_map->Contains( new_extension->id(), site_instance->GetProcess()->GetID())) return true; // Otherwise, swap BrowsingInstances if current_extension and new_extension // differ. return current_extension != new_extension; } // static bool ChromeContentBrowserClientExtensionsPart::ShouldSwapProcessesForRedirect( content::ResourceContext* resource_context, const GURL& current_url, const GURL& new_url) { ProfileIOData* io_data = ProfileIOData::FromResourceContext(resource_context); return CrossesExtensionProcessBoundary( io_data->GetExtensionInfoMap()->extensions(), current_url, new_url, false); } // static bool ChromeContentBrowserClientExtensionsPart::AllowServiceWorker( const GURL& scope, const GURL& first_party_url, content::ResourceContext* context, int render_process_id, int render_frame_id) { // We only care about extension urls. // TODO(devlin): Also address chrome-extension-resource. if (!first_party_url.SchemeIs(kExtensionScheme)) return true; ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); InfoMap* extension_info_map = io_data->GetExtensionInfoMap(); const Extension* extension = extension_info_map->extensions().GetExtensionOrAppByURL(first_party_url); // Don't allow a service worker for an extension url with no extension (this // could happen in the case of, e.g., an unloaded extension). return extension != nullptr; } // static bool ChromeContentBrowserClientExtensionsPart::ShouldAllowOpenURL( content::SiteInstance* site_instance, const GURL& from_url, const GURL& to_url, bool* result) { DCHECK(result); // Do not allow pages from the web or other extensions navigate to // non-web-accessible extension resources. if (to_url.SchemeIs(kExtensionScheme) && (from_url.SchemeIsHTTPOrHTTPS() || from_url.SchemeIs(kExtensionScheme))) { Profile* profile = Profile::FromBrowserContext( site_instance->GetProcess()->GetBrowserContext()); ExtensionRegistry* registry = ExtensionRegistry::Get(profile); if (!registry) { *result = true; return true; } const Extension* extension = registry->enabled_extensions().GetExtensionOrAppByURL(to_url); if (!extension) { *result = true; return true; } const Extension* from_extension = registry->enabled_extensions().GetExtensionOrAppByURL( site_instance->GetSiteURL()); if (from_extension && from_extension->id() == extension->id()) { *result = true; return true; } if (!WebAccessibleResourcesInfo::IsResourceWebAccessible( extension, to_url.path())) { *result = false; return true; } } return false; } void ChromeContentBrowserClientExtensionsPart::RenderProcessWillLaunch( content::RenderProcessHost* host) { int id = host->GetID(); Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); host->AddFilter(new ChromeExtensionMessageFilter(id, profile)); host->AddFilter(new ExtensionMessageFilter(id, profile)); host->AddFilter(new IOThreadExtensionMessageFilter(id, profile)); host->AddFilter(new ExtensionsGuestViewMessageFilter(id, profile)); extension_web_request_api_helpers::SendExtensionWebRequestStatusToHost(host); } void ChromeContentBrowserClientExtensionsPart::SiteInstanceGotProcess( SiteInstance* site_instance) { BrowserContext* context = site_instance->GetProcess()->GetBrowserContext(); ExtensionRegistry* registry = ExtensionRegistry::Get(context); if (!registry) return; const Extension* extension = registry->enabled_extensions().GetExtensionOrAppByURL( site_instance->GetSiteURL()); if (!extension) return; ProcessMap::Get(context)->Insert(extension->id(), site_instance->GetProcess()->GetID(), site_instance->GetId()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&InfoMap::RegisterExtensionProcess, ExtensionSystem::Get(context)->info_map(), extension->id(), site_instance->GetProcess()->GetID(), site_instance->GetId())); } void ChromeContentBrowserClientExtensionsPart::SiteInstanceDeleting( SiteInstance* site_instance) { BrowserContext* context = site_instance->GetBrowserContext(); ExtensionRegistry* registry = ExtensionRegistry::Get(context); if (!registry) return; const Extension* extension = registry->enabled_extensions().GetExtensionOrAppByURL( site_instance->GetSiteURL()); if (!extension) return; ProcessMap::Get(context)->Remove(extension->id(), site_instance->GetProcess()->GetID(), site_instance->GetId()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&InfoMap::UnregisterExtensionProcess, ExtensionSystem::Get(context)->info_map(), extension->id(), site_instance->GetProcess()->GetID(), site_instance->GetId())); } void ChromeContentBrowserClientExtensionsPart::OverrideWebkitPrefs( RenderViewHost* rvh, WebPreferences* web_prefs) { const ExtensionRegistry* registry = ExtensionRegistry::Get(rvh->GetProcess()->GetBrowserContext()); if (!registry) return; // Note: it's not possible for kExtensionsScheme to change during the lifetime // of the process. // // Ensure that we are only granting extension preferences to URLs with // the correct scheme. Without this check, chrome-guest:// schemes used by // webview tags as well as hosts that happen to match the id of an // installed extension would get the wrong preferences. const GURL& site_url = rvh->GetSiteInstance()->GetSiteURL(); if (!site_url.SchemeIs(kExtensionScheme)) return; WebContents* web_contents = WebContents::FromRenderViewHost(rvh); ViewType view_type = GetViewType(web_contents); const Extension* extension = registry->enabled_extensions().GetByID(site_url.host()); extension_webkit_preferences::SetPreferences(extension, view_type, web_prefs); } void ChromeContentBrowserClientExtensionsPart::BrowserURLHandlerCreated( BrowserURLHandler* handler) { handler->AddHandlerPair(&ExtensionWebUI::HandleChromeURLOverride, BrowserURLHandler::null_handler()); handler->AddHandlerPair(BrowserURLHandler::null_handler(), &ExtensionWebUI::HandleChromeURLOverrideReverse); } void ChromeContentBrowserClientExtensionsPart:: GetAdditionalAllowedSchemesForFileSystem( std::vector<std::string>* additional_allowed_schemes) { additional_allowed_schemes->push_back(kExtensionScheme); } void ChromeContentBrowserClientExtensionsPart::GetURLRequestAutoMountHandlers( std::vector<storage::URLRequestAutoMountHandler>* handlers) { handlers->push_back( base::Bind(MediaFileSystemBackend::AttemptAutoMountForURLRequest)); } void ChromeContentBrowserClientExtensionsPart::GetAdditionalFileSystemBackends( content::BrowserContext* browser_context, const base::FilePath& storage_partition_path, ScopedVector<storage::FileSystemBackend>* additional_backends) { base::SequencedWorkerPool* pool = content::BrowserThread::GetBlockingPool(); additional_backends->push_back(new MediaFileSystemBackend( storage_partition_path, pool->GetSequencedTaskRunner( pool->GetNamedSequenceToken( MediaFileSystemBackend::kMediaTaskRunnerName)).get())); additional_backends->push_back(new sync_file_system::SyncFileSystemBackend( Profile::FromBrowserContext(browser_context))); } void ChromeContentBrowserClientExtensionsPart:: AppendExtraRendererCommandLineSwitches(base::CommandLine* command_line, content::RenderProcessHost* process, Profile* profile) { if (!process) return; DCHECK(profile); if (ProcessMap::Get(profile)->Contains(process->GetID())) { command_line->AppendSwitch(switches::kExtensionProcess); #if defined(ENABLE_WEBRTC) command_line->AppendSwitch(::switches::kEnableWebRtcHWH264Encoding); #endif if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableMojoSerialService)) { command_line->AppendSwitch(switches::kEnableMojoSerialService); } } } } // namespace extensions
Chilledheart/chromium
chrome/browser/extensions/chrome_content_browser_client_extensions_part.cc
C++
bsd-3-clause
23,525
/*========================================================================= medInria Copyright (c) INRIA 2013 - 2014. All rights reserved. See LICENSE.txt for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. =========================================================================*/ #include <medToolBoxTab.h> class medToolBoxTabPrivate { public: }; medToolBoxTab::medToolBoxTab(QWidget *parent) : QTabWidget(parent), d(new medToolBoxTabPrivate) { this->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed); } medToolBoxTab::~medToolBoxTab(void) { delete d; d = NULL; }
NicolasSchnitzler/medInria-public
src/medCore/gui/toolboxes/medToolBoxTab.cpp
C++
bsd-3-clause
711
<html> <head> <script src="../../http/tests/inspector/inspector-test.js"></script> <script src="../../http/tests/inspector/console-test.js"></script> <script src="../../http/tests/inspector/network-test.js"></script> <script src="../../http/tests/inspector/sources-test.js"></script> <script src="../../http/tests/inspector/resources-test.js"></script> <script src="../../http/tests/inspector/extensions-test.js"></script> <script type="text/javascript"> function logMessage() { console.log("hello"); } function initialize_extensionsPanelTest() { InspectorTest.getPanelSize = function() { var boundingRect = WebInspector.inspectorView._tabbedPane._contentElement.getBoundingClientRect(); return { width: boundingRect.width, height: boundingRect.height }; } InspectorTest.dumpStatusBarButtons = function() { var panel = WebInspector.inspectorView.currentPanel(); var items = panel._panelToolbar._contentElement.children; InspectorTest.addResult("Status bar buttons state:"); for (var i = 0; i < items.length; ++i) { var item = items[i]; if (item instanceof HTMLContentElement) continue; if (!(item instanceof HTMLButtonElement)) { InspectorTest.addResult("status bar item " + i + " is not a button: " + item); continue; } // Strip url(...) and prefix of the URL within, leave just last 3 components. var url = item.style.backgroundImage.replace(/^url\(.*(([/][^/]*){3}[^/)]*)\)$/, "...$1"); InspectorTest.addResult("status bar item " + i + ", icon: \"" + url + ", tooltip: '" + item[WebInspector.Tooltip._symbol].content + "', disabled: " + item.disabled); } } InspectorTest.clickButton = function(index) { var panel = WebInspector.inspectorView.currentPanel(); var items = panel._panelToolbar._contentElement.children; for (var i = 0, buttonIndex = 0; i < items.length; ++i) { if (items[i] instanceof HTMLButtonElement) { if (buttonIndex === index) { items[i].click(); return; } buttonIndex++; } } InspectorTest.addResult("No button with index " + index); items[index].click(); } InspectorTest.logMessageAndClickOnURL = function() { InspectorTest.disableConsoleViewport(); InspectorTest.evaluateInPage("logMessage()"); var wrappedConsoleMessageAdded = InspectorTest.safeWrap(consoleMessageAdded); WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, wrappedConsoleMessageAdded); function consoleMessageAdded() { WebInspector.multitargetConsoleModel.removeEventListener(WebInspector.ConsoleModel.Events.MessageAdded, wrappedConsoleMessageAdded); WebInspector.ConsoleView.instance()._viewportThrottler.flush(); InspectorTest.deprecatedRunAfterPendingDispatches(clickOnMessage) } function clickOnMessage() { var xpathResult = document.evaluate("//a[starts-with(., 'extensions-panel.html')]", WebInspector.ConsoleView.instance()._viewport.element, null, XPathResult.ANY_UNORDERED_NODE_TYPE, null); var click = document.createEvent("MouseEvent"); click.initMouseEvent("click", true, true); xpathResult.singleNodeValue.dispatchEvent(click); } } InspectorTest.installShowResourceLocationHooks = function() { function showURL(panelName, url, lineNumber) { var url = url.replace(/^.*(([/][^/]*){3}[^/)]*)$/, "...$1"); InspectorTest.addResult("Showing resource " + url + " in panel " + panelName + " (" + WebInspector.inspectorView.currentPanel().name + "), line: " + lineNumber); } InspectorTest.recordNetwork(); InspectorTest.addSniffer(WebInspector.panels.sources, "showUILocation", showUILocationHook, true); InspectorTest.addSniffer(WebInspector.panels.resources, "showResource", showResourceHook, true); InspectorTest.addSniffer(WebInspector.panels.network, "revealAndHighlightRequest", showRequestHook, true); function showUILocationHook(uiLocation) { var networkURL = WebInspector.networkMapping.networkURL(uiLocation.uiSourceCode); showURL("sources", networkURL, uiLocation.lineNumber); } function showResourceHook(resource, lineNumber) { showURL("resources", resource.url, lineNumber); } function showRequestHook(request) { showURL("network", request.url); } } InspectorTest.switchToLastPanel = function() { var lastPanelName = WebInspector.inspectorView._tabbedPane._tabs.peekLast().id; return WebInspector.inspectorView.showPanel(lastPanelName); } } function extension_testCreatePanel(nextTest) { var expectOnShown = false; function onPanelShown(panel, window) { if (!expectOnShown) { output("FAIL: unexpected onShown event"); nextTest(); return; } output("Panel shown"); panel.onShown.removeListener(onPanelShown); evaluateOnFrontend("reply(InspectorTest.getPanelSize())", function(result) { if (result.width !== window.innerWidth) output("panel width mismatch, outer: " + result.width + ", inner:" + window.innerWidth); else if (result.height !== window.innerHeight) output("panel height mismatch, outer: " + result.height + ", inner:" + window.innerHeight); else output("Extension panel size correct"); nextTest(); }); } function onPanelCreated(panel) { function onPanelShown(window) { if (!expectOnShown) { output("FAIL: unexpected onShown event"); nextTest(); return; } output("Panel shown"); panel.onShown.removeListener(onPanelShown); panel.onHidden.addListener(onPanelHidden); evaluateOnFrontend("reply(InspectorTest.getPanelSize())", function(result) { if (result.width !== window.innerWidth) output("panel width mismatch, outer: " + result.width + ", inner:" + window.innerWidth); else if (result.height !== window.innerHeight) output("panel height mismatch, outer: " + result.height + ", inner:" + window.innerHeight); else output("Extension panel size correct"); extension_showPanel("console"); }); } function onPanelHidden() { panel.onHidden.removeListener(onPanelHidden); output("Panel hidden"); nextTest(); } output("Panel created"); dumpObject(panel); panel.onShown.addListener(onPanelShown); // This is not authorized and therefore should not produce any output panel.show(); extension_showPanel("console"); function handleOpenResource(resource, lineNumber) { // This will force extension iframe to be really loaded. panel.show(); } webInspector.panels.setOpenResourceHandler(handleOpenResource); evaluateOnFrontend("WebInspector.openAnchorLocationRegistry._activeHandler = 'test extension'"); evaluateOnFrontend("InspectorTest.logMessageAndClickOnURL();"); expectOnShown = true; } var basePath = location.pathname.replace(/\/[^/]*$/, "/"); webInspector.panels.create("Test Panel", basePath + "extension-panel.png", basePath + "extension-panel.html", onPanelCreated); } function extension_testSearch(nextTest) { var callbackCount = 0; function onPanelCreated(panel) { var callback = function(action, queryString) { output("Panel searched:"); dumpObject(Array.prototype.slice.call(arguments)); callbackCount++; if (callbackCount === 2) { nextTest(); panel.onSearch.removeListener(callback); } }; panel.onSearch.addListener(callback); extension_showPanel("extension"); function performSearch(query) { var panel = WebInspector.inspectorView.currentPanel(); panel.searchableView().showSearchField(); panel.searchableView()._searchInputElement.value = query; panel.searchableView()._performSearch(true, true); panel.searchableView().cancelSearch(); } evaluateOnFrontend(performSearch.toString() + " performSearch(\"hello\");"); } var basePath = location.pathname.replace(/\/[^/]*$/, "/"); webInspector.panels.create("Test Panel", basePath + "extension-panel.png", basePath + "non-existent.html", onPanelCreated); } function extension_testStatusBarButtons(nextTest) { var basePath = location.pathname.replace(/\/[^/]*$/, "/"); function onPanelCreated(panel) { var button1 = panel.createStatusBarButton(basePath + "button1.png", "Button One tooltip"); var button2 = panel.createStatusBarButton(basePath + "button2.png", "Button Two tooltip", true); output("Created a status bar button, dump follows:"); dumpObject(button1); function updateButtons() { button1.update(basePath + "button1-updated.png"); button2.update(null, "Button Two updated tooltip", false); output("Updated status bar buttons"); evaluateOnFrontend("InspectorTest.dumpStatusBarButtons(); InspectorTest.clickButton(1);"); } button1.onClicked.addListener(function() { output("button1 clicked"); evaluateOnFrontend("InspectorTest.dumpStatusBarButtons(); reply();", updateButtons); }); button2.onClicked.addListener(function() { output("button2 clicked"); nextTest(); }); // First we click on button2 (that is [1] in array). But it is disabled, so this should be a noop. Then we click on button1. // button1 click updates buttons. and clicks button2. evaluateOnFrontend("InspectorTest.showPanel('extension').then(function() { InspectorTest.clickButton(1); InspectorTest.clickButton(0); })"); } webInspector.panels.create("Buttons Panel", basePath + "extension-panel.png", basePath + "non-existent.html", onPanelCreated); } function extension_testOpenResource(nextTest) { var urls; var urlIndex = 0; evaluateOnFrontend("InspectorTest.installShowResourceLocationHooks(); reply();", function() { webInspector.inspectedWindow.eval("loadResources(); location.href", function(inspectedPageURL) { var basePath = inspectedPageURL.replace(/\/[^/]*$/, "/"); urls = [inspectedPageURL, basePath + "resources/abe.png", basePath + "resources/missing.txt", "not-found.html", "javascript:console.error('oh no!')"]; showNextURL(); }); }); function showNextURL() { if (urlIndex >= urls.length) { nextTest(); return; } var url = urls[urlIndex++]; output("Showing " + trimURL(url)); webInspector.panels.openResource(url, 1000 + urlIndex, showNextURL); } } function extension_testGlobalShortcuts(nextTest) { var platform; var testPanel; evaluateOnFrontend("reply(WebInspector.platform())", function(result) { platform = result; var basePath = location.pathname.replace(/\/[^/]*$/, "/"); webInspector.panels.create("Shortcuts Test Panel", basePath + "extension-panel.png", basePath + "extension-panel.html", onPanelCreated); }); function dispatchKeydownEvent(attributes) { var event = new KeyboardEvent("keydown", attributes); document.dispatchEvent(event); } function onPanelCreated(panel) { testPanel = panel; testPanel.onShown.addListener(onPanelShown); testPanel.onHidden.addListener(onPanelHidden); evaluateOnFrontend("InspectorTest.switchToLastPanel();"); } var panelWindow; function onPanelShown(win) { panelWindow = win; testPanel.onShown.removeListener(onPanelShown); output("Panel shown, now toggling console..."); panelWindow.addEventListener("resize", onPanelResized); dispatchKeydownEvent({ keyIdentifier: "U+001B" }); } function onPanelResized() { panelWindow.removeEventListener("resize", onPanelResized); output("Panel resized, switching away..."); var isMac = platform === "mac"; dispatchKeydownEvent({ ctrlKey: !isMac, metaKey: isMac, keyIdentifier: "U+005D" }); } function onPanelHidden() { output("Panel hidden, test passed."); testPanel.onShown.removeListener(onPanelHidden); evaluateOnFrontend("reply(WebInspector.inspectorView.closeDrawer())", nextTest); } } function loadResources() { var xhr = new XMLHttpRequest(); xhr.open("GET", "resources/missing.txt", false); xhr.send(); var img = document.createElement("img"); img.src = "resources/abe.png"; document.body.appendChild(img); } </script> </head> <body onload="runTest()"> <p>Tests WebInspector extension API</p> </body> </html>
axinging/chromium-crosswalk
third_party/WebKit/LayoutTests/inspector/extensions/extensions-panel.html
HTML
bsd-3-clause
13,678
@import url(http://fonts.googleapis.com/css?family=Megrim); @import url(http://fonts.googleapis.com/css?family=Open+Sans:400,300); body { background:#f3f3f3; font-family:'open sans', sans-serif; font-size:16px; } a { color:#e74c3c; } a:hover { color:#f74c3c; text-decoration: none; border-bottom: 1px dashed #e74c3c; } h2 { color:#e74c3c; font-weight:300; } .page-container { max-width:900px; margin:auto; } #main { padding-top:50px; } .wrapper { margin-top:20px; } .universal-header { width:100%; height: 40px; background:#333; position:fixed; top:0; z-index:1000; } #header-logo { font-family:'Megrim',cursive; padding:5px 5px; display:inline-block; background:#e74c3c; height: 40px; font-size:24px; line-height: 45px; color:#fff; text-shadow:1px 1px rgba(0,0,0,0.5); } #header-logo:hover { text-decoration:none; } .right-menu { float:right; line-height:40px; } .rm-item:hover { background: #e74c3c; } .rm-item { display:inline-block; width:50px; height:40px; } .rm-item img { padding-left:10px; } .secondary-menu{ position:absolute; margin-top:100px; } .sm-item{ padding-bottom:10px; width:100px; text-align: center; } .sm-item:hover { cursor: pointer; } .sm-menu-text{ color:#e3e3e3; margin-top:10px; font-size:14px; } .sm-item:hover > .sm-menu-text{ color:#e74c3c; } .ogv-status{ max-width: 400px; margin:auto; background:rgba(0,0,0,0.3); color:#fff; text-shadow:1px 1px rgba(0,0,0,0.5); text-align:center; border-radius:5px; line-height:30px; } .notifications { max-width:700px; position:relative; margin:auto; margin-top:60px; z-index:1100; word-wrap:break-word; } .primary-container { max-width:280px; margin:auto; margin-top:10%; } .primary-form input, .primary-form button, .secondary-form input, .secondary-form button, textarea { display:block; width:100%; min-height: 40px; line-height:40px; margin-top:20px; text-align: center; border:0px; border-radius: 3px; padding:0px 0px; font-family: 'open sans',sans-serif; } textarea { line-height:1.5; min-height: 100px; } .secondary-form { max-width: 400px; margin:30px 30px; margin:auto; display:block; } .help-text { font-size: 14px; font-style: italic; color: #ccc; } .primary-btn { background:#e74c3c; font-size: 20px; padding:0px 0px; color: #fff; width:250px; text-shadow: 0px 0px; } .primary-btn:hover { color:#fff; background:#e75c4c; } .secondary-btn { background:#e74c3c; font-size:16px; color:#fff; height:32px; line-height:32px; text-shadow:none; padding-top:0px; box-shadow:none; } .secondary-btn:hover{ background:#e74c3c; color:#fff; } .primary-branding { font-size: 24px; font-family: 'megrim',cursive; font-weight:normal; text-align:center; } input:focus { box-shadow: none; } .meta-links { font-size:14px; margin-top:20px; display:block; } .modelsList { margin-top: 20px; } .model-file { width: 280px; height: 250px; float:left; margin-left:10px; } .model-file .model-preview[style] { background-size: cover; } .model-meta { color:#333; } .meta-desc { margin: 0px 10px 0px 10px; } .model-meta-name { float:left; width:100px; color:#fff; overflow:hidden; } .meta-icon { display:inline-block; width:40px; height: 40px; vertical-align:bottom; } .meta-love-icon{ background:url('/icons/love.png') no-repeat; } .meta-comment-icon{ background:url('/icons/Chat.png') no-repeat; } .model-meta-love { float:right; text-align:right; width:100px; } .model-meta-love:hover { color:#e74c3c; } .spinner { margin: 100px auto; width: 32px; height: 32px; position: relative; } .cube1, .cube2 { background-color: #333; width: 40px; height: 40px; position: absolute; top: 0; left: 0; -webkit-animation: cubemove 1.8s infinite ease-in-out; animation: cubemove 1.8s infinite ease-in-out; } .cube2 { -webkit-animation-delay: -0.9s; animation-delay: -0.9s; } @-webkit-keyframes cubemove { 25% { -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5) } 50% { -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg) } 75% { -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5) } 100% { -webkit-transform: rotate(-360deg) } } @keyframes cubemove { 25% { transform: translateX(42px) rotate(-90deg) scale(0.5); -webkit-transform: translateX(42px) rotate(-90deg) scale(0.5); } 50% { transform: translateX(42px) translateY(42px) rotate(-179deg); -webkit-transform: translateX(42px) translateY(42px) rotate(-179deg); } 50.1% { transform: translateX(42px) translateY(42px) rotate(-180deg); -webkit-transform: translateX(42px) translateY(42px) rotate(-180deg); } 75% { transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); -webkit-transform: translateX(0px) translateY(42px) rotate(-270deg) scale(0.5); } 100% { transform: rotate(-360deg); -webkit-transform: rotate(-360deg); } } #model-container { position:fixed; left:0; top:0; z-index: 900; } .dropzone-text{ color: #333; text-align:center; font-family:'Open Sans', 'sans-serif'; font-size:22px; margin-top:100px; } .dropzone{ background: #fff url('/icons/upload-big.png') no-repeat center; border: 5px dotted #f7f7f7; } #fileInput{ float: right; margin-top: -40px; } .rm-log-out{ background: #333; border: none; margin-top:-3px; } .rm-log-in{ color:#fff; } .rm-log-in:hover{ background-color:#333; } .feed-wrapper{ font-size: 14px; color: #555; margin-left: 5px; line-height: 1.5; max-width: 700px; margin:50px auto 50px auto; } .feed-item { margin:10px 0px 10px 0px; overflow:hidden; } .post-section{ float:left; margin-left:10px; } .post-meta { padding:5px 5px; font-size:12px; font-style:italic; color:#888; } .post-sidebar { width:100px; /* at screens less than 600px it will be 100% */ } .user-image{ width: 70px; height:70px; background: #333; border: 1px solid #333; background-size:cover !important; background-position: center !important; border-radius:50%; } .user-profile-pic { width: 200px; height: 200px; border: 2px solid #333; border-radius:50%; background-size:cover !important; background-position:center !important; } .post-content { padding:10px 10px; width:500px; max-width:500px; background:#fff; border-radius:5px; border: 1px solid #dadada; } .model-preview { margin: 10px 0px 10px 0px; height:250px; width:100%; background-repeat:no-repeat; background-size:contain; background-position:center; background-color:#333; border: 1px solid #ccc; } .model-preview-link{ text-align:center; } .model-name{ padding-top:90px; color: #fff; text-transform: capitalize; font-weight: 300; font-size: 25px; height:160px; } .model-link-text{ background-color: rgba(0,0,0,0.2); display:block; } /* .user-info, .model-info, .love-share{ float:left; padding: 15px; } .user-info{ margin-left: 25px; width: 100px; } .model-post { max-width:600px; } .model-info{ } .feed-model-preview{ width: 100%; height: 250px; } .user-name{ margin-left: 5px; } .post-description{ width:500px; margin-top:10px; display:block; } .post-description > p{ width:100%; font-size: 14px; color: #555; margin-left: 5px; line-height: 1.5; }*/ #overlay-comments { position:fixed; background:rgba(255,255,255,0.5); bottom:-10000px; right:0px; max-height:600px; border-radius:5px; min-width: 300px; max-width: 600px; z-index: 950; padding: 20px 20px; padding-top:50px; overflow-y:auto; max-height:90%; } #comments-close-button { margin-right:-10px; cursor:pointer; color:#fff; text-align:center; line-height:25px; background:#e74c3c; width:25px; height:25px; float:right; border-radius:50%; } #overlay-comments .comments { display:block; } .comments-wrapper { margin-top:10px; } .comments { display:none; overflow:hidden; } .comments-header { line-height:30px; border-radius:5px; display:block; padding-left: 10px; height:30px; } .comments-header:hover { cursor:pointer; background:rgba(231,76,60,0.1); } .comments-icon { float:left; } .comment-item{ text-align:left; padding:5px 5px 5px 10px; margin-top:10px; background:#eaeaea; border-radius:5px; } .comment-meta{ padding-top:10px; color:#666; font-size:12px; font-style:italic; color:#8a8a8a; } .author{ color:#333; } .clear { float:none; }
deepakkumarsharma/OGV-meteor
OGV/client/styles/styles.css
CSS
bsd-3-clause
8,607
/* * Copyright (c) 2012, Michael Lehn, Klaus Pototzky * * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1) Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2) Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * 3) Neither the name of the FLENS development group nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef CXXLAPACK_INTERFACE_LARRF_H #define CXXLAPACK_INTERFACE_LARRF_H 1 #include <cxxstd/complex.h> namespace cxxlapack { template <typename IndexType> IndexType larrf(char range, const float *d, const float *l, const float *ld, IndexType clstrt, IndexType clend, const float *w, float *wgap, const float *werr, float spdiam, float clgapl, float clgapr, float pivmin, float &sigma, float *dplus, float *lplus, float *work); template <typename IndexType> IndexType larrf(char range, const double *d, const double *l, const double *ld, IndexType clstrt, IndexType clend, const double *w, double *wgap, const double *werr, double spdiam, double clgapl, double clgapr, double pivmin, double &sigma, double *dplus, double *lplus, double *work); } // namespace cxxlapack #endif // CXXLAPACK_INTERFACE_LARRF_H
d-tk/FLENS
cxxlapack/interface/larrf.h
C
bsd-3-clause
3,266
// 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 "webkit/plugins/ppapi/content_decryptor_delegate.h" #include "base/callback_helpers.h" #include "base/debug/trace_event.h" #include "base/message_loop/message_loop_proxy.h" #include "media/base/audio_decoder_config.h" #include "media/base/bind_to_loop.h" #include "media/base/channel_layout.h" #include "media/base/data_buffer.h" #include "media/base/decoder_buffer.h" #include "media/base/decrypt_config.h" #include "media/base/video_decoder_config.h" #include "media/base/video_frame.h" #include "media/base/video_util.h" #include "ppapi/shared_impl/scoped_pp_resource.h" #include "ppapi/shared_impl/var.h" #include "ppapi/shared_impl/var_tracker.h" #include "ppapi/thunk/enter.h" #include "ppapi/thunk/ppb_buffer_api.h" #include "ui/gfx/rect.h" #include "webkit/plugins/ppapi/ppb_buffer_impl.h" using ppapi::ArrayBufferVar; using ppapi::PpapiGlobals; using ppapi::ScopedPPResource; using ppapi::StringVar; using ppapi::thunk::EnterResourceNoLock; using ppapi::thunk::PPB_Buffer_API; namespace webkit { namespace ppapi { namespace { // Fills |resource| with a PPB_Buffer_Impl and copies |data| into the buffer // resource. The |*resource|, if valid, will be in the ResourceTracker with a // reference-count of 0. If |data| is NULL, sets |*resource| to NULL. Returns // true upon success and false if any error happened. bool MakeBufferResource(PP_Instance instance, const uint8* data, uint32_t size, scoped_refptr<PPB_Buffer_Impl>* resource) { TRACE_EVENT0("eme", "ContentDecryptorDelegate - MakeBufferResource"); DCHECK(resource); if (!data || !size) { DCHECK(!data && !size); resource = NULL; return true; } scoped_refptr<PPB_Buffer_Impl> buffer( PPB_Buffer_Impl::CreateResource(instance, size)); if (!buffer.get()) return false; BufferAutoMapper mapper(buffer.get()); if (!mapper.data() || mapper.size() < size) return false; memcpy(mapper.data(), data, size); *resource = buffer; return true; } // Copies the content of |str| into |array|. // Returns true if copy succeeded. Returns false if copy failed, e.g. if the // |array_size| is smaller than the |str| length. template <uint32_t array_size> bool CopyStringToArray(const std::string& str, uint8 (&array)[array_size]) { if (array_size < str.size()) return false; memcpy(array, str.data(), str.size()); return true; } // Fills the |block_info| with information from |encrypted_buffer|. // // Returns true if |block_info| is successfully filled. Returns false // otherwise. static bool MakeEncryptedBlockInfo( const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, uint32_t request_id, PP_EncryptedBlockInfo* block_info) { // TODO(xhwang): Fix initialization of PP_EncryptedBlockInfo here and // anywhere else. memset(block_info, 0, sizeof(*block_info)); block_info->tracking_info.request_id = request_id; // EOS buffers need a request ID and nothing more. if (encrypted_buffer->IsEndOfStream()) return true; DCHECK(encrypted_buffer->GetDataSize()) << "DecryptConfig is set on an empty buffer"; block_info->tracking_info.timestamp = encrypted_buffer->GetTimestamp().InMicroseconds(); block_info->data_size = encrypted_buffer->GetDataSize(); const media::DecryptConfig* decrypt_config = encrypted_buffer->GetDecryptConfig(); block_info->data_offset = decrypt_config->data_offset(); if (!CopyStringToArray(decrypt_config->key_id(), block_info->key_id) || !CopyStringToArray(decrypt_config->iv(), block_info->iv)) return false; block_info->key_id_size = decrypt_config->key_id().size(); block_info->iv_size = decrypt_config->iv().size(); if (decrypt_config->subsamples().size() > arraysize(block_info->subsamples)) return false; block_info->num_subsamples = decrypt_config->subsamples().size(); for (uint32_t i = 0; i < block_info->num_subsamples; ++i) { block_info->subsamples[i].clear_bytes = decrypt_config->subsamples()[i].clear_bytes; block_info->subsamples[i].cipher_bytes = decrypt_config->subsamples()[i].cypher_bytes; } return true; } // Deserializes audio data stored in |audio_frames| into individual audio // buffers in |frames|. Returns true upon success. bool DeserializeAudioFrames(PP_Resource audio_frames, int data_size, media::Decryptor::AudioBuffers* frames) { DCHECK(frames); EnterResourceNoLock<PPB_Buffer_API> enter(audio_frames, true); if (!enter.succeeded()) return false; BufferAutoMapper mapper(enter.object()); if (!mapper.data() || !mapper.size() || mapper.size() < static_cast<uint32_t>(data_size)) return false; const uint8* cur = static_cast<uint8*>(mapper.data()); int bytes_left = data_size; do { int64 timestamp = 0; int64 frame_size = -1; const int kHeaderSize = sizeof(timestamp) + sizeof(frame_size); if (bytes_left < kHeaderSize) return false; memcpy(&timestamp, cur, sizeof(timestamp)); cur += sizeof(timestamp); bytes_left -= sizeof(timestamp); memcpy(&frame_size, cur, sizeof(frame_size)); cur += sizeof(frame_size); bytes_left -= sizeof(frame_size); // We should *not* have empty frame in the list. if (frame_size <= 0 || bytes_left < frame_size) return false; scoped_refptr<media::DataBuffer> frame = media::DataBuffer::CopyFrom(cur, frame_size); frame->SetTimestamp(base::TimeDelta::FromMicroseconds(timestamp)); frames->push_back(frame); cur += frame_size; bytes_left -= frame_size; } while (bytes_left > 0); return true; } PP_AudioCodec MediaAudioCodecToPpAudioCodec(media::AudioCodec codec) { switch (codec) { case media::kCodecVorbis: return PP_AUDIOCODEC_VORBIS; case media::kCodecAAC: return PP_AUDIOCODEC_AAC; default: return PP_AUDIOCODEC_UNKNOWN; } } PP_VideoCodec MediaVideoCodecToPpVideoCodec(media::VideoCodec codec) { switch (codec) { case media::kCodecVP8: return PP_VIDEOCODEC_VP8; case media::kCodecH264: return PP_VIDEOCODEC_H264; default: return PP_VIDEOCODEC_UNKNOWN; } } PP_VideoCodecProfile MediaVideoCodecProfileToPpVideoCodecProfile( media::VideoCodecProfile profile) { switch (profile) { case media::VP8PROFILE_MAIN: return PP_VIDEOCODECPROFILE_VP8_MAIN; case media::H264PROFILE_BASELINE: return PP_VIDEOCODECPROFILE_H264_BASELINE; case media::H264PROFILE_MAIN: return PP_VIDEOCODECPROFILE_H264_MAIN; case media::H264PROFILE_EXTENDED: return PP_VIDEOCODECPROFILE_H264_EXTENDED; case media::H264PROFILE_HIGH: return PP_VIDEOCODECPROFILE_H264_HIGH; case media::H264PROFILE_HIGH10PROFILE: return PP_VIDEOCODECPROFILE_H264_HIGH_10; case media::H264PROFILE_HIGH422PROFILE: return PP_VIDEOCODECPROFILE_H264_HIGH_422; case media::H264PROFILE_HIGH444PREDICTIVEPROFILE: return PP_VIDEOCODECPROFILE_H264_HIGH_444_PREDICTIVE; default: return PP_VIDEOCODECPROFILE_UNKNOWN; } } PP_DecryptedFrameFormat MediaVideoFormatToPpDecryptedFrameFormat( media::VideoFrame::Format format) { switch (format) { case media::VideoFrame::YV12: return PP_DECRYPTEDFRAMEFORMAT_YV12; case media::VideoFrame::I420: return PP_DECRYPTEDFRAMEFORMAT_I420; default: return PP_DECRYPTEDFRAMEFORMAT_UNKNOWN; } } media::Decryptor::Status PpDecryptResultToMediaDecryptorStatus( PP_DecryptResult result) { switch (result) { case PP_DECRYPTRESULT_SUCCESS: return media::Decryptor::kSuccess; case PP_DECRYPTRESULT_DECRYPT_NOKEY: return media::Decryptor::kNoKey; case PP_DECRYPTRESULT_NEEDMOREDATA: return media::Decryptor::kNeedMoreData; case PP_DECRYPTRESULT_DECRYPT_ERROR: return media::Decryptor::kError; case PP_DECRYPTRESULT_DECODE_ERROR: return media::Decryptor::kError; default: NOTREACHED(); return media::Decryptor::kError; } } PP_DecryptorStreamType MediaDecryptorStreamTypeToPpStreamType( media::Decryptor::StreamType stream_type) { switch (stream_type) { case media::Decryptor::kAudio: return PP_DECRYPTORSTREAMTYPE_AUDIO; case media::Decryptor::kVideo: return PP_DECRYPTORSTREAMTYPE_VIDEO; default: NOTREACHED(); return PP_DECRYPTORSTREAMTYPE_VIDEO; } } } // namespace ContentDecryptorDelegate::ContentDecryptorDelegate( PP_Instance pp_instance, const PPP_ContentDecryptor_Private* plugin_decryption_interface) : pp_instance_(pp_instance), plugin_decryption_interface_(plugin_decryption_interface), next_decryption_request_id_(1), pending_audio_decrypt_request_id_(0), pending_video_decrypt_request_id_(0), pending_audio_decoder_init_request_id_(0), pending_video_decoder_init_request_id_(0), pending_audio_decode_request_id_(0), pending_video_decode_request_id_(0), weak_ptr_factory_(this), weak_this_(weak_ptr_factory_.GetWeakPtr()) { } void ContentDecryptorDelegate::Initialize(const std::string& key_system) { // TODO(ddorwin): Add an Initialize method to PPP_ContentDecryptor_Private. DCHECK(!key_system.empty()); key_system_ = key_system; } void ContentDecryptorDelegate::SetKeyEventCallbacks( const media::KeyAddedCB& key_added_cb, const media::KeyErrorCB& key_error_cb, const media::KeyMessageCB& key_message_cb) { key_added_cb_ = key_added_cb; key_error_cb_ = key_error_cb; key_message_cb_ = key_message_cb; } bool ContentDecryptorDelegate::GenerateKeyRequest(const std::string& type, const uint8* init_data, int init_data_length) { PP_Var init_data_array = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( init_data_length, init_data); plugin_decryption_interface_->GenerateKeyRequest( pp_instance_, StringVar::StringToPPVar(key_system_), // TODO(ddorwin): Remove. StringVar::StringToPPVar(type), init_data_array); return true; } bool ContentDecryptorDelegate::AddKey(const std::string& session_id, const uint8* key, int key_length, const uint8* init_data, int init_data_length) { PP_Var key_array = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar(key_length, key); PP_Var init_data_array = PpapiGlobals::Get()->GetVarTracker()->MakeArrayBufferPPVar( init_data_length, init_data); plugin_decryption_interface_->AddKey( pp_instance_, StringVar::StringToPPVar(session_id), key_array, init_data_array); return true; } bool ContentDecryptorDelegate::CancelKeyRequest(const std::string& session_id) { plugin_decryption_interface_->CancelKeyRequest( pp_instance_, StringVar::StringToPPVar(session_id)); return true; } // TODO(xhwang): Remove duplication of code in Decrypt(), // DecryptAndDecodeAudio() and DecryptAndDecodeVideo(). bool ContentDecryptorDelegate::Decrypt( media::Decryptor::StreamType stream_type, const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, const media::Decryptor::DecryptCB& decrypt_cb) { DVLOG(3) << "Decrypt() - stream_type: " << stream_type; // |{audio|video}_input_resource_| is not being used by the plugin // now because there is only one pending audio/video decrypt request at any // time. This is enforced by the media pipeline. scoped_refptr<PPB_Buffer_Impl> encrypted_resource; if (!MakeMediaBufferResource( stream_type, encrypted_buffer, &encrypted_resource) || !encrypted_resource.get()) { return false; } ScopedPPResource pp_resource(encrypted_resource.get()); const uint32_t request_id = next_decryption_request_id_++; DVLOG(2) << "Decrypt() - request_id " << request_id; PP_EncryptedBlockInfo block_info = {}; DCHECK(encrypted_buffer->GetDecryptConfig()); if (!MakeEncryptedBlockInfo(encrypted_buffer, request_id, &block_info)) { return false; } // There is only one pending decrypt request at any time per stream. This is // enforced by the media pipeline. switch (stream_type) { case media::Decryptor::kAudio: DCHECK_EQ(pending_audio_decrypt_request_id_, 0u); DCHECK(pending_audio_decrypt_cb_.is_null()); pending_audio_decrypt_request_id_ = request_id; pending_audio_decrypt_cb_ = decrypt_cb; break; case media::Decryptor::kVideo: DCHECK_EQ(pending_video_decrypt_request_id_, 0u); DCHECK(pending_video_decrypt_cb_.is_null()); pending_video_decrypt_request_id_ = request_id; pending_video_decrypt_cb_ = decrypt_cb; break; default: NOTREACHED(); return false; } SetBufferToFreeInTrackingInfo(&block_info.tracking_info); plugin_decryption_interface_->Decrypt(pp_instance_, pp_resource, &block_info); return true; } bool ContentDecryptorDelegate::CancelDecrypt( media::Decryptor::StreamType stream_type) { DVLOG(3) << "CancelDecrypt() - stream_type: " << stream_type; media::Decryptor::DecryptCB decrypt_cb; switch (stream_type) { case media::Decryptor::kAudio: // Release the shared memory as it can still be in use by the plugin. // The next Decrypt() call will need to allocate a new shared memory // buffer. audio_input_resource_ = NULL; pending_audio_decrypt_request_id_ = 0; decrypt_cb = base::ResetAndReturn(&pending_audio_decrypt_cb_); break; case media::Decryptor::kVideo: // Release the shared memory as it can still be in use by the plugin. // The next Decrypt() call will need to allocate a new shared memory // buffer. video_input_resource_ = NULL; pending_video_decrypt_request_id_ = 0; decrypt_cb = base::ResetAndReturn(&pending_video_decrypt_cb_); break; default: NOTREACHED(); return false; } if (!decrypt_cb.is_null()) decrypt_cb.Run(media::Decryptor::kSuccess, NULL); return true; } bool ContentDecryptorDelegate::InitializeAudioDecoder( const media::AudioDecoderConfig& decoder_config, const media::Decryptor::DecoderInitCB& init_cb) { PP_AudioDecoderConfig pp_decoder_config; pp_decoder_config.codec = MediaAudioCodecToPpAudioCodec(decoder_config.codec()); pp_decoder_config.channel_count = media::ChannelLayoutToChannelCount(decoder_config.channel_layout()); pp_decoder_config.bits_per_channel = decoder_config.bits_per_channel(); pp_decoder_config.samples_per_second = decoder_config.samples_per_second(); pp_decoder_config.request_id = next_decryption_request_id_++; scoped_refptr<PPB_Buffer_Impl> extra_data_resource; if (!MakeBufferResource(pp_instance_, decoder_config.extra_data(), decoder_config.extra_data_size(), &extra_data_resource)) { return false; } ScopedPPResource pp_resource(extra_data_resource.get()); DCHECK_EQ(pending_audio_decoder_init_request_id_, 0u); DCHECK(pending_audio_decoder_init_cb_.is_null()); pending_audio_decoder_init_request_id_ = pp_decoder_config.request_id; pending_audio_decoder_init_cb_ = init_cb; plugin_decryption_interface_->InitializeAudioDecoder(pp_instance_, &pp_decoder_config, pp_resource); return true; } bool ContentDecryptorDelegate::InitializeVideoDecoder( const media::VideoDecoderConfig& decoder_config, const media::Decryptor::DecoderInitCB& init_cb) { PP_VideoDecoderConfig pp_decoder_config; pp_decoder_config.codec = MediaVideoCodecToPpVideoCodec(decoder_config.codec()); pp_decoder_config.profile = MediaVideoCodecProfileToPpVideoCodecProfile(decoder_config.profile()); pp_decoder_config.format = MediaVideoFormatToPpDecryptedFrameFormat(decoder_config.format()); pp_decoder_config.width = decoder_config.coded_size().width(); pp_decoder_config.height = decoder_config.coded_size().height(); pp_decoder_config.request_id = next_decryption_request_id_++; scoped_refptr<PPB_Buffer_Impl> extra_data_resource; if (!MakeBufferResource(pp_instance_, decoder_config.extra_data(), decoder_config.extra_data_size(), &extra_data_resource)) { return false; } ScopedPPResource pp_resource(extra_data_resource.get()); DCHECK_EQ(pending_video_decoder_init_request_id_, 0u); DCHECK(pending_video_decoder_init_cb_.is_null()); pending_video_decoder_init_request_id_ = pp_decoder_config.request_id; pending_video_decoder_init_cb_ = init_cb; natural_size_ = decoder_config.natural_size(); plugin_decryption_interface_->InitializeVideoDecoder(pp_instance_, &pp_decoder_config, pp_resource); return true; } bool ContentDecryptorDelegate::DeinitializeDecoder( media::Decryptor::StreamType stream_type) { CancelDecode(stream_type); natural_size_ = gfx::Size(); // TODO(tomfinegan): Add decoder deinitialize request tracking, and get // stream type from media stack. plugin_decryption_interface_->DeinitializeDecoder( pp_instance_, MediaDecryptorStreamTypeToPpStreamType(stream_type), 0); return true; } bool ContentDecryptorDelegate::ResetDecoder( media::Decryptor::StreamType stream_type) { CancelDecode(stream_type); // TODO(tomfinegan): Add decoder reset request tracking. plugin_decryption_interface_->ResetDecoder( pp_instance_, MediaDecryptorStreamTypeToPpStreamType(stream_type), 0); return true; } bool ContentDecryptorDelegate::DecryptAndDecodeAudio( const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, const media::Decryptor::AudioDecodeCB& audio_decode_cb) { // |audio_input_resource_| is not being used by the plugin now // because there is only one pending audio decode request at any time. // This is enforced by the media pipeline. scoped_refptr<PPB_Buffer_Impl> encrypted_resource; if (!MakeMediaBufferResource(media::Decryptor::kAudio, encrypted_buffer, &encrypted_resource)) { return false; } // The resource should not be NULL for non-EOS buffer. if (!encrypted_buffer->IsEndOfStream() && !encrypted_resource.get()) return false; const uint32_t request_id = next_decryption_request_id_++; DVLOG(2) << "DecryptAndDecodeAudio() - request_id " << request_id; PP_EncryptedBlockInfo block_info = {}; if (!MakeEncryptedBlockInfo(encrypted_buffer, request_id, &block_info)) { return false; } SetBufferToFreeInTrackingInfo(&block_info.tracking_info); // There is only one pending audio decode request at any time. This is // enforced by the media pipeline. If this DCHECK is violated, our buffer // reuse policy is not valid, and we may have race problems for the shared // buffer. DCHECK_EQ(pending_audio_decode_request_id_, 0u); DCHECK(pending_audio_decode_cb_.is_null()); pending_audio_decode_request_id_ = request_id; pending_audio_decode_cb_ = audio_decode_cb; ScopedPPResource pp_resource(encrypted_resource.get()); plugin_decryption_interface_->DecryptAndDecode(pp_instance_, PP_DECRYPTORSTREAMTYPE_AUDIO, pp_resource, &block_info); return true; } bool ContentDecryptorDelegate::DecryptAndDecodeVideo( const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, const media::Decryptor::VideoDecodeCB& video_decode_cb) { // |video_input_resource_| is not being used by the plugin now // because there is only one pending video decode request at any time. // This is enforced by the media pipeline. scoped_refptr<PPB_Buffer_Impl> encrypted_resource; if (!MakeMediaBufferResource(media::Decryptor::kVideo, encrypted_buffer, &encrypted_resource)) { return false; } // The resource should not be 0 for non-EOS buffer. if (!encrypted_buffer->IsEndOfStream() && !encrypted_resource.get()) return false; const uint32_t request_id = next_decryption_request_id_++; DVLOG(2) << "DecryptAndDecodeVideo() - request_id " << request_id; TRACE_EVENT_ASYNC_BEGIN0( "eme", "ContentDecryptorDelegate::DecryptAndDecodeVideo", request_id); PP_EncryptedBlockInfo block_info = {}; if (!MakeEncryptedBlockInfo(encrypted_buffer, request_id, &block_info)) { return false; } SetBufferToFreeInTrackingInfo(&block_info.tracking_info); // Only one pending video decode request at any time. This is enforced by the // media pipeline. If this DCHECK is violated, our buffer // reuse policy is not valid, and we may have race problems for the shared // buffer. DCHECK_EQ(pending_video_decode_request_id_, 0u); DCHECK(pending_video_decode_cb_.is_null()); pending_video_decode_request_id_ = request_id; pending_video_decode_cb_ = video_decode_cb; // TODO(tomfinegan): Need to get stream type from media stack. ScopedPPResource pp_resource(encrypted_resource.get()); plugin_decryption_interface_->DecryptAndDecode(pp_instance_, PP_DECRYPTORSTREAMTYPE_VIDEO, pp_resource, &block_info); return true; } void ContentDecryptorDelegate::NeedKey(PP_Var key_system_var, PP_Var session_id_var, PP_Var init_data_var) { // TODO(ddorwin): Remove from PPB_ContentDecryptor_Private. NOTREACHED(); } void ContentDecryptorDelegate::KeyAdded(PP_Var key_system_var, PP_Var session_id_var) { if (key_added_cb_.is_null()) return; StringVar* session_id_string = StringVar::FromPPVar(session_id_var); if (!session_id_string) { key_error_cb_.Run(std::string(), media::MediaKeys::kUnknownError, 0); return; } key_added_cb_.Run(session_id_string->value()); } void ContentDecryptorDelegate::KeyMessage(PP_Var key_system_var, PP_Var session_id_var, PP_Var message_var, PP_Var default_url_var) { if (key_message_cb_.is_null()) return; StringVar* session_id_string = StringVar::FromPPVar(session_id_var); ArrayBufferVar* message_array_buffer = ArrayBufferVar::FromPPVar(message_var); std::string message; if (message_array_buffer) { const char* data = static_cast<const char*>(message_array_buffer->Map()); message.assign(data, message_array_buffer->ByteLength()); } StringVar* default_url_string = StringVar::FromPPVar(default_url_var); if (!session_id_string || !default_url_string) { key_error_cb_.Run(std::string(), media::MediaKeys::kUnknownError, 0); return; } key_message_cb_.Run(session_id_string->value(), message, default_url_string->value()); } void ContentDecryptorDelegate::KeyError(PP_Var key_system_var, PP_Var session_id_var, int32_t media_error, int32_t system_code) { if (key_error_cb_.is_null()) return; StringVar* session_id_string = StringVar::FromPPVar(session_id_var); if (!session_id_string) { key_error_cb_.Run(std::string(), media::MediaKeys::kUnknownError, 0); return; } key_error_cb_.Run(session_id_string->value(), static_cast<media::MediaKeys::KeyError>(media_error), system_code); } void ContentDecryptorDelegate::DecoderInitializeDone( PP_DecryptorStreamType decoder_type, uint32_t request_id, PP_Bool success) { if (decoder_type == PP_DECRYPTORSTREAMTYPE_AUDIO) { // If the request ID is not valid or does not match what's saved, do // nothing. if (request_id == 0 || request_id != pending_audio_decoder_init_request_id_) return; DCHECK(!pending_audio_decoder_init_cb_.is_null()); pending_audio_decoder_init_request_id_ = 0; base::ResetAndReturn( &pending_audio_decoder_init_cb_).Run(PP_ToBool(success)); } else { if (request_id == 0 || request_id != pending_video_decoder_init_request_id_) return; if (!success) natural_size_ = gfx::Size(); DCHECK(!pending_video_decoder_init_cb_.is_null()); pending_video_decoder_init_request_id_ = 0; base::ResetAndReturn( &pending_video_decoder_init_cb_).Run(PP_ToBool(success)); } } void ContentDecryptorDelegate::DecoderDeinitializeDone( PP_DecryptorStreamType decoder_type, uint32_t request_id) { // TODO(tomfinegan): Add decoder stop completion handling. } void ContentDecryptorDelegate::DecoderResetDone( PP_DecryptorStreamType decoder_type, uint32_t request_id) { // TODO(tomfinegan): Add decoder reset completion handling. } void ContentDecryptorDelegate::DeliverBlock( PP_Resource decrypted_block, const PP_DecryptedBlockInfo* block_info) { DCHECK(block_info); FreeBuffer(block_info->tracking_info.buffer_id); const uint32_t request_id = block_info->tracking_info.request_id; DVLOG(2) << "DeliverBlock() - request_id: " << request_id; // If the request ID is not valid or does not match what's saved, do nothing. if (request_id == 0) { DVLOG(1) << "DeliverBlock() - invalid request_id " << request_id; return; } media::Decryptor::DecryptCB decrypt_cb; if (request_id == pending_audio_decrypt_request_id_) { DCHECK(!pending_audio_decrypt_cb_.is_null()); pending_audio_decrypt_request_id_ = 0; decrypt_cb = base::ResetAndReturn(&pending_audio_decrypt_cb_); } else if (request_id == pending_video_decrypt_request_id_) { DCHECK(!pending_video_decrypt_cb_.is_null()); pending_video_decrypt_request_id_ = 0; decrypt_cb = base::ResetAndReturn(&pending_video_decrypt_cb_); } else { DVLOG(1) << "DeliverBlock() - request_id " << request_id << " not found"; return; } media::Decryptor::Status status = PpDecryptResultToMediaDecryptorStatus(block_info->result); if (status != media::Decryptor::kSuccess) { decrypt_cb.Run(status, NULL); return; } EnterResourceNoLock<PPB_Buffer_API> enter(decrypted_block, true); if (!enter.succeeded()) { decrypt_cb.Run(media::Decryptor::kError, NULL); return; } BufferAutoMapper mapper(enter.object()); if (!mapper.data() || !mapper.size() || mapper.size() < block_info->data_size) { decrypt_cb.Run(media::Decryptor::kError, NULL); return; } // TODO(tomfinegan): Find a way to take ownership of the shared memory // managed by the PPB_Buffer_Dev, and avoid the extra copy. scoped_refptr<media::DecoderBuffer> decrypted_buffer( media::DecoderBuffer::CopyFrom( static_cast<uint8*>(mapper.data()), block_info->data_size)); decrypted_buffer->SetTimestamp(base::TimeDelta::FromMicroseconds( block_info->tracking_info.timestamp)); decrypt_cb.Run(media::Decryptor::kSuccess, decrypted_buffer); } // Use a non-class-member function here so that if for some reason // ContentDecryptorDelegate is destroyed before VideoFrame calls this callback, // we can still get the shared memory unmapped. static void BufferNoLongerNeeded( const scoped_refptr<PPB_Buffer_Impl>& ppb_buffer, base::Closure buffer_no_longer_needed_cb) { ppb_buffer->Unmap(); buffer_no_longer_needed_cb.Run(); } // Enters |resource|, maps shared memory and returns pointer of mapped data. // Returns NULL if any error occurs. static uint8* GetMappedBuffer(PP_Resource resource, scoped_refptr<PPB_Buffer_Impl>* ppb_buffer) { EnterResourceNoLock<PPB_Buffer_API> enter(resource, true); if (!enter.succeeded()) return NULL; uint8* mapped_data = static_cast<uint8*>(enter.object()->Map()); if (!enter.object()->IsMapped() || !mapped_data) return NULL; uint32_t mapped_size = 0; if (!enter.object()->Describe(&mapped_size) || !mapped_size) { enter.object()->Unmap(); return NULL; } *ppb_buffer = static_cast<PPB_Buffer_Impl*>(enter.object()); return mapped_data; } void ContentDecryptorDelegate::DeliverFrame( PP_Resource decrypted_frame, const PP_DecryptedFrameInfo* frame_info) { DCHECK(frame_info); const uint32_t request_id = frame_info->tracking_info.request_id; DVLOG(2) << "DeliverFrame() - request_id: " << request_id; // If the request ID is not valid or does not match what's saved, do nothing. if (request_id == 0 || request_id != pending_video_decode_request_id_) { DVLOG(1) << "DeliverFrame() - request_id " << request_id << " not found"; FreeBuffer(frame_info->tracking_info.buffer_id); return; } TRACE_EVENT_ASYNC_END0( "eme", "ContentDecryptorDelegate::DecryptAndDecodeVideo", request_id); DCHECK(!pending_video_decode_cb_.is_null()); pending_video_decode_request_id_ = 0; media::Decryptor::VideoDecodeCB video_decode_cb = base::ResetAndReturn(&pending_video_decode_cb_); media::Decryptor::Status status = PpDecryptResultToMediaDecryptorStatus(frame_info->result); if (status != media::Decryptor::kSuccess) { DCHECK(!frame_info->tracking_info.buffer_id); video_decode_cb.Run(status, NULL); return; } scoped_refptr<PPB_Buffer_Impl> ppb_buffer; uint8* frame_data = GetMappedBuffer(decrypted_frame, &ppb_buffer); if (!frame_data) { FreeBuffer(frame_info->tracking_info.buffer_id); video_decode_cb.Run(media::Decryptor::kError, NULL); return; } gfx::Size frame_size(frame_info->width, frame_info->height); DCHECK_EQ(frame_info->format, PP_DECRYPTEDFRAMEFORMAT_YV12); scoped_refptr<media::VideoFrame> decoded_frame = media::VideoFrame::WrapExternalYuvData( media::VideoFrame::YV12, frame_size, gfx::Rect(frame_size), natural_size_, frame_info->strides[PP_DECRYPTEDFRAMEPLANES_Y], frame_info->strides[PP_DECRYPTEDFRAMEPLANES_U], frame_info->strides[PP_DECRYPTEDFRAMEPLANES_V], frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_Y], frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_U], frame_data + frame_info->plane_offsets[PP_DECRYPTEDFRAMEPLANES_V], base::TimeDelta::FromMicroseconds( frame_info->tracking_info.timestamp), media::BindToLoop( base::MessageLoopProxy::current(), base::Bind(&BufferNoLongerNeeded, ppb_buffer, base::Bind(&ContentDecryptorDelegate::FreeBuffer, weak_this_, frame_info->tracking_info.buffer_id)))); video_decode_cb.Run(media::Decryptor::kSuccess, decoded_frame); } void ContentDecryptorDelegate::DeliverSamples( PP_Resource audio_frames, const PP_DecryptedBlockInfo* block_info) { DCHECK(block_info); FreeBuffer(block_info->tracking_info.buffer_id); const uint32_t request_id = block_info->tracking_info.request_id; DVLOG(2) << "DeliverSamples() - request_id: " << request_id; // If the request ID is not valid or does not match what's saved, do nothing. if (request_id == 0 || request_id != pending_audio_decode_request_id_) { DVLOG(1) << "DeliverSamples() - request_id " << request_id << " not found"; return; } DCHECK(!pending_audio_decode_cb_.is_null()); pending_audio_decode_request_id_ = 0; media::Decryptor::AudioDecodeCB audio_decode_cb = base::ResetAndReturn(&pending_audio_decode_cb_); const media::Decryptor::AudioBuffers empty_frames; media::Decryptor::Status status = PpDecryptResultToMediaDecryptorStatus(block_info->result); if (status != media::Decryptor::kSuccess) { audio_decode_cb.Run(status, empty_frames); return; } media::Decryptor::AudioBuffers audio_frame_list; if (!DeserializeAudioFrames(audio_frames, block_info->data_size, &audio_frame_list)) { NOTREACHED() << "CDM did not serialize the buffer correctly."; audio_decode_cb.Run(media::Decryptor::kError, empty_frames); return; } audio_decode_cb.Run(media::Decryptor::kSuccess, audio_frame_list); } // TODO(xhwang): Try to remove duplicate logic here and in CancelDecrypt(). void ContentDecryptorDelegate::CancelDecode( media::Decryptor::StreamType stream_type) { switch (stream_type) { case media::Decryptor::kAudio: // Release the shared memory as it can still be in use by the plugin. // The next DecryptAndDecode() call will need to allocate a new shared // memory buffer. audio_input_resource_ = NULL; pending_audio_decode_request_id_ = 0; if (!pending_audio_decode_cb_.is_null()) base::ResetAndReturn(&pending_audio_decode_cb_).Run( media::Decryptor::kSuccess, media::Decryptor::AudioBuffers()); break; case media::Decryptor::kVideo: // Release the shared memory as it can still be in use by the plugin. // The next DecryptAndDecode() call will need to allocate a new shared // memory buffer. video_input_resource_ = NULL; pending_video_decode_request_id_ = 0; if (!pending_video_decode_cb_.is_null()) base::ResetAndReturn(&pending_video_decode_cb_).Run( media::Decryptor::kSuccess, NULL); break; default: NOTREACHED(); } } bool ContentDecryptorDelegate::MakeMediaBufferResource( media::Decryptor::StreamType stream_type, const scoped_refptr<media::DecoderBuffer>& encrypted_buffer, scoped_refptr<PPB_Buffer_Impl>* resource) { TRACE_EVENT0("eme", "ContentDecryptorDelegate::MakeMediaBufferResource"); // End of stream buffers are represented as null resources. if (encrypted_buffer->IsEndOfStream()) { *resource = NULL; return true; } DCHECK(stream_type == media::Decryptor::kAudio || stream_type == media::Decryptor::kVideo); scoped_refptr<PPB_Buffer_Impl>& media_resource = (stream_type == media::Decryptor::kAudio) ? audio_input_resource_ : video_input_resource_; const size_t data_size = static_cast<size_t>(encrypted_buffer->GetDataSize()); if (!media_resource.get() || media_resource->size() < data_size) { // Either the buffer hasn't been created yet, or we have one that isn't big // enough to fit |size| bytes. // Media resource size starts from |kMinimumMediaBufferSize| and grows // exponentially to avoid frequent re-allocation of PPB_Buffer_Impl, // which is usually expensive. Since input media buffers are compressed, // they are usually small (compared to outputs). The over-allocated memory // should be negligible. const uint32_t kMinimumMediaBufferSize = 1024; uint32_t media_resource_size = media_resource.get() ? media_resource->size() : kMinimumMediaBufferSize; while (media_resource_size < data_size) media_resource_size *= 2; DVLOG(2) << "Size of media buffer for " << ((stream_type == media::Decryptor::kAudio) ? "audio" : "video") << " stream bumped to " << media_resource_size << " bytes to fit input."; media_resource = PPB_Buffer_Impl::CreateResource(pp_instance_, media_resource_size); if (!media_resource.get()) return false; } BufferAutoMapper mapper(media_resource.get()); if (!mapper.data() || mapper.size() < data_size) { media_resource = NULL; return false; } memcpy(mapper.data(), encrypted_buffer->GetData(), data_size); *resource = media_resource; return true; } void ContentDecryptorDelegate::FreeBuffer(uint32_t buffer_id) { if (buffer_id) free_buffers_.push(buffer_id); } void ContentDecryptorDelegate::SetBufferToFreeInTrackingInfo( PP_DecryptTrackingInfo* tracking_info) { DCHECK_EQ(tracking_info->buffer_id, 0u); if (free_buffers_.empty()) return; tracking_info->buffer_id = free_buffers_.front(); free_buffers_.pop(); } } // namespace ppapi } // namespace webkit
pozdnyakov/chromium-crosswalk
webkit/plugins/ppapi/content_decryptor_delegate.cc
C++
bsd-3-clause
37,041
/* / _____) _ | | ( (____ _____ ____ _| |_ _____ ____| |__ \____ \| ___ | (_ _) ___ |/ ___) _ \ _____) ) ____| | | || |_| ____( (___| | | | (______/|_____)_|_|_| \__)_____)\____)_| |_| (C)2013 Semtech Description: Helper functions implementation License: Revised BSD License, see LICENSE.TXT file include in the project Maintainer: Miguel Luis and Gregory Cristian */ #ifndef __UTILITIES_H__ #define __UTILITIES_H__ /*! * \brief Returns the minimum value betwen a and b * * \param [IN] a 1st value * \param [IN] b 2nd value * \retval minValue Minimum value */ #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) /*! * \brief Returns the maximum value betwen a and b * * \param [IN] a 1st value * \param [IN] b 2nd value * \retval maxValue Maximum value */ #define MAX( a, b ) ( ( ( a ) > ( b ) ) ? ( a ) : ( b ) ) /*! * \brief Returns 2 raised to the power of n * * \param [IN] n power value * \retval result of raising 2 to the power n */ #define POW2( n ) ( 1 << n ) /*! * \brief Initializes the pseudo ramdom generator initial value * * \param [IN] seed Pseudo ramdom generator initial value */ void srand1( uint32_t seed ); /*! * \brief Computes a random number between min and max * * \param [IN] min range minimum value * \param [IN] max range maximum value * \retval random random value in range min..max */ int32_t randr( int32_t min, int32_t max ); /*! * \brief Copies size elements of src array to dst array * * \remark STM32 Standard memcpy function only works on pointers that are aligned * * \param [OUT] dst Destination array * \param [IN] src Source array * \param [IN] size Number of bytes to be copied */ void memcpy1( uint8_t *dst, const uint8_t *src, uint16_t size ); /*! * \brief Copies size elements of src array to dst array reversing the byte order * * \param [OUT] dst Destination array * \param [IN] src Source array * \param [IN] size Number of bytes to be copied */ void memcpyr( uint8_t *dst, const uint8_t *src, uint16_t size ); /*! * \brief Set size elements of dst array with value * * \remark STM32 Standard memset function only works on pointers that are aligned * * \param [OUT] dst Destination array * \param [IN] value Default value * \param [IN] size Number of bytes to be copied */ void memset1( uint8_t *dst, uint8_t value, uint16_t size ); /*! * \brief Converts a nibble to an hexadecimal character * * \param [IN] a Nibble to be converted * \retval hexChar Converted hexadecimal character */ int8_t Nibble2HexChar( uint8_t a ); #endif // __UTILITIES_H__
risinghf/liblorawan
src/misc/utilities.h
C
bsd-3-clause
2,726
package org.hisp.dhis.commons.timer; /* * Copyright (c) 2004-2015, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this * list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * Neither the name of the HISP project nor the names of its contributors may * be used to endorse or promote products derived from this software without * specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ import java.util.concurrent.TimeUnit; /** * Timer implementation which uses system time. * * @author Morten Olav Hansen */ public class SystemTimer implements Timer { private long internalStart = 0; private long internalEnd = 0; @Override public Timer start() { internalStart = System.nanoTime(); return this; } @Override public Timer stop() { internalEnd = System.nanoTime(); return this; } @Override public Long duration() { return internalEnd - internalStart; } @Override public String toString() { double seconds = TimeUnit.MILLISECONDS.convert( duration(), TimeUnit.NANOSECONDS ) / 1000.0f; return String.format( "%.2f seconds", seconds ); } }
steffeli/inf5750-tracker-capture
dhis-support/dhis-support-commons/src/main/java/org/hisp/dhis/commons/timer/SystemTimer.java
Java
bsd-3-clause
2,389
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "ui/base/user_activity/user_activity_detector.h" #include "base/format_macros.h" #include "base/logging.h" #include "base/strings/stringprintf.h" #include "build/build_config.h" #include "ui/base/user_activity/user_activity_observer.h" #include "ui/events/event_utils.h" #include "ui/events/platform/platform_event_source.h" namespace ui { namespace { UserActivityDetector* g_instance = nullptr; // Returns a string describing |event|. std::string GetEventDebugString(const ui::Event* event) { std::string details = base::StringPrintf( "type=%d name=%s flags=%d time=%" PRId64, event->type(), event->name().c_str(), event->flags(), event->time_stamp().InMilliseconds()); if (event->IsKeyEvent()) { details += base::StringPrintf(" key_code=%d", static_cast<const ui::KeyEvent*>(event)->key_code()); } else if (event->IsMouseEvent() || event->IsTouchEvent() || event->IsGestureEvent()) { details += base::StringPrintf(" location=%s", static_cast<const ui::LocatedEvent*>( event)->location().ToString().c_str()); } return details; } } // namespace const int UserActivityDetector::kNotifyIntervalMs = 200; // Too low and mouse events generated at the tail end of reconfiguration // will be reported as user activity and turn the screen back on; too high // and we'll ignore legitimate activity. const int UserActivityDetector::kDisplayPowerChangeIgnoreMouseMs = 1000; UserActivityDetector::UserActivityDetector() { CHECK(!g_instance); g_instance = this; ui::PlatformEventSource* platform_event_source = ui::PlatformEventSource::GetInstance(); // TODO(sad): Need a PES for mus. if (platform_event_source) platform_event_source->AddPlatformEventObserver(this); } UserActivityDetector::~UserActivityDetector() { ui::PlatformEventSource* platform_event_source = ui::PlatformEventSource::GetInstance(); if (platform_event_source) platform_event_source->RemovePlatformEventObserver(this); g_instance = nullptr; } // static UserActivityDetector* UserActivityDetector::Get() { return g_instance; } bool UserActivityDetector::HasObserver( const UserActivityObserver* observer) const { return observers_.HasObserver(observer); } void UserActivityDetector::AddObserver(UserActivityObserver* observer) { observers_.AddObserver(observer); } void UserActivityDetector::RemoveObserver(UserActivityObserver* observer) { observers_.RemoveObserver(observer); } void UserActivityDetector::OnDisplayPowerChanging() { honor_mouse_events_time_ = GetCurrentTime() + base::TimeDelta::FromMilliseconds(kDisplayPowerChangeIgnoreMouseMs); } void UserActivityDetector::DidProcessEvent( const PlatformEvent& platform_event) { std::unique_ptr<ui::Event> event(ui::EventFromNative(platform_event)); ProcessReceivedEvent(event.get()); } base::TimeTicks UserActivityDetector::GetCurrentTime() const { return !now_for_test_.is_null() ? now_for_test_ : base::TimeTicks::Now(); } void UserActivityDetector::ProcessReceivedEvent(const ui::Event* event) { if (!event) return; if (event->IsMouseEvent() || event->IsMouseWheelEvent()) { if (event->flags() & ui::EF_IS_SYNTHESIZED) return; if (!honor_mouse_events_time_.is_null() && GetCurrentTime() < honor_mouse_events_time_) return; } HandleActivity(event); } void UserActivityDetector::HandleActivity(const ui::Event* event) { base::TimeTicks now = GetCurrentTime(); last_activity_time_ = now; if (last_observer_notification_time_.is_null() || (now - last_observer_notification_time_).InMillisecondsF() >= kNotifyIntervalMs) { if (VLOG_IS_ON(1)) VLOG(1) << "Reporting user activity: " << GetEventDebugString(event); FOR_EACH_OBSERVER(UserActivityObserver, observers_, OnUserActivity(event)); last_observer_notification_time_ = now; } } } // namespace ui
axinging/chromium-crosswalk
ui/base/user_activity/user_activity_detector.cc
C++
bsd-3-clause
4,086
/**************************************************************************\ * Copyright (c) Kongsberg Oil & Gas Technologies AS * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of the copyright holder nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. \**************************************************************************/ #include <dime/convert/layerdata.h> #include <dime/Layer.h> /*! \class dxfLayerData layerdata.h \brief The dxfLayerData class handles all geometry for a given color index. DXF geometry is grouped into different colors, as this is a normal way to group geometry data, and especially vrml data. The geometry can be either points, lines or polygons. */ /*! Constructor */ dxfLayerData::dxfLayerData(const int colidx) { this->fillmode = true; this->colidx = colidx; } /*! Destructor. */ dxfLayerData::~dxfLayerData() { } /*! Sets the fillmode for this layer. If fillmode is set (the default) polylines with width and/or height will be converter to polygons and not lines. The same goes for the SOLID and TRACE entities. */ void dxfLayerData::setFillmode(const bool fillmode) { this->fillmode = fillmode; } /*! Adds a line to this layer's geometry. If \a matrix != NULL, the points will be transformed by this matrix before they are added. */ void dxfLayerData::addLine(const dimeVec3f &v0, const dimeVec3f &v1, const dimeMatrix * const matrix) { int i0, i1; if (matrix) { dimeVec3f t0, t1; matrix->multMatrixVec(v0, t0); matrix->multMatrixVec(v1, t1); i0 = linebsp.addPoint(t0); i1 = linebsp.addPoint(t1); } else { i0 = linebsp.addPoint(v0); i1 = linebsp.addPoint(v1); } // // take care of line strips (more effective than single lines) // if (lineindices.count() && lineindices[lineindices.count()-1] == i0) { lineindices.append(i1); } else { if (lineindices.count()) lineindices.append(-1); lineindices.append(i0); lineindices.append(i1); } } /*! Adds a point to this layer's geometry. If \a matrix != NULL, the point will be transformed by this matrix before they are added. */ void dxfLayerData::addPoint(const dimeVec3f &v, const dimeMatrix * const matrix) { if (matrix) { dimeVec3f t; matrix->multMatrixVec(v, t); points.append(t); } else { points.append(v); } } /*! Adds a triangle to this layer's geometry. If \a matrix != NULL, the points will be transformed by this matrix before they are added. */ void dxfLayerData::addTriangle(const dimeVec3f &v0, const dimeVec3f &v1, const dimeVec3f &v2, const dimeMatrix * const matrix) { if (this->fillmode) { if (matrix) { dimeVec3f t0, t1, t2; matrix->multMatrixVec(v0, t0); matrix->multMatrixVec(v1, t1); matrix->multMatrixVec(v2, t2); faceindices.append(facebsp.addPoint(t0)); faceindices.append(facebsp.addPoint(t1)); faceindices.append(facebsp.addPoint(t2)); faceindices.append(-1); } else { faceindices.append(facebsp.addPoint(v0)); faceindices.append(facebsp.addPoint(v1)); faceindices.append(facebsp.addPoint(v2)); faceindices.append(-1); } } else { this->addLine(v0, v1, matrix); this->addLine(v1, v2, matrix); this->addLine(v2, v0, matrix); } } /*! Adds a quad to this layer's geometry. If \a matrix != NULL, the points will be transformed by this matrix before they are added. */ void dxfLayerData::addQuad(const dimeVec3f &v0, const dimeVec3f &v1, const dimeVec3f &v2, const dimeVec3f &v3, const dimeMatrix * const matrix) { if (this->fillmode) { if (matrix) { dimeVec3f t0, t1, t2, t3; matrix->multMatrixVec(v0, t0); matrix->multMatrixVec(v1, t1); matrix->multMatrixVec(v2, t2); matrix->multMatrixVec(v3, t3); faceindices.append(facebsp.addPoint(t0)); faceindices.append(facebsp.addPoint(t1)); faceindices.append(facebsp.addPoint(t2)); faceindices.append(facebsp.addPoint(t3)); faceindices.append(-1); } else { faceindices.append(facebsp.addPoint(v0)); faceindices.append(facebsp.addPoint(v1)); faceindices.append(facebsp.addPoint(v2)); faceindices.append(facebsp.addPoint(v3)); faceindices.append(-1); } } else { this->addLine(v0, v1, matrix); this->addLine(v1, v2, matrix); this->addLine(v2, v3, matrix); this->addLine(v3, v0, matrix); } } /*! Exports this layer's geometry as vrml nodes. */ void dxfLayerData::writeWrl(FILE *fp, int indent, const bool vrml1, const bool only2d) { #ifndef NOWRLEXPORT if (!faceindices.count() && !lineindices.count() && !points.count()) return; int i, n; dxfdouble r,g,b; dimeLayer::colorToRGB(this->colidx, r, g, b); if (vrml1) { fprintf(fp, "Separator {\n"); } else { fprintf(fp, "Group {\n" " children [\n"); } if (faceindices.count()) { if (vrml1) { fprintf(fp, " Separator {\n" " Material {\n" " diffuseColor %g %g %g\n" " }\n" " ShapeHints {\n" " creaseAngle 0.5\n" " vertexOrdering COUNTERCLOCKWISE\n" " shapeType UNKNOWN_SHAPE_TYPE\n" " faceType UNKNOWN_FACE_TYPE\n" " }\n" " Coordinate3 {\n" " point [\n", r, g, b); } else { fprintf(fp, " Shape {\n" " appearance Appearance {\n" " material Material {\n" " diffuseColor %g %g %g\n" " }\n" " }\n" " geometry IndexedFaceSet {\n" " convex FALSE\n" " solid FALSE\n" " creaseAngle 0.5\n" // a good value for most cases " coord Coordinate {\n" " point [\n", r, g, b); } dimeVec3f v; n = facebsp.numPoints(); for (i = 0; i < n ; i++) { facebsp.getPoint(i, v); if (only2d) v[2] = 0.0f; if (i < n-1) fprintf(fp, " %.8g %.8g %.8g,\n", v[0], v[1], v[2]); else fprintf(fp, " %.8g %.8g %.8g\n", v[0], v[1], v[2]); } fprintf(fp, " ]\n" " }\n"); if (vrml1) { fprintf(fp, " IndexedFaceSet {\n" " coordIndex [\n "); } else { fprintf(fp, " coordIndex [\n "); } n = faceindices.count(); int cnt = 1; for (i = 0; i < n; i++) { if ((cnt & 7) && i < n-1) // typical case fprintf(fp, "%d,", faceindices[i]); else if (!(cnt & 7) && i < n-1) fprintf(fp, "%d,\n ", faceindices[i]); else fprintf(fp, "%d\n", faceindices[i]); cnt++; } fprintf(fp, " ]\n" " }\n" " }\n"); } if (lineindices.count()) { // make sure line indices has a -1 at the end if (lineindices[lineindices.count()-1] != -1) { lineindices.append(-1); } if (vrml1) { fprintf(fp, " Separator {\n" " Material {\n" " diffuseColor %g %g %g\n" " }\n" " Coordinate3 {\n" " point [\n", r, g, b); } else { fprintf(fp, " Shape {\n" " appearance Appearance {\n" " material Material {\n" " emissiveColor %g %g %g\n" " }\n" " }\n" " geometry IndexedLineSet {\n" " coord Coordinate {\n" " point [\n", r, g, b); } dimeVec3f v; n = linebsp.numPoints(); for (i = 0; i < n ; i++) { linebsp.getPoint(i, v); if (only2d) v[2] = 0.0f; if (i < n-1) fprintf(fp, " %.8g %.8g %.8g,\n", v[0], v[1], v[2]); else fprintf(fp, " %.8g %.8g %.8g\n", v[0], v[1], v[2]); } fprintf(fp, " ]\n" " }\n"); if (vrml1) { fprintf(fp, " IndexedLineSet {\n" " coordIndex [\n "); } else { fprintf(fp, " coordIndex [\n "); } n = lineindices.count(); int cnt = 1; for (i = 0; i < n; i++) { if ((cnt & 7) && i < n-1) // typical case fprintf(fp, "%d,", lineindices[i]); else if (!(cnt & 7) && i < n-1) fprintf(fp, "%d,\n ", lineindices[i]); else fprintf(fp, "%d\n", lineindices[i]); cnt++; } fprintf(fp, " ]\n" " }\n" " }\n"); } if (points.count() && 0) { // FIXME disabled, suspect bug. pederb, 2001-12-11 if (vrml1) { fprintf(fp, " Separator {\n" " Material {\n" " diffuseColor %g %g %g\n" " }\n" " Coordinate3 {\n" " point [\n", r, g, b); } else { fprintf(fp, " Shape {\n" " appearance Appearance {\n" " material Material {\n" " emissiveColor %g %g %g\n" " }\n" " \n" " geometry PointSet {\n" " coord Coordinate {\n" " point [\n", r, g, b); } dimeVec3f v; n = points.count(); for (i = 0; i < n ; i++) { v = points[i]; if (only2d) v[2] = 0.0f; if (i < n-1) fprintf(fp, " %g %g %g,\n", v[0], v[1], v[2]); else fprintf(fp, " %g %g %g\n", v[0], v[1], v[2]); } fprintf(fp, " ]\n" " }\n"); if (vrml1) { fprintf(fp, " PointSet {\n" " numPoints %d\n" " }\n" " }\n", points.count()); } else { fprintf(fp, " }\n" " }\n"); } } if (vrml1) { fprintf(fp, "}\n"); } else { fprintf(fp, " ]\n" "}\n"); } #endif // NOWRLEXPORT }
weiznich/dime
src/convert/layerdata.cpp
C++
bsd-3-clause
11,742
# Copyright 2012 The Swarming Authors. All rights reserved. # Use of this source code is governed under the Apache License, Version 2.0 that # can be found in the LICENSE file. import datetime import getpass import optparse import os import subprocess import sys ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) sys.path.append(os.path.join(ROOT_DIR, '..', 'third_party')) import colorama CHROMIUM_SWARMING_OSES = { 'darwin': 'Mac', 'cygwin': 'Windows', 'linux2': 'Linux', 'win32': 'Windows', } def parse_args(use_isolate_server, use_swarming): """Process arguments for the example scripts.""" os.chdir(ROOT_DIR) colorama.init() parser = optparse.OptionParser(description=sys.modules['__main__'].__doc__) if use_isolate_server: parser.add_option( '-I', '--isolate-server', metavar='URL', default=os.environ.get('ISOLATE_SERVER', ''), help='Isolate server to use') if use_swarming: task_name = '%s-%s-hello_world' % ( getpass.getuser(), datetime.datetime.now().strftime('%Y-%m-%d-%H-%M-%S')) parser.add_option( '--idempotent', action='store_true', help='Tells Swarming to reused previous task result if possible') parser.add_option( '-S', '--swarming', metavar='URL', default=os.environ.get('SWARMING_SERVER', ''), help='Swarming server to use') parser.add_option( '-o', '--os', default=sys.platform, help='Swarming slave OS to request. Should be one of the valid ' 'sys.platform values like darwin, linux2 or win32 default: ' '%default.') parser.add_option( '-t', '--task-name', default=task_name, help='Swarming task name, default is based on time: %default') parser.add_option('-v', '--verbose', action='count', default=0) parser.add_option( '--priority', metavar='INT', type='int', help='Priority to use') options, args = parser.parse_args() if args: parser.error('Unsupported argument %s' % args) if use_isolate_server and not options.isolate_server: parser.error('--isolate-server is required.') if use_swarming: if not options.swarming: parser.error('--swarming is required.') options.swarming_os = CHROMIUM_SWARMING_OSES[options.os] del options.os return options def note(text): """Prints a formatted note.""" print( colorama.Fore.YELLOW + colorama.Style.BRIGHT + '\n-> ' + text + colorama.Fore.RESET) def run(cmd, verbose): """Prints the command it runs then run it.""" cmd = cmd[:] cmd.extend(['--verbose'] * verbose) print( 'Running: %s%s%s' % (colorama.Fore.GREEN, ' '.join(cmd), colorama.Fore.RESET)) cmd = [sys.executable, os.path.join('..', cmd[0])] + cmd[1:] if sys.platform != 'win32': cmd = ['time', '-p'] + cmd subprocess.check_call(cmd) def capture(cmd): """Prints the command it runs then return stdout.""" print( 'Running: %s%s%s' % (colorama.Fore.GREEN, ' '.join(cmd), colorama.Fore.RESET)) cmd = [sys.executable, os.path.join('..', cmd[0])] + cmd[1:] return subprocess.check_output(cmd)
CTSRD-SOAAP/chromium-42.0.2311.135
tools/swarming_client/example/common.py
Python
bsd-3-clause
3,130
<?php //Set the default time zone date_default_timezone_set("Europe/London"); echo "*** Testing basic DateTime inheritance() ***\n"; class DateTimeExt extends DateTime { public static $format = "F j, Y, g:i:s a"; public function __toString() { return parent::format(self::$format); } } echo "\n-- Create an instance of DateTimeExt --\n"; $d = new DateTimeExt("1967-05-01 22:30:41"); echo "\n-- Invoke __toString --\n"; echo $d . "\n"; echo "\n -- modify date and time --\n"; $d->setDate(1963, 7, 2); $d->setTime(10, 45, 30); echo "\n-- Invoke __toString again --\n"; echo $d . "\n"; ?> ===DONE===
JSchwehn/php
testdata/fuzzdir/corpus/ext_date_tests_DateTime_extends_basic1.php
PHP
bsd-3-clause
617
# -*- coding: utf-8 -*- # Copyright 2013 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Additional help about types of credentials and authentication.""" from __future__ import absolute_import from __future__ import print_function from __future__ import division from __future__ import unicode_literals from gslib.help_provider import HelpProvider _DETAILED_HELP_TEXT = (""" <B>OVERVIEW</B> gsutil currently supports several types of credentials/authentication, as well as the ability to `access public data anonymously <https://cloud.google.com/storage/docs/access-public-data>`_. Each of these type of credentials is discussed in more detail below, along with information about configuring and using credentials via either the Cloud SDK or standalone installations of gsutil. <B>Configuring/Using Credentials via Cloud SDK Distribution of gsutil</B> When gsutil is installed/used via the Cloud SDK ("gcloud"), credentials are stored by Cloud SDK in a non-user-editable file located under ~/.config/gcloud (any manipulation of credentials should be done via the gcloud auth command). If you need to set up multiple credentials (e.g., one for an individual user account and a second for a service account), the gcloud auth command manages the credentials for you, and you switch between credentials using the gcloud auth command as well (for more details see https://cloud.google.com/sdk/gcloud/reference/auth). Once credentials have been configured via gcloud auth, those credentials will be used regardless of whether the user has any boto configuration files (which are located at ~/.boto unless a different path is specified in the BOTO_CONFIG environment variable). However, gsutil will still look for credentials in the boto config file if a type of non-GCS credential is needed that's not stored in the gcloud credential store (e.g., an HMAC credential for an S3 account). <B>Configuring/Using Credentials via Standalone gsutil Distribution</B> If you installed a standalone distribution of gsutil (downloaded from https://pub.storage.googleapis.com/gsutil.tar.gz, https://pub.storage.googleapis.com/gsutil.zip, or PyPi), credentials are configured using the gsutil config command, and are stored in the user-editable boto config file (located at ~/.boto unless a different path is specified in the BOTO_CONFIG environment). In this case if you want to set up multiple credentials (e.g., one for an individual user account and a second for a service account), you run gsutil config once for each credential, and save each of the generated boto config files (e.g., renaming one to ~/.boto_user_account and the second to ~/.boto_service_account), and you switch between the credentials using the BOTO_CONFIG environment variable (e.g., by running BOTO_CONFIG=~/.boto_user_account gsutil ls). Note that when using the standalone version of gsutil with the JSON API you can configure at most one of the following types of Google Cloud Storage credentials in a single boto config file: OAuth2 User Account, OAuth2 Service Account. In addition to these, you may also have S3 HMAC credentials (necessary for using s3:// URLs) and Google Compute Engine Internal Service Account credentials. Google Compute Engine Internal Service Account credentials are used only when OAuth2 credentials are not present. <B>SUPPORTED CREDENTIAL TYPES</B> gsutil supports several types of credentials (the specific subset depends on which distribution of gsutil you are using; see above discussion). OAuth2 User Account: This is the preferred type of credentials for authenticating requests on behalf of a specific user (which is probably the most common use of gsutil). This is the default type of credential that will be created when you run "gsutil config" (or "gcloud init" for Cloud SDK installs). For more details about OAuth2 authentication, see: https://developers.google.com/accounts/docs/OAuth2#scenarios HMAC: This type of credential can be used by programs that are implemented using HMAC authentication, which is an authentication mechanism supported by certain other cloud storage service providers. This type of credential can also be used for interactive use when moving data to/from service providers that support HMAC credentials. This is the type of credential that will be created when you run "gsutil config -a". Note that it's possible to set up HMAC credentials for both Google Cloud Storage and another service provider; or to set up OAuth2 user account credentials for Google Cloud Storage and HMAC credentials for another service provider. To do so, after you run the "gsutil config" command (or "gcloud init" for Cloud SDK installs), you can edit the generated ~/.boto config file and look for comments for where other credentials can be added. For more details about HMAC authentication, see: https://developers.google.com/storage/docs/reference/v1/getting-startedv1#keys OAuth2 Service Account: This is the preferred type of credential to use when authenticating on behalf of a service or application (as opposed to a user). For example, if you will run gsutil out of a nightly cron job to upload/download data, using a service account allows the cron job not to depend on credentials of an individual employee at your company. This is the type of credential that will be configured when you run "gsutil config -e". To configure service account credentials when installed via the Cloud SDK, run "gcloud auth activate-service-account". It is important to note that a service account is considered an Editor by default for the purposes of API access, rather than an Owner. In particular, the fact that Editors have OWNER access in the default object and bucket ACLs, but the canned ACL options remove OWNER access from Editors, can lead to unexpected results. The solution to this problem is to use "gsutil acl ch" instead of "gsutil acl set <canned-ACL>" to change permissions on a bucket. To set up a service account for use with "gsutil config -e" or "gcloud auth activate-service-account", see: https://cloud.google.com/storage/docs/authentication#generating-a-private-key For more details about OAuth2 service accounts, see: https://developers.google.com/accounts/docs/OAuth2ServiceAccount For further information about account roles, see: https://developers.google.com/console/help/#DifferentRoles Google Compute Engine Internal Service Account: This is the type of service account used for accounts hosted by App Engine or Google Compute Engine. Such credentials are created automatically for you on Google Compute Engine when you run the gcloud compute instances creates command and the credentials can be controlled with the --scopes flag. For more details about Google Compute Engine service accounts, see: https://developers.google.com/compute/docs/authentication; For more details about App Engine service accounts, see: https://developers.google.com/appengine/docs/python/appidentity/overview Service Account Impersonation: Impersonating a service account is useful in scenarios where you need to grant short-term access to specific resources. For example, if you have a bucket of sensitive data that is typically read-only and want to temporarily grant write access through a trusted service account. You can specify which service account to use for impersonation by running "gsutil -i", "gsutil config" and editing the boto configuration file, or "gcloud config set auth/impersonate_service_account". In order to impersonate, your original credentials need to be granted roles/iam.serviceAccountTokenCreator on the target service account. For more information see: https://cloud.google.com/iam/docs/creating-short-lived-service-account-credentials """) class CommandOptions(HelpProvider): """Additional help about types of credentials and authentication.""" # Help specification. See help_provider.py for documentation. help_spec = HelpProvider.HelpSpec( help_name='creds', help_name_aliases=['credentials', 'authentication', 'auth', 'gcloud'], help_type='additional_help', help_one_line_summary='Credential Types Supporting Various Use Cases', help_text=_DETAILED_HELP_TEXT, subcommand_help_text={}, )
catapult-project/catapult
third_party/gsutil/gslib/addlhelp/creds.py
Python
bsd-3-clause
9,088
<?php /** * Zend Framework * * LICENSE * * This source file is subject to the new BSD license that is bundled * with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://framework.zend.com/license/new-bsd * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * @category Zend * @package Zend_View * @subpackage Helper * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @version $Id$ * @license http://framework.zend.com/license/new-bsd New BSD License */ /** Zend_View_Helper_Placeholder_Container_Standalone */ // require_once 'Zend/View/Helper/Placeholder/Container/Standalone.php'; /** * Helper for setting and retrieving stylesheets * * @uses Zend_View_Helper_Placeholder_Container_Standalone * @package Zend_View * @subpackage Helper * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License */ class Zend_View_Helper_HeadStyle extends Zend_View_Helper_Placeholder_Container_Standalone { /** * Registry key for placeholder * @var string */ protected $_regKey = 'Zend_View_Helper_HeadStyle'; /** * Allowed optional attributes * @var array */ protected $_optionalAttributes = array('lang', 'title', 'media', 'dir'); /** * Allowed media types * @var array */ protected $_mediaTypes = array( 'all', 'aural', 'braille', 'handheld', 'print', 'projection', 'screen', 'tty', 'tv' ); /** * Capture type and/or attributes (used for hinting during capture) * @var string */ protected $_captureAttrs = null; /** * Capture lock * @var bool */ protected $_captureLock; /** * Capture type (append, prepend, set) * @var string */ protected $_captureType; /** * Constructor * * Set separator to PHP_EOL. * * @return void */ public function __construct() { parent::__construct(); $this->setSeparator(PHP_EOL); } /** * Return headStyle object * * Returns headStyle helper object; optionally, allows specifying * * @param string $content Stylesheet contents * @param string $placement Append, prepend, or set * @param string|array $attributes Optional attributes to utilize * @return Zend_View_Helper_HeadStyle */ public function headStyle($content = null, $placement = 'APPEND', $attributes = array()) { if ((null !== $content) && is_string($content)) { switch (strtoupper($placement)) { case 'SET': $action = 'setStyle'; break; case 'PREPEND': $action = 'prependStyle'; break; case 'APPEND': default: $action = 'appendStyle'; break; } $this->$action($content, $attributes); } return $this; } /** * Overload method calls * * Allows the following method calls: * - appendStyle($content, $attributes = array()) * - offsetSetStyle($index, $content, $attributes = array()) * - prependStyle($content, $attributes = array()) * - setStyle($content, $attributes = array()) * * @param string $method * @param array $args * @return void * @throws Zend_View_Exception When no $content provided or invalid method */ public function __call($method, $args) { if (preg_match('/^(?P<action>set|(ap|pre)pend|offsetSet)(Style)$/', $method, $matches)) { $index = null; $argc = count($args); $action = $matches['action']; if ('offsetSet' == $action) { if (0 < $argc) { $index = array_shift($args); --$argc; } } if (1 > $argc) { // require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception(sprintf('Method "%s" requires minimally content for the stylesheet', $method)); $e->setView($this->view); throw $e; } $content = $args[0]; $attrs = array(); if (isset($args[1])) { $attrs = (array) $args[1]; } $item = $this->createData($content, $attrs); if ('offsetSet' == $action) { $this->offsetSet($index, $item); } else { $this->$action($item); } return $this; } return parent::__call($method, $args); } /** * Determine if a value is a valid style tag * * @param mixed $value * @param string $method * @return boolean */ protected function _isValid($value) { if ((!$value instanceof stdClass) || !isset($value->content) || !isset($value->attributes)) { return false; } return true; } /** * Override append to enforce style creation * * @param mixed $value * @return void */ public function append($value) { if (!$this->_isValid($value)) { // require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to append; please use appendStyle()'); $e->setView($this->view); throw $e; } return $this->getContainer()->append($value); } /** * Override offsetSet to enforce style creation * * @param string|int $index * @param mixed $value * @return void */ public function offsetSet($index, $value) { if (!$this->_isValid($value)) { // require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to offsetSet; please use offsetSetStyle()'); $e->setView($this->view); throw $e; } return $this->getContainer()->offsetSet($index, $value); } /** * Override prepend to enforce style creation * * @param mixed $value * @return void */ public function prepend($value) { if (!$this->_isValid($value)) { // require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to prepend; please use prependStyle()'); $e->setView($this->view); throw $e; } return $this->getContainer()->prepend($value); } /** * Override set to enforce style creation * * @param mixed $value * @return void */ public function set($value) { if (!$this->_isValid($value)) { // require_once 'Zend/View/Exception.php'; $e = new Zend_View_Exception('Invalid value passed to set; please use setStyle()'); $e->setView($this->view); throw $e; } return $this->getContainer()->set($value); } /** * Start capture action * * @param mixed $captureType * @param string $typeOrAttrs * @return void */ public function captureStart($type = Zend_View_Helper_Placeholder_Container_Abstract::APPEND, $attrs = null) { if ($this->_captureLock) { // require_once 'Zend/View/Helper/Placeholder/Container/Exception.php'; $e = new Zend_View_Helper_Placeholder_Container_Exception('Cannot nest headStyle captures'); $e->setView($this->view); throw $e; } $this->_captureLock = true; $this->_captureAttrs = $attrs; $this->_captureType = $type; ob_start(); } /** * End capture action and store * * @return void */ public function captureEnd() { $content = ob_get_clean(); $attrs = $this->_captureAttrs; $this->_captureAttrs = null; $this->_captureLock = false; switch ($this->_captureType) { case Zend_View_Helper_Placeholder_Container_Abstract::SET: $this->setStyle($content, $attrs); break; case Zend_View_Helper_Placeholder_Container_Abstract::PREPEND: $this->prependStyle($content, $attrs); break; case Zend_View_Helper_Placeholder_Container_Abstract::APPEND: default: $this->appendStyle($content, $attrs); break; } } /** * Convert content and attributes into valid style tag * * @param stdClass $item Item to render * @param string $indent Indentation to use * @return string */ public function itemToString(stdClass $item, $indent) { $attrString = ''; if (!empty($item->attributes)) { $enc = 'UTF-8'; if ($this->view instanceof Zend_View_Interface && method_exists($this->view, 'getEncoding') ) { $enc = $this->view->getEncoding(); } foreach ($item->attributes as $key => $value) { if (!in_array($key, $this->_optionalAttributes)) { continue; } if ('media' == $key) { if(false === strpos($value, ',')) { if (!in_array($value, $this->_mediaTypes)) { continue; } } else { $media_types = explode(',', $value); $value = ''; foreach($media_types as $type) { $type = trim($type); if (!in_array($type, $this->_mediaTypes)) { continue; } $value .= $type .','; } $value = substr($value, 0, -1); } } $attrString .= sprintf(' %s="%s"', $key, htmlspecialchars($value, ENT_COMPAT, $enc)); } } $escapeStart = $indent . '<!--'. PHP_EOL; $escapeEnd = $indent . '-->'. PHP_EOL; if (isset($item->attributes['conditional']) && !empty($item->attributes['conditional']) && is_string($item->attributes['conditional']) ) { $escapeStart = null; $escapeEnd = null; } $html = '<style type="text/css"' . $attrString . '>' . PHP_EOL . $escapeStart . $indent . $item->content . PHP_EOL . $escapeEnd . '</style>'; if (null == $escapeStart && null == $escapeEnd) { $html = '<!--[if ' . $item->attributes['conditional'] . ']> ' . $html . '<![endif]-->'; } return $html; } /** * Create string representation of placeholder * * @param string|int $indent * @return string */ public function toString($indent = null) { $indent = (null !== $indent) ? $this->getWhitespace($indent) : $this->getIndent(); $items = array(); $this->getContainer()->ksort(); foreach ($this as $item) { if (!$this->_isValid($item)) { continue; } $items[] = $this->itemToString($item, $indent); } $return = $indent . implode($this->getSeparator() . $indent, $items); $return = preg_replace("/(\r\n?|\n)/", '$1' . $indent, $return); return $return; } /** * Create data item for use in stack * * @param string $content * @param array $attributes * @return stdClass */ public function createData($content, array $attributes) { if (!isset($attributes['media'])) { $attributes['media'] = 'screen'; } else if(is_array($attributes['media'])) { $attributes['media'] = implode(',', $attributes['media']); } $data = new stdClass(); $data->content = $content; $data->attributes = $attributes; return $data; } }
jnstr/pimcore
pimcore/lib/Zend/View/Helper/HeadStyle.php
PHP
bsd-3-clause
12,630
/****************************************************************************** * * Module Name: dmtbinfo - Table info for non-AML tables * *****************************************************************************/ /* * Copyright (C) 2000 - 2011, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions, and the following disclaimer, * without modification. * 2. Redistributions in binary form must reproduce at minimum a disclaimer * substantially similar to the "NO WARRANTY" disclaimer below * ("Disclaimer") and any redistribution must be conditioned upon * including a substantially similar Disclaimer requirement for further * binary redistribution. * 3. Neither the names of the above-listed copyright holders nor the names * of any contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * Alternatively, this software may be distributed under the terms of the * GNU General Public License ("GPL") version 2 as published by the Free * Software Foundation. * * NO WARRANTY * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGES. */ #include <contrib/dev/acpica/include/acpi.h> #include <contrib/dev/acpica/include/accommon.h> #include <contrib/dev/acpica/include/acdisasm.h> /* This module used for application-level code only */ #define _COMPONENT ACPI_CA_DISASSEMBLER ACPI_MODULE_NAME ("dmtbinfo") /* * How to add a new table: * * - Add the C table definition to the actbl1.h or actbl2.h header. * - Add ACPI_xxxx_OFFSET macro(s) for the table (and subtables) to list below. * - Define the table in this file (for the disassembler). If any * new data types are required (ACPI_DMT_*), see below. * - Add an external declaration for the new table definition (AcpiDmTableInfo*) * in acdisam.h * - Add new table definition to the dispatch table in dmtable.c (AcpiDmTableData) * If a simple table (with no subtables), no disassembly code is needed. * Otherwise, create the AcpiDmDump* function for to disassemble the table * and add it to the dmtbdump.c file. * - Add an external declaration for the new AcpiDmDump* function in acdisasm.h * - Add the new AcpiDmDump* function to the dispatch table in dmtable.c * - Create a template for the new table * - Add data table compiler support * * How to add a new data type (ACPI_DMT_*): * * - Add new type at the end of the ACPI_DMT list in acdisasm.h * - Add length and implementation cases in dmtable.c (disassembler) * - Add type and length cases in dtutils.c (DT compiler) */ /* * Macros used to generate offsets to specific table fields */ #define ACPI_FACS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_FACS,f) #define ACPI_GAS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_GENERIC_ADDRESS,f) #define ACPI_HDR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEADER,f) #define ACPI_RSDP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_RSDP,f) #define ACPI_BOOT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BOOT,f) #define ACPI_BERT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_BERT,f) #define ACPI_CPEP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_CPEP,f) #define ACPI_DBGP_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DBGP,f) #define ACPI_DMAR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_DMAR,f) #define ACPI_ECDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ECDT,f) #define ACPI_EINJ_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_EINJ,f) #define ACPI_ERST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_ERST,f) #define ACPI_HEST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HEST,f) #define ACPI_HPET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_HPET,f) #define ACPI_IVRS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_IVRS,f) #define ACPI_MADT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MADT,f) #define ACPI_MCFG_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCFG,f) #define ACPI_MCHI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MCHI,f) #define ACPI_MSCT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_MSCT,f) #define ACPI_SBST_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SBST,f) #define ACPI_SLIT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SLIT,f) #define ACPI_SPCR_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPCR,f) #define ACPI_SPMI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SPMI,f) #define ACPI_SRAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_SRAT,f) #define ACPI_TCPA_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_TCPA,f) #define ACPI_UEFI_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_UEFI,f) #define ACPI_WAET_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WAET,f) #define ACPI_WDAT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDAT,f) #define ACPI_WDDT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDDT,f) #define ACPI_WDRT_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_TABLE_WDRT,f) /* Subtables */ #define ACPI_ASF0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_INFO,f) #define ACPI_ASF1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT,f) #define ACPI_ASF1a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ALERT_DATA,f) #define ACPI_ASF2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_REMOTE,f) #define ACPI_ASF2a_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_CONTROL_DATA,f) #define ACPI_ASF3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_RMCP,f) #define ACPI_ASF4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_ASF_ADDRESS,f) #define ACPI_CPEP0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_CPEP_POLLING,f) #define ACPI_DMARS_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_DEVICE_SCOPE,f) #define ACPI_DMAR0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_HARDWARE_UNIT,f) #define ACPI_DMAR1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RESERVED_MEMORY,f) #define ACPI_DMAR2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_ATSR,f) #define ACPI_DMAR3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_DMAR_RHSA,f) #define ACPI_EINJ0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) #define ACPI_ERST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WHEA_HEADER,f) #define ACPI_HEST0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f) #define ACPI_HEST1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_CORRECTED,f) #define ACPI_HEST2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_NMI,f) #define ACPI_HEST6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_ROOT,f) #define ACPI_HEST7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER,f) #define ACPI_HEST8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_AER_BRIDGE,f) #define ACPI_HEST9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_GENERIC,f) #define ACPI_HESTN_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_NOTIFY,f) #define ACPI_HESTB_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_HEST_IA_ERROR_BANK,f) #define ACPI_IVRSH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HEADER,f) #define ACPI_IVRS0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_HARDWARE,f) #define ACPI_IVRS1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_MEMORY,f) #define ACPI_IVRSD_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DE_HEADER,f) #define ACPI_IVRS8A_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8A,f) #define ACPI_IVRS8B_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8B,f) #define ACPI_IVRS8C_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_IVRS_DEVICE8C,f) #define ACPI_MADT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC,f) #define ACPI_MADT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_APIC,f) #define ACPI_MADT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f) #define ACPI_MADT3_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_NMI_SOURCE,f) #define ACPI_MADT4_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f) #define ACPI_MADT5_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_APIC_OVERRIDE,f) #define ACPI_MADT6_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_IO_SAPIC,f) #define ACPI_MADT7_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_SAPIC,f) #define ACPI_MADT8_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f) #define ACPI_MADT9_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC,f) #define ACPI_MADT10_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f) #define ACPI_MADTH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_MCFG0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MCFG_ALLOCATION,f) #define ACPI_MSCT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_MSCT_PROXIMITY,f) #define ACPI_SLICH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_HEADER,f) #define ACPI_SLIC0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_KEY,f) #define ACPI_SLIC1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SLIC_MARKER,f) #define ACPI_SRATH_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SUBTABLE_HEADER,f) #define ACPI_SRAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_CPU_AFFINITY,f) #define ACPI_SRAT1_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_MEM_AFFINITY,f) #define ACPI_SRAT2_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f) #define ACPI_WDAT0_OFFSET(f) (UINT8) ACPI_OFFSET (ACPI_WDAT_ENTRY,f) /* * Simplify access to flag fields by breaking them up into bytes */ #define ACPI_FLAG_OFFSET(d,f,o) (UINT8) (ACPI_OFFSET (d,f) + o) /* Flags */ #define ACPI_FADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FADT,f,o) #define ACPI_FACS_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_FACS,f,o) #define ACPI_HPET_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_HPET,f,o) #define ACPI_SRAT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_CPU_AFFINITY,f,o) #define ACPI_SRAT1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_MEM_AFFINITY,f,o) #define ACPI_SRAT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_SRAT_X2APIC_CPU_AFFINITY,f,o) #define ACPI_MADT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_MADT,f,o) #define ACPI_MADT0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC,f,o) #define ACPI_MADT2_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_OVERRIDE,f,o) #define ACPI_MADT3_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_NMI_SOURCE,f,o) #define ACPI_MADT4_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_APIC_NMI,f,o) #define ACPI_MADT7_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_SAPIC,f,o) #define ACPI_MADT8_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_INTERRUPT_SOURCE,f,o) #define ACPI_MADT9_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC,f,o) #define ACPI_MADT10_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_MADT_LOCAL_X2APIC_NMI,f,o) #define ACPI_WDDT_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_TABLE_WDDT,f,o) #define ACPI_EINJ0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) #define ACPI_ERST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_WHEA_HEADER,f,o) #define ACPI_HEST0_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_MACHINE_CHECK,f,o) #define ACPI_HEST1_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_IA_CORRECTED,f,o) #define ACPI_HEST6_FLAG_OFFSET(f,o) ACPI_FLAG_OFFSET (ACPI_HEST_AER_ROOT,f,o) /* * Required terminator for all tables below */ #define ACPI_DMT_TERMINATOR {ACPI_DMT_EXIT, 0, NULL, 0} /* * ACPI Table Information, used to dump formatted ACPI tables * * Each entry is of the form: <Field Type, Field Offset, Field Name> */ /******************************************************************************* * * Common ACPI table header * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoHeader[] = { {ACPI_DMT_SIG, ACPI_HDR_OFFSET (Signature[0]), "Signature", 0}, {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (Length), "Table Length", DT_LENGTH}, {ACPI_DMT_UINT8, ACPI_HDR_OFFSET (Revision), "Revision", 0}, {ACPI_DMT_CHKSUM, ACPI_HDR_OFFSET (Checksum), "Checksum", 0}, {ACPI_DMT_NAME6, ACPI_HDR_OFFSET (OemId[0]), "Oem ID", 0}, {ACPI_DMT_NAME8, ACPI_HDR_OFFSET (OemTableId[0]), "Oem Table ID", 0}, {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (OemRevision), "Oem Revision", 0}, {ACPI_DMT_NAME4, ACPI_HDR_OFFSET (AslCompilerId[0]), "Asl Compiler ID", 0}, {ACPI_DMT_UINT32, ACPI_HDR_OFFSET (AslCompilerRevision), "Asl Compiler Revision", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * GAS - Generic Address Structure * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoGas[] = { {ACPI_DMT_SPACEID, ACPI_GAS_OFFSET (SpaceId), "Space ID", 0}, {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitWidth), "Bit Width", 0}, {ACPI_DMT_UINT8, ACPI_GAS_OFFSET (BitOffset), "Bit Offset", 0}, {ACPI_DMT_ACCWIDTH, ACPI_GAS_OFFSET (AccessWidth), "Encoded Access Width", 0}, {ACPI_DMT_UINT64, ACPI_GAS_OFFSET (Address), "Address", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * RSDP - Root System Description Pointer (Signature is "RSD PTR ") * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp1[] = { {ACPI_DMT_NAME8, ACPI_RSDP_OFFSET (Signature[0]), "Signature", 0}, {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Checksum), "Checksum", 0}, {ACPI_DMT_NAME6, ACPI_RSDP_OFFSET (OemId[0]), "Oem ID", 0}, {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (Revision), "Revision", 0}, {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (RsdtPhysicalAddress), "RSDT Address", 0}, ACPI_DMT_TERMINATOR }; /* ACPI 2.0+ Extensions */ ACPI_DMTABLE_INFO AcpiDmTableInfoRsdp2[] = { {ACPI_DMT_UINT32, ACPI_RSDP_OFFSET (Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT64, ACPI_RSDP_OFFSET (XsdtPhysicalAddress), "XSDT Address", 0}, {ACPI_DMT_UINT8, ACPI_RSDP_OFFSET (ExtendedChecksum), "Extended Checksum", 0}, {ACPI_DMT_UINT24, ACPI_RSDP_OFFSET (Reserved[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * FACS - Firmware ACPI Control Structure * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoFacs[] = { {ACPI_DMT_NAME4, ACPI_FACS_OFFSET (Signature[0]), "Signature", 0}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (HardwareSignature), "Hardware Signature", 0}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (FirmwareWakingVector), "32 Firmware Waking Vector", 0}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (GlobalLock), "Global Lock", 0}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (Flags,0), "S4BIOS Support Present", 0}, {ACPI_DMT_FLAG1, ACPI_FACS_FLAG_OFFSET (Flags,0), "64-bit Wake Supported (V2)", 0}, {ACPI_DMT_UINT64, ACPI_FACS_OFFSET (XFirmwareWakingVector), "64 Firmware Waking Vector", 0}, {ACPI_DMT_UINT8, ACPI_FACS_OFFSET (Version), "Version", 0}, {ACPI_DMT_UINT24, ACPI_FACS_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_FACS_OFFSET (OspmFlags), "OspmFlags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_FACS_FLAG_OFFSET (OspmFlags,0), "64-bit Wake Env Required (V2)", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * FADT - Fixed ACPI Description Table (Signature is FACP) * ******************************************************************************/ /* ACPI 1.0 FADT (Version 1) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt1[] = { {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Facs), "FACS Address", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Dsdt), "DSDT Address", DT_NON_ZERO}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Model), "Model", 0}, {ACPI_DMT_FADTPM, ACPI_FADT_OFFSET (PreferredProfile), "PM Profile", 0}, {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (SciInterrupt), "SCI Interrupt", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (SmiCommand), "SMI Command Port", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiEnable), "ACPI Enable Value", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (AcpiDisable), "ACPI Disable Value", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (S4BiosRequest), "S4BIOS Command", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PstateControl), "P-State Control", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aEventBlock), "PM1A Event Block Address", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bEventBlock), "PM1B Event Block Address", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1aControlBlock), "PM1A Control Block Address", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm1bControlBlock), "PM1B Control Block Address", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Pm2ControlBlock), "PM2 Control Block Address", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (PmTimerBlock), "PM Timer Block Address", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe0Block), "GPE0 Block Address", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Gpe1Block), "GPE1 Block Address", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1EventLength), "PM1 Event Block Length", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm1ControlLength), "PM1 Control Block Length", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Pm2ControlLength), "PM2 Control Block Length", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (PmTimerLength), "PM Timer Block Length", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe0BlockLength), "GPE0 Block Length", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1BlockLength), "GPE1 Block Length", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Gpe1Base), "GPE1 Base Offset", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (CstControl), "_CST Support", 0}, {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C2Latency), "C2 Latency", 0}, {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (C3Latency), "C3 Latency", 0}, {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushSize), "CPU Cache Size", 0}, {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (FlushStride), "Cache Flush Stride", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyOffset), "Duty Cycle Offset", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DutyWidth), "Duty Cycle Width", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (DayAlarm), "RTC Day Alarm Index", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (MonthAlarm), "RTC Month Alarm Index", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Century), "RTC Century Index", 0}, {ACPI_DMT_UINT16, ACPI_FADT_OFFSET (BootFlags), "Boot Flags (decoded below)", DT_FLAG}, /* Boot Architecture Flags byte 0 */ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "Legacy Devices Supported (V2)", 0}, {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "8042 Present on ports 60/64 (V2)", 0}, {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "VGA Not Present (V4)", 0}, {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "MSI Not Supported (V4)", 0}, {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (BootFlags,0), "PCIe ASPM Not Supported (V4)", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_FADT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, /* Flags byte 0 */ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD instruction is operational (V1)", 0}, {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,0), "WBINVD flushes all caches (V1)", 0}, {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,0), "All CPUs support C1 (V1)", 0}, {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,0), "C2 works on MP system (V1)", 0}, {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Power Button (V1)", 0}, {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,0), "Control Method Sleep Button (V1)", 0}, {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC wake not in fixed reg space (V1)", 0}, {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,0), "RTC can wake system from S4 (V1)", 0}, /* Flags byte 1 */ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,1), "32-bit PM Timer (V1)", 0}, {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,1), "Docking Supported (V1)", 0}, {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,1), "Reset Register Supported (V2)", 0}, {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,1), "Sealed Case (V3)", 0}, {ACPI_DMT_FLAG4, ACPI_FADT_FLAG_OFFSET (Flags,1), "Headless - No Video (V3)", 0}, {ACPI_DMT_FLAG5, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use native instr after SLP_TYPx (V3)", 0}, {ACPI_DMT_FLAG6, ACPI_FADT_FLAG_OFFSET (Flags,1), "PCIEXP_WAK Bits Supported (V4)", 0}, {ACPI_DMT_FLAG7, ACPI_FADT_FLAG_OFFSET (Flags,1), "Use Platform Timer (V4)", 0}, /* Flags byte 2 */ {ACPI_DMT_FLAG0, ACPI_FADT_FLAG_OFFSET (Flags,2), "RTC_STS valid on S4 wake (V4)", 0}, {ACPI_DMT_FLAG1, ACPI_FADT_FLAG_OFFSET (Flags,2), "Remote Power-on capable (V4)", 0}, {ACPI_DMT_FLAG2, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Cluster Model (V4)", 0}, {ACPI_DMT_FLAG3, ACPI_FADT_FLAG_OFFSET (Flags,2), "Use APIC Physical Destination Mode (V4)", 0}, ACPI_DMT_TERMINATOR }; /* ACPI 1.0 MS Extensions (FADT version 2) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt2[] = { {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* ACPI 2.0+ Extensions (FADT version 3+) */ ACPI_DMTABLE_INFO AcpiDmTableInfoFadt3[] = { {ACPI_DMT_GAS, ACPI_FADT_OFFSET (ResetRegister), "Reset Register", 0}, {ACPI_DMT_UINT8, ACPI_FADT_OFFSET (ResetValue), "Value to cause reset", 0}, {ACPI_DMT_UINT24, ACPI_FADT_OFFSET (Reserved4[0]), "Reserved", 0}, {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XFacs), "FACS Address", 0}, {ACPI_DMT_UINT64, ACPI_FADT_OFFSET (XDsdt), "DSDT Address", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aEventBlock), "PM1A Event Block", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bEventBlock), "PM1B Event Block", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1aControlBlock), "PM1A Control Block", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm1bControlBlock), "PM1B Control Block", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPm2ControlBlock), "PM2 Control Block", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XPmTimerBlock), "PM Timer Block", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe0Block), "GPE0 Block", 0}, {ACPI_DMT_GAS, ACPI_FADT_OFFSET (XGpe1Block), "GPE1 Block", 0}, ACPI_DMT_TERMINATOR }; /* * Remaining tables are not consumed directly by the ACPICA subsystem */ /******************************************************************************* * * ASF - Alert Standard Format table (Signature "ASF!") * ******************************************************************************/ /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsfHdr[] = { {ACPI_DMT_ASF, ACPI_ASF0_OFFSET (Header.Type), "Subtable Type", 0}, {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Header.Reserved), "Reserved", 0}, {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (Header.Length), "Length", DT_LENGTH}, ACPI_DMT_TERMINATOR }; /* 0: ASF Information */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf0[] = { {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinResetValue), "Minimum Reset Value", 0}, {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (MinPollInterval), "Minimum Polling Interval", 0}, {ACPI_DMT_UINT16, ACPI_ASF0_OFFSET (SystemId), "System ID", 0}, {ACPI_DMT_UINT32, ACPI_ASF0_OFFSET (MfgId), "Manufacturer ID", 0}, {ACPI_DMT_UINT8, ACPI_ASF0_OFFSET (Flags), "Flags", 0}, {ACPI_DMT_UINT24, ACPI_ASF0_OFFSET (Reserved2[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* 1: ASF Alerts */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1[] = { {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (AssertMask), "AssertMask", 0}, {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DeassertMask), "DeassertMask", 0}, {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (Alerts), "Alert Count", 0}, {ACPI_DMT_UINT8, ACPI_ASF1_OFFSET (DataLength), "Alert Data Length", 0}, ACPI_DMT_TERMINATOR }; /* 1a: ASF Alert data */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf1a[] = { {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Address), "Address", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Command), "Command", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Mask), "Mask", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Value), "Value", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorType), "SensorType", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Type), "Type", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Offset), "Offset", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SourceType), "SourceType", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Severity), "Severity", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (SensorNumber), "SensorNumber", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Entity), "Entity", 0}, {ACPI_DMT_UINT8, ACPI_ASF1a_OFFSET (Instance), "Instance", 0}, ACPI_DMT_TERMINATOR }; /* 2: ASF Remote Control */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2[] = { {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (Controls), "Control Count", 0}, {ACPI_DMT_UINT8, ACPI_ASF2_OFFSET (DataLength), "Control Data Length", 0}, {ACPI_DMT_UINT16, ACPI_ASF2_OFFSET (Reserved2), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* 2a: ASF Control data */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf2a[] = { {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Function), "Function", 0}, {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Address), "Address", 0}, {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Command), "Command", 0}, {ACPI_DMT_UINT8, ACPI_ASF2a_OFFSET (Value), "Value", 0}, ACPI_DMT_TERMINATOR }; /* 3: ASF RMCP Boot Options */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf3[] = { {ACPI_DMT_BUF7, ACPI_ASF3_OFFSET (Capabilities[0]), "Capabilities", 0}, {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (CompletionCode), "Completion Code", 0}, {ACPI_DMT_UINT32, ACPI_ASF3_OFFSET (EnterpriseId), "Enterprise ID", 0}, {ACPI_DMT_UINT8, ACPI_ASF3_OFFSET (Command), "Command", 0}, {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (Parameter), "Parameter", 0}, {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (BootOptions), "Boot Options", 0}, {ACPI_DMT_UINT16, ACPI_ASF3_OFFSET (OemParameters), "Oem Parameters", 0}, ACPI_DMT_TERMINATOR }; /* 4: ASF Address */ ACPI_DMTABLE_INFO AcpiDmTableInfoAsf4[] = { {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (EpromAddress), "Eprom Address", 0}, {ACPI_DMT_UINT8, ACPI_ASF4_OFFSET (Devices), "Device Count", DT_COUNT}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * BERT - Boot Error Record table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoBert[] = { {ACPI_DMT_UINT32, ACPI_BERT_OFFSET (RegionLength), "Boot Error Region Length", 0}, {ACPI_DMT_UINT64, ACPI_BERT_OFFSET (Address), "Boot Error Region Address", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * BOOT - Simple Boot Flag Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoBoot[] = { {ACPI_DMT_UINT8, ACPI_BOOT_OFFSET (CmosIndex), "Boot Register Index", 0}, {ACPI_DMT_UINT24, ACPI_BOOT_OFFSET (Reserved[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * CPEP - Corrected Platform Error Polling table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoCpep[] = { {ACPI_DMT_UINT64, ACPI_CPEP_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoCpep0[] = { {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Type), "Subtable Type", 0}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Header.Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Id), "Processor ID", 0}, {ACPI_DMT_UINT8, ACPI_CPEP0_OFFSET (Eid), "Processor EID", 0}, {ACPI_DMT_UINT32, ACPI_CPEP0_OFFSET (Interval), "Polling Interval", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * DBGP - Debug Port * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoDbgp[] = { {ACPI_DMT_UINT8, ACPI_DBGP_OFFSET (Type), "Interface Type", 0}, {ACPI_DMT_UINT24, ACPI_DBGP_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_GAS, ACPI_DBGP_OFFSET (DebugPort), "Debug Port Register", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * DMAR - DMA Remapping table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar[] = { {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Width), "Host Address Width", 0}, {ACPI_DMT_UINT8, ACPI_DMAR_OFFSET (Flags), "Flags", 0}, ACPI_DMT_TERMINATOR }; /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarHdr[] = { {ACPI_DMT_DMAR, ACPI_DMAR0_OFFSET (Header.Type), "Subtable Type", 0}, {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Header.Length), "Length", DT_LENGTH}, ACPI_DMT_TERMINATOR }; /* Common device scope entry */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmarScope[] = { {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EntryType), "Device Scope Entry Type", 0}, {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Length), "Entry Length", DT_LENGTH}, {ACPI_DMT_UINT16, ACPI_DMARS_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (EnumerationId), "Enumeration ID", 0}, {ACPI_DMT_UINT8, ACPI_DMARS_OFFSET (Bus), "PCI Bus Number", 0}, ACPI_DMT_TERMINATOR }; /* DMAR Subtables */ /* 0: Hardware Unit Definition */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar0[] = { {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Flags), "Flags", 0}, {ACPI_DMT_UINT8, ACPI_DMAR0_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT16, ACPI_DMAR0_OFFSET (Segment), "PCI Segment Number", 0}, {ACPI_DMT_UINT64, ACPI_DMAR0_OFFSET (Address), "Register Base Address", 0}, ACPI_DMT_TERMINATOR }; /* 1: Reserved Memory Definition */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar1[] = { {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT16, ACPI_DMAR1_OFFSET (Segment), "PCI Segment Number", 0}, {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT64, ACPI_DMAR1_OFFSET (EndAddress), "End Address (limit)", 0}, ACPI_DMT_TERMINATOR }; /* 2: Root Port ATS Capability Definition */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar2[] = { {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Flags), "Flags", 0}, {ACPI_DMT_UINT8, ACPI_DMAR2_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT16, ACPI_DMAR2_OFFSET (Segment), "PCI Segment Number", 0}, ACPI_DMT_TERMINATOR }; /* 3: Remapping Hardware Static Affinity Structure */ ACPI_DMTABLE_INFO AcpiDmTableInfoDmar3[] = { {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT64, ACPI_DMAR3_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT32, ACPI_DMAR3_OFFSET (ProximityDomain), "Proximity Domain", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * ECDT - Embedded Controller Boot Resources Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoEcdt[] = { {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Control), "Command/Status Register", 0}, {ACPI_DMT_GAS, ACPI_ECDT_OFFSET (Data), "Data Register", 0}, {ACPI_DMT_UINT32, ACPI_ECDT_OFFSET (Uid), "UID", 0}, {ACPI_DMT_UINT8, ACPI_ECDT_OFFSET (Gpe), "GPE Number", 0}, {ACPI_DMT_STRING, ACPI_ECDT_OFFSET (Id[0]), "Namepath", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * EINJ - Error Injection table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoEinj[] = { {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (HeaderLength), "Injection Header Length", 0}, {ACPI_DMT_UINT8, ACPI_EINJ_OFFSET (Flags), "Flags", 0}, {ACPI_DMT_UINT24, ACPI_EINJ_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_EINJ_OFFSET (Entries), "Injection Entry Count", 0}, ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoEinj0[] = { {ACPI_DMT_EINJACT, ACPI_EINJ0_OFFSET (Action), "Action", 0}, {ACPI_DMT_EINJINST, ACPI_EINJ0_OFFSET (Instruction), "Instruction", 0}, {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_EINJ0_FLAG_OFFSET (Flags,0), "Preserve Register Bits", 0}, {ACPI_DMT_UINT8, ACPI_EINJ0_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_GAS, ACPI_EINJ0_OFFSET (RegisterRegion), "Register Region", 0}, {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Value), "Value", 0}, {ACPI_DMT_UINT64, ACPI_EINJ0_OFFSET (Mask), "Mask", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * ERST - Error Record Serialization table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoErst[] = { {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (HeaderLength), "Serialization Header Length", 0}, {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_ERST_OFFSET (Entries), "Instruction Entry Count", 0}, ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoErst0[] = { {ACPI_DMT_ERSTACT, ACPI_ERST0_OFFSET (Action), "Action", 0}, {ACPI_DMT_ERSTINST, ACPI_ERST0_OFFSET (Instruction), "Instruction", 0}, {ACPI_DMT_UINT8, ACPI_ERST0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_ERST0_FLAG_OFFSET (Flags,0), "Preserve Register Bits", 0}, {ACPI_DMT_UINT8, ACPI_ERST0_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_GAS, ACPI_ERST0_OFFSET (RegisterRegion), "Register Region", 0}, {ACPI_DMT_UINT64, ACPI_ERST0_OFFSET (Value), "Value", 0}, {ACPI_DMT_UINT64, ACPI_ERST0_OFFSET (Mask), "Mask", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * HEST - Hardware Error Source table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoHest[] = { {ACPI_DMT_UINT32, ACPI_HEST_OFFSET (ErrorSourceCount), "Error Source Count", 0}, ACPI_DMT_TERMINATOR }; /* Common HEST structures for subtables */ #define ACPI_DM_HEST_HEADER \ {ACPI_DMT_HEST, ACPI_HEST0_OFFSET (Header.Type), "Subtable Type", 0}, \ {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Header.SourceId), "Source Id", 0} #define ACPI_DM_HEST_AER \ {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved1), "Reserved", 0}, \ {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Flags), "Flags (decoded below)", DT_FLAG}, \ {ACPI_DMT_FLAG0, ACPI_HEST6_FLAG_OFFSET (Aer.Flags,0), "Firmware First", 0}, \ {ACPI_DMT_UINT8, ACPI_HEST6_OFFSET (Aer.Enabled), "Enabled", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.RecordsToPreallocate), "Records To Preallocate", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.MaxSectionsPerRecord), "Max Sections Per Record", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.Bus), "Bus", 0}, \ {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Device), "Device", 0}, \ {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Function), "Function", 0}, \ {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.DeviceControl), "DeviceControl", 0}, \ {ACPI_DMT_UINT16, ACPI_HEST6_OFFSET (Aer.Reserved2), "Reserved", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableMask), "Uncorrectable Mask", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.UncorrectableSeverity), "Uncorrectable Severity", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.CorrectableMask), "Correctable Mask", 0}, \ {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (Aer.AdvancedCapabilities), "Advanced Capabilities", 0} /* HEST Subtables */ /* 0: IA32 Machine Check Exception */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest0[] = { ACPI_DM_HEST_HEADER, {ACPI_DMT_UINT16, ACPI_HEST0_OFFSET (Reserved1), "Reserved1", 0}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_HEST0_FLAG_OFFSET (Flags,0), "Firmware First", 0}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (Enabled), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, {ACPI_DMT_UINT32, ACPI_HEST0_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalCapabilityData), "Global Capability Data", 0}, {ACPI_DMT_UINT64, ACPI_HEST0_OFFSET (GlobalControlData), "Global Control Data", 0}, {ACPI_DMT_UINT8, ACPI_HEST0_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, {ACPI_DMT_UINT56, ACPI_HEST0_OFFSET (Reserved3[0]), "Reserved2", 0}, ACPI_DMT_TERMINATOR }; /* 1: IA32 Corrected Machine Check */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest1[] = { ACPI_DM_HEST_HEADER, {ACPI_DMT_UINT16, ACPI_HEST1_OFFSET (Reserved1), "Reserved1", 0}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_HEST1_FLAG_OFFSET (Flags,0), "Firmware First", 0}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (Enabled), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, {ACPI_DMT_UINT32, ACPI_HEST1_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, {ACPI_DMT_HESTNTFY, ACPI_HEST1_OFFSET (Notify), "Notify", 0}, {ACPI_DMT_UINT8, ACPI_HEST1_OFFSET (NumHardwareBanks), "Num Hardware Banks", 0}, {ACPI_DMT_UINT24, ACPI_HEST1_OFFSET (Reserved2[0]), "Reserved2", 0}, ACPI_DMT_TERMINATOR }; /* 2: IA32 Non-Maskable Interrupt */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest2[] = { ACPI_DM_HEST_HEADER, {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, {ACPI_DMT_UINT32, ACPI_HEST2_OFFSET (MaxRawDataLength), "Max Raw Data Length", 0}, ACPI_DMT_TERMINATOR }; /* 6: PCI Express Root Port AER */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest6[] = { ACPI_DM_HEST_HEADER, ACPI_DM_HEST_AER, {ACPI_DMT_UINT32, ACPI_HEST6_OFFSET (RootErrorCommand), "Root Error Command", 0}, ACPI_DMT_TERMINATOR }; /* 7: PCI Express AER (AER Endpoint) */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest7[] = { ACPI_DM_HEST_HEADER, ACPI_DM_HEST_AER, ACPI_DMT_TERMINATOR }; /* 8: PCI Express/PCI-X Bridge AER */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest8[] = { ACPI_DM_HEST_HEADER, ACPI_DM_HEST_AER, {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableMask2), "2nd Uncorrectable Mask", 0}, {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (UncorrectableSeverity2), "2nd Uncorrectable Severity", 0}, {ACPI_DMT_UINT32, ACPI_HEST8_OFFSET (AdvancedCapabilities2), "2nd Advanced Capabilities", 0}, ACPI_DMT_TERMINATOR }; /* 9: Generic Hardware Error Source */ ACPI_DMTABLE_INFO AcpiDmTableInfoHest9[] = { ACPI_DM_HEST_HEADER, {ACPI_DMT_UINT16, ACPI_HEST9_OFFSET (RelatedSourceId), "Related Source Id", 0}, {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT8, ACPI_HEST9_OFFSET (Enabled), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (RecordsToPreallocate), "Records To Preallocate", 0}, {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxSectionsPerRecord), "Max Sections Per Record", 0}, {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (MaxRawDataLength), "Max Raw Data Length", 0}, {ACPI_DMT_GAS, ACPI_HEST9_OFFSET (ErrorStatusAddress), "Error Status Address", 0}, {ACPI_DMT_HESTNTFY, ACPI_HEST9_OFFSET (Notify), "Notify", 0}, {ACPI_DMT_UINT32, ACPI_HEST9_OFFSET (ErrorBlockLength), "Error Status Block Length", 0}, ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoHestNotify[] = { {ACPI_DMT_HESTNTYP, ACPI_HESTN_OFFSET (Type), "Notify Type", 0}, {ACPI_DMT_UINT8, ACPI_HESTN_OFFSET (Length), "Notify Length", DT_LENGTH}, {ACPI_DMT_UINT16, ACPI_HESTN_OFFSET (ConfigWriteEnable), "Configuration Write Enable", 0}, {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollInterval), "PollInterval", 0}, {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (Vector), "Vector", 0}, {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdValue), "Polling Threshold Value", 0}, {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (PollingThresholdWindow), "Polling Threshold Window", 0}, {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdValue), "Error Threshold Value", 0}, {ACPI_DMT_UINT32, ACPI_HESTN_OFFSET (ErrorThresholdWindow), "Error Threshold Window", 0}, ACPI_DMT_TERMINATOR }; /* * IA32 Error Bank(s) - Follows the ACPI_HEST_IA_MACHINE_CHECK and * ACPI_HEST_IA_CORRECTED structures. */ ACPI_DMTABLE_INFO AcpiDmTableInfoHestBank[] = { {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (BankNumber), "Bank Number", 0}, {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (ClearStatusOnInit), "Clear Status On Init", 0}, {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (StatusFormat), "Status Format", 0}, {ACPI_DMT_UINT8, ACPI_HESTB_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (ControlRegister), "Control Register", 0}, {ACPI_DMT_UINT64, ACPI_HESTB_OFFSET (ControlData), "Control Data", 0}, {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (StatusRegister), "Status Register", 0}, {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (AddressRegister), "Address Register", 0}, {ACPI_DMT_UINT32, ACPI_HESTB_OFFSET (MiscRegister), "Misc Register", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * HPET - High Precision Event Timer table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoHpet[] = { {ACPI_DMT_UINT32, ACPI_HPET_OFFSET (Id), "Hardware Block ID", 0}, {ACPI_DMT_GAS, ACPI_HPET_OFFSET (Address), "Timer Block Register", 0}, {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Sequence), "Sequence Number", 0}, {ACPI_DMT_UINT16, ACPI_HPET_OFFSET (MinimumTick), "Minimum Clock Ticks", 0}, {ACPI_DMT_UINT8, ACPI_HPET_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_HPET_FLAG_OFFSET (Flags,0), "4K Page Protect", 0}, {ACPI_DMT_FLAG1, ACPI_HPET_FLAG_OFFSET (Flags,0), "64K Page Protect", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * IVRS - I/O Virtualization Reporting Structure * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs[] = { {ACPI_DMT_UINT32, ACPI_IVRS_OFFSET (Info), "Virtualization Info", 0}, {ACPI_DMT_UINT64, ACPI_IVRS_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrsHdr[] = { {ACPI_DMT_IVRS, ACPI_IVRSH_OFFSET (Type), "Subtable Type", 0}, {ACPI_DMT_UINT8, ACPI_IVRSH_OFFSET (Flags), "Flags", 0}, {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT16, ACPI_IVRSH_OFFSET (DeviceId), "DeviceId", 0}, ACPI_DMT_TERMINATOR }; /* IVRS subtables */ /* 0x10: I/O Virtualization Hardware Definition (IVHD) Block */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs0[] = { {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (CapabilityOffset), "Capability Offset", 0}, {ACPI_DMT_UINT64, ACPI_IVRS0_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (PciSegmentGroup), "PCI Segment Group", 0}, {ACPI_DMT_UINT16, ACPI_IVRS0_OFFSET (Info), "Virtualization Info", 0}, {ACPI_DMT_UINT32, ACPI_IVRS0_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* 0x20, 0x21, 0x22: I/O Virtualization Memory Definition (IVMD) Block */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs1[] = { {ACPI_DMT_UINT16, ACPI_IVRS1_OFFSET (AuxData), "Auxiliary Data", 0}, {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (StartAddress), "Start Address", 0}, {ACPI_DMT_UINT64, ACPI_IVRS1_OFFSET (MemoryLength), "Memory Length", 0}, ACPI_DMT_TERMINATOR }; /* Device entry header for IVHD block */ #define ACPI_DMT_IVRS_DE_HEADER \ {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (Type), "Entry Type", 0}, \ {ACPI_DMT_UINT16, ACPI_IVRSD_OFFSET (Id), "Device ID", 0}, \ {ACPI_DMT_UINT8, ACPI_IVRSD_OFFSET (DataSetting), "Data Setting", 0} /* 4-byte device entry */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs4[] = { ACPI_DMT_IVRS_DE_HEADER, {ACPI_DMT_EXIT, 0, NULL, 0}, }; /* 8-byte device entry */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8a[] = { ACPI_DMT_IVRS_DE_HEADER, {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved1), "Reserved", 0}, {ACPI_DMT_UINT16, ACPI_IVRS8A_OFFSET (UsedId), "Source Used Device ID", 0}, {ACPI_DMT_UINT8, ACPI_IVRS8A_OFFSET (Reserved2), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* 8-byte device entry */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8b[] = { ACPI_DMT_IVRS_DE_HEADER, {ACPI_DMT_UINT32, ACPI_IVRS8B_OFFSET (ExtendedData), "Extended Data", 0}, ACPI_DMT_TERMINATOR }; /* 8-byte device entry */ ACPI_DMTABLE_INFO AcpiDmTableInfoIvrs8c[] = { ACPI_DMT_IVRS_DE_HEADER, {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Handle), "Handle", 0}, {ACPI_DMT_UINT16, ACPI_IVRS8C_OFFSET (UsedId), "Source Used Device ID", 0}, {ACPI_DMT_UINT8, ACPI_IVRS8C_OFFSET (Variety), "Variety", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * MADT - Multiple APIC Description Table and subtables * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt[] = { {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Address), "Local Apic Address", 0}, {ACPI_DMT_UINT32, ACPI_MADT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_MADT_FLAG_OFFSET (Flags,0), "PC-AT Compatibility", 0}, ACPI_DMT_TERMINATOR }; /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadtHdr[] = { {ACPI_DMT_MADT, ACPI_MADTH_OFFSET (Type), "Subtable Type", 0}, {ACPI_DMT_UINT8, ACPI_MADTH_OFFSET (Length), "Length", DT_LENGTH}, ACPI_DMT_TERMINATOR }; /* MADT Subtables */ /* 0: processor APIC */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt0[] = { {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (ProcessorId), "Processor ID", 0}, {ACPI_DMT_UINT8, ACPI_MADT0_OFFSET (Id), "Local Apic ID", 0}, {ACPI_DMT_UINT32, ACPI_MADT0_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_MADT0_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, ACPI_DMT_TERMINATOR }; /* 1: IO APIC */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt1[] = { {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Id), "I/O Apic ID", 0}, {ACPI_DMT_UINT8, ACPI_MADT1_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (Address), "Address", 0}, {ACPI_DMT_UINT32, ACPI_MADT1_OFFSET (GlobalIrqBase), "Interrupt", 0}, ACPI_DMT_TERMINATOR }; /* 2: Interrupt Override */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt2[] = { {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (Bus), "Bus", 0}, {ACPI_DMT_UINT8, ACPI_MADT2_OFFSET (SourceIrq), "Source", 0}, {ACPI_DMT_UINT32, ACPI_MADT2_OFFSET (GlobalIrq), "Interrupt", 0}, {ACPI_DMT_UINT16, ACPI_MADT2_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAGS0, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, {ACPI_DMT_FLAGS2, ACPI_MADT2_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, ACPI_DMT_TERMINATOR }; /* 3: NMI Sources */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt3[] = { {ACPI_DMT_UINT16, ACPI_MADT3_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAGS0, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, {ACPI_DMT_FLAGS2, ACPI_MADT3_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, {ACPI_DMT_UINT32, ACPI_MADT3_OFFSET (GlobalIrq), "Interrupt", 0}, ACPI_DMT_TERMINATOR }; /* 4: Local APIC NMI */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt4[] = { {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (ProcessorId), "Processor ID", 0}, {ACPI_DMT_UINT16, ACPI_MADT4_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAGS0, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, {ACPI_DMT_FLAGS2, ACPI_MADT4_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, {ACPI_DMT_UINT8, ACPI_MADT4_OFFSET (Lint), "Interrupt Input LINT", 0}, ACPI_DMT_TERMINATOR }; /* 5: Address Override */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt5[] = { {ACPI_DMT_UINT16, ACPI_MADT5_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT64, ACPI_MADT5_OFFSET (Address), "APIC Address", 0}, ACPI_DMT_TERMINATOR }; /* 6: I/O Sapic */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt6[] = { {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Id), "I/O Sapic ID", 0}, {ACPI_DMT_UINT8, ACPI_MADT6_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_MADT6_OFFSET (GlobalIrqBase), "Interrupt Base", 0}, {ACPI_DMT_UINT64, ACPI_MADT6_OFFSET (Address), "Address", 0}, ACPI_DMT_TERMINATOR }; /* 7: Local Sapic */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt7[] = { {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (ProcessorId), "Processor ID", 0}, {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Id), "Local Sapic ID", 0}, {ACPI_DMT_UINT8, ACPI_MADT7_OFFSET (Eid), "Local Sapic EID", 0}, {ACPI_DMT_UINT24, ACPI_MADT7_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_MADT7_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, {ACPI_DMT_UINT32, ACPI_MADT7_OFFSET (Uid), "Processor UID", 0}, {ACPI_DMT_STRING, ACPI_MADT7_OFFSET (UidString[0]), "Processor UID String", 0}, ACPI_DMT_TERMINATOR }; /* 8: Platform Interrupt Source */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt8[] = { {ACPI_DMT_UINT16, ACPI_MADT8_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAGS0, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, {ACPI_DMT_FLAGS2, ACPI_MADT8_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Type), "InterruptType", 0}, {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Id), "Processor ID", 0}, {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (Eid), "Processor EID", 0}, {ACPI_DMT_UINT8, ACPI_MADT8_OFFSET (IoSapicVector), "I/O Sapic Vector", 0}, {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (GlobalIrq), "Interrupt", 0}, {ACPI_DMT_UINT32, ACPI_MADT8_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_MADT8_OFFSET (Flags), "CPEI Override", 0}, ACPI_DMT_TERMINATOR }; /* 9: Processor Local X2_APIC (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt9[] = { {ACPI_DMT_UINT16, ACPI_MADT9_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LocalApicId), "Processor x2Apic ID", 0}, {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (LapicFlags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_MADT9_FLAG_OFFSET (LapicFlags,0), "Processor Enabled", 0}, {ACPI_DMT_UINT32, ACPI_MADT9_OFFSET (Uid), "Processor UID", 0}, ACPI_DMT_TERMINATOR }; /* 10: Local X2_APIC NMI (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoMadt10[] = { {ACPI_DMT_UINT16, ACPI_MADT10_OFFSET (IntiFlags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAGS0, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Polarity", 0}, {ACPI_DMT_FLAGS2, ACPI_MADT10_FLAG_OFFSET (IntiFlags,0), "Trigger Mode", 0}, {ACPI_DMT_UINT32, ACPI_MADT10_OFFSET (Uid), "Processor UID", 0}, {ACPI_DMT_UINT8, ACPI_MADT10_OFFSET (Lint), "Interrupt Input LINT", 0}, {ACPI_DMT_UINT24, ACPI_MADT10_OFFSET (Reserved[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * MCFG - PCI Memory Mapped Configuration table and Subtable * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg[] = { {ACPI_DMT_UINT64, ACPI_MCFG_OFFSET (Reserved[0]), "Reserved", 0}, ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoMcfg0[] = { {ACPI_DMT_UINT64, ACPI_MCFG0_OFFSET (Address), "Base Address", 0}, {ACPI_DMT_UINT16, ACPI_MCFG0_OFFSET (PciSegment), "Segment Group Number", 0}, {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (StartBusNumber), "Start Bus Number", 0}, {ACPI_DMT_UINT8, ACPI_MCFG0_OFFSET (EndBusNumber), "End Bus Number", 0}, {ACPI_DMT_UINT32, ACPI_MCFG0_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * MCHI - Management Controller Host Interface table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoMchi[] = { {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterfaceType), "Interface Type", 0}, {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Protocol), "Protocol", 0}, {ACPI_DMT_UINT64, ACPI_MCHI_OFFSET (ProtocolData), "Protocol Data", 0}, {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (InterruptType), "Interrupt Type", 0}, {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (Gpe), "Gpe", 0}, {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDeviceFlag), "Pci Device Flag", 0}, {ACPI_DMT_UINT32, ACPI_MCHI_OFFSET (GlobalInterrupt), "Global Interrupt", 0}, {ACPI_DMT_GAS, ACPI_MCHI_OFFSET (ControlRegister), "Control Register", 0}, {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciSegment), "Pci Segment", 0}, {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciBus), "Pci Bus", 0}, {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciDevice), "Pci Device", 0}, {ACPI_DMT_UINT8, ACPI_MCHI_OFFSET (PciFunction), "Pci Function", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * MSCT - Maximum System Characteristics Table (ACPI 4.0) * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoMsct[] = { {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (ProximityOffset), "Proximity Offset", 0}, {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxProximityDomains), "Max Proximity Domains", 0}, {ACPI_DMT_UINT32, ACPI_MSCT_OFFSET (MaxClockDomains), "Max Clock Domains", 0}, {ACPI_DMT_UINT64, ACPI_MSCT_OFFSET (MaxAddress), "Max Physical Address", 0}, ACPI_DMT_TERMINATOR }; /* Subtable - Maximum Proximity Domain Information. Version 1 */ ACPI_DMTABLE_INFO AcpiDmTableInfoMsct0[] = { {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Revision), "Revision", 0}, {ACPI_DMT_UINT8, ACPI_MSCT0_OFFSET (Length), "Length", DT_LENGTH}, {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeStart), "Domain Range Start", 0}, {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (RangeEnd), "Domain Range End", 0}, {ACPI_DMT_UINT32, ACPI_MSCT0_OFFSET (ProcessorCapacity), "Processor Capacity", 0}, {ACPI_DMT_UINT64, ACPI_MSCT0_OFFSET (MemoryCapacity), "Memory Capacity", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * SBST - Smart Battery Specification Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoSbst[] = { {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (WarningLevel), "Warning Level", 0}, {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (LowLevel), "Low Level", 0}, {ACPI_DMT_UINT32, ACPI_SBST_OFFSET (CriticalLevel), "Critical Level", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * SLIC - Software Licensing Description Table. There is no common table, just * the standard ACPI header and then subtables. * ******************************************************************************/ /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSlicHdr[] = { {ACPI_DMT_SLIC, ACPI_SLICH_OFFSET (Type), "Subtable Type", 0}, {ACPI_DMT_UINT32, ACPI_SLICH_OFFSET (Length), "Length", DT_LENGTH}, ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoSlic0[] = { {ACPI_DMT_UINT8, ACPI_SLIC0_OFFSET (KeyType), "Key Type", 0}, {ACPI_DMT_UINT8, ACPI_SLIC0_OFFSET (Version), "Version", 0}, {ACPI_DMT_UINT16, ACPI_SLIC0_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (Algorithm), "Algorithm", 0}, {ACPI_DMT_NAME4, ACPI_SLIC0_OFFSET (Magic), "Magic", 0}, {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (BitLength), "BitLength", 0}, {ACPI_DMT_UINT32, ACPI_SLIC0_OFFSET (Exponent), "Exponent", 0}, {ACPI_DMT_BUF128, ACPI_SLIC0_OFFSET (Modulus[0]), "Modulus", 0}, ACPI_DMT_TERMINATOR }; ACPI_DMTABLE_INFO AcpiDmTableInfoSlic1[] = { {ACPI_DMT_UINT32, ACPI_SLIC1_OFFSET (Version), "Version", 0}, {ACPI_DMT_NAME6, ACPI_SLIC1_OFFSET (OemId[0]), "Oem ID", 0}, {ACPI_DMT_NAME8, ACPI_SLIC1_OFFSET (OemTableId[0]), "Oem Table ID", 0}, {ACPI_DMT_NAME8, ACPI_SLIC1_OFFSET (WindowsFlag[0]), "Windows Flag", 0}, {ACPI_DMT_UINT32, ACPI_SLIC1_OFFSET (SlicVersion), "SLIC Version", 0}, {ACPI_DMT_BUF16, ACPI_SLIC1_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_BUF128, ACPI_SLIC1_OFFSET (Signature[0]), "Signature", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * SLIT - System Locality Information Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoSlit[] = { {ACPI_DMT_UINT64, ACPI_SLIT_OFFSET (LocalityCount), "Localities", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * SPCR - Serial Port Console Redirection table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoSpcr[] = { {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterfaceType), "Interface Type", 0}, {ACPI_DMT_UINT24, ACPI_SPCR_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_GAS, ACPI_SPCR_OFFSET (SerialPort), "Serial Port Register", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (InterruptType), "Interrupt Type", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PcInterrupt), "PCAT-compatible IRQ", 0}, {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Interrupt), "Interrupt", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (BaudRate), "Baud Rate", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Parity), "Parity", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (StopBits), "Stop Bits", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (FlowControl), "Flow Control", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (TerminalType), "Terminal Type", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (Reserved2), "Reserved", 0}, {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciDeviceId), "PCI Device ID", 0}, {ACPI_DMT_UINT16, ACPI_SPCR_OFFSET (PciVendorId), "PCI Vendor ID", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciBus), "PCI Bus", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciDevice), "PCI Device", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciFunction), "PCI Function", 0}, {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (PciFlags), "PCI Flags", 0}, {ACPI_DMT_UINT8, ACPI_SPCR_OFFSET (PciSegment), "PCI Segment", 0}, {ACPI_DMT_UINT32, ACPI_SPCR_OFFSET (Reserved2), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * SPMI - Server Platform Management Interface table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoSpmi[] = { {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterfaceType), "Interface Type", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT16, ACPI_SPMI_OFFSET (SpecRevision), "IPMI Spec Version", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (InterruptType), "Interrupt Type", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (GpeNumber), "GPE Number", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved1), "Reserved", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDeviceFlag), "PCI Device Flag", 0}, {ACPI_DMT_UINT32, ACPI_SPMI_OFFSET (Interrupt), "Interrupt", 0}, {ACPI_DMT_GAS, ACPI_SPMI_OFFSET (IpmiRegister), "IPMI Register", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciSegment), "PCI Segment", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciBus), "PCI Bus", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciDevice), "PCI Device", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (PciFunction), "PCI Function", 0}, {ACPI_DMT_UINT8, ACPI_SPMI_OFFSET (Reserved2), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * SRAT - System Resource Affinity Table and Subtables * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat[] = { {ACPI_DMT_UINT32, ACPI_SRAT_OFFSET (TableRevision), "Table Revision", 0}, {ACPI_DMT_UINT64, ACPI_SRAT_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* Common Subtable header (one per Subtable) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSratHdr[] = { {ACPI_DMT_SRAT, ACPI_SRATH_OFFSET (Type), "Subtable Type", 0}, {ACPI_DMT_UINT8, ACPI_SRATH_OFFSET (Length), "Length", DT_LENGTH}, ACPI_DMT_TERMINATOR }; /* SRAT Subtables */ /* 0: Processor Local APIC/SAPIC Affinity */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat0[] = { {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ProximityDomainLo), "Proximity Domain Low(8)", 0}, {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (ApicId), "Apic ID", 0}, {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_SRAT0_FLAG_OFFSET (Flags,0), "Enabled", 0}, {ACPI_DMT_UINT8, ACPI_SRAT0_OFFSET (LocalSapicEid), "Local Sapic EID", 0}, {ACPI_DMT_UINT24, ACPI_SRAT0_OFFSET (ProximityDomainHi[0]), "Proximity Domain High(24)", 0}, {ACPI_DMT_UINT32, ACPI_SRAT0_OFFSET (Reserved), "Reserved", 0}, ACPI_DMT_TERMINATOR }; /* 1: Memory Affinity */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat1[] = { {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (ProximityDomain), "Proximity Domain", 0}, {ACPI_DMT_UINT16, ACPI_SRAT1_OFFSET (Reserved), "Reserved1", 0}, {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (BaseAddress), "Base Address", 0}, {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Length), "Address Length", 0}, {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Reserved1), "Reserved2", 0}, {ACPI_DMT_UINT32, ACPI_SRAT1_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Enabled", 0}, {ACPI_DMT_FLAG1, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Hot Pluggable", 0}, {ACPI_DMT_FLAG2, ACPI_SRAT1_FLAG_OFFSET (Flags,0), "Non-Volatile", 0}, {ACPI_DMT_UINT64, ACPI_SRAT1_OFFSET (Reserved2), "Reserved3", 0}, ACPI_DMT_TERMINATOR }; /* 2: Processor Local X2_APIC Affinity (ACPI 4.0) */ ACPI_DMTABLE_INFO AcpiDmTableInfoSrat2[] = { {ACPI_DMT_UINT16, ACPI_SRAT2_OFFSET (Reserved), "Reserved1", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ProximityDomain), "Proximity Domain", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ApicId), "Apic ID", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_SRAT2_FLAG_OFFSET (Flags,0), "Enabled", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (ClockDomain), "Clock Domain", 0}, {ACPI_DMT_UINT32, ACPI_SRAT2_OFFSET (Reserved2), "Reserved2", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * TCPA - Trusted Computing Platform Alliance table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoTcpa[] = { {ACPI_DMT_UINT16, ACPI_TCPA_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_TCPA_OFFSET (MaxLogLength), "Max Event Log Length", 0}, {ACPI_DMT_UINT64, ACPI_TCPA_OFFSET (LogAddress), "Event Log Address", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * UEFI - UEFI Boot optimization Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoUefi[] = { {ACPI_DMT_UUID, ACPI_UEFI_OFFSET (Identifier[0]), "UUID Identifier", 0}, {ACPI_DMT_UINT16, ACPI_UEFI_OFFSET (DataOffset), "Data Offset", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * WAET - Windows ACPI Emulated devices Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoWaet[] = { {ACPI_DMT_UINT32, ACPI_WAET_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_WAET_OFFSET (Flags), "RTC needs no INT ack", 0}, {ACPI_DMT_FLAG1, ACPI_WAET_OFFSET (Flags), "PM timer, one read only", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * WDAT - Watchdog Action Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoWdat[] = { {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (HeaderLength), "Header Length", DT_LENGTH}, {ACPI_DMT_UINT16, ACPI_WDAT_OFFSET (PciSegment), "PCI Segment", 0}, {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciBus), "PCI Bus", 0}, {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciDevice), "PCI Device", 0}, {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (PciFunction), "PCI Function", 0}, {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved[0]), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (TimerPeriod), "Timer Period", 0}, {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MaxCount), "Max Count", 0}, {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (MinCount), "Min Count", 0}, {ACPI_DMT_UINT8, ACPI_WDAT_OFFSET (Flags), "Flags (decoded below)", DT_FLAG}, {ACPI_DMT_FLAG0, ACPI_WDAT_OFFSET (Flags), "Enabled", 0}, {ACPI_DMT_FLAG7, ACPI_WDAT_OFFSET (Flags), "Stopped When Asleep", 0}, {ACPI_DMT_UINT24, ACPI_WDAT_OFFSET (Reserved2[0]), "Reserved", 0}, {ACPI_DMT_UINT32, ACPI_WDAT_OFFSET (Entries), "Watchdog Entry Count", 0}, ACPI_DMT_TERMINATOR }; /* WDAT Subtables - Watchdog Instruction Entries */ ACPI_DMTABLE_INFO AcpiDmTableInfoWdat0[] = { {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Action), "Watchdog Action", 0}, {ACPI_DMT_UINT8, ACPI_WDAT0_OFFSET (Instruction), "Instruction", 0}, {ACPI_DMT_UINT16, ACPI_WDAT0_OFFSET (Reserved), "Reserved", 0}, {ACPI_DMT_GAS, ACPI_WDAT0_OFFSET (RegisterRegion), "Register Region", 0}, {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Value), "Value", 0}, {ACPI_DMT_UINT32, ACPI_WDAT0_OFFSET (Mask), "Register Mask", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * WDDT - Watchdog Description Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoWddt[] = { {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (SpecVersion), "Specification Version", 0}, {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (TableVersion), "Table Version", 0}, {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (PciVendorId), "PCI Vendor ID", 0}, {ACPI_DMT_GAS, ACPI_WDDT_OFFSET (Address), "Timer Register", 0}, {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (MaxCount), "Max Count", 0}, {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (MinCount), "Min Count", 0}, {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (Period), "Period", 0}, {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (Status), "Status (decoded below)", 0}, /* Status Flags byte 0 */ {ACPI_DMT_FLAG0, ACPI_WDDT_FLAG_OFFSET (Status,0), "Available", 0}, {ACPI_DMT_FLAG1, ACPI_WDDT_FLAG_OFFSET (Status,0), "Active", 0}, {ACPI_DMT_FLAG2, ACPI_WDDT_FLAG_OFFSET (Status,0), "OS Owns", 0}, /* Status Flags byte 1 */ {ACPI_DMT_FLAG3, ACPI_WDDT_FLAG_OFFSET (Status,1), "User Reset", 0}, {ACPI_DMT_FLAG4, ACPI_WDDT_FLAG_OFFSET (Status,1), "Timeout Reset", 0}, {ACPI_DMT_FLAG5, ACPI_WDDT_FLAG_OFFSET (Status,1), "Power Fail Reset", 0}, {ACPI_DMT_FLAG6, ACPI_WDDT_FLAG_OFFSET (Status,1), "Unknown Reset", 0}, {ACPI_DMT_UINT16, ACPI_WDDT_OFFSET (Capability), "Capability (decoded below)", 0}, /* Capability Flags byte 0 */ {ACPI_DMT_FLAG0, ACPI_WDDT_FLAG_OFFSET (Capability,0), "Auto Reset", 0}, {ACPI_DMT_FLAG1, ACPI_WDDT_FLAG_OFFSET (Capability,0), "Timeout Alert", 0}, ACPI_DMT_TERMINATOR }; /******************************************************************************* * * WDRT - Watchdog Resource Table * ******************************************************************************/ ACPI_DMTABLE_INFO AcpiDmTableInfoWdrt[] = { {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (ControlRegister), "Control Register", 0}, {ACPI_DMT_GAS, ACPI_WDRT_OFFSET (CountRegister), "Count Register", 0}, {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciDeviceId), "PCI Device ID", 0}, {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (PciVendorId), "PCI Vendor ID", 0}, {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciBus), "PCI Bus", 0}, {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciDevice), "PCI Device", 0}, {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciFunction), "PCI Function", 0}, {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (PciSegment), "PCI Segment", 0}, {ACPI_DMT_UINT16, ACPI_WDRT_OFFSET (MaxCount), "Max Count", 0}, {ACPI_DMT_UINT8, ACPI_WDRT_OFFSET (Units), "Counter Units", 0}, ACPI_DMT_TERMINATOR }; /* * Generic types (used in UEFI) * * Examples: * * Buffer : cc 04 ff bb * UINT8 : 11 * UINT16 : 1122 * UINT24 : 112233 * UINT32 : 11223344 * UINT56 : 11223344556677 * UINT64 : 1122334455667788 * * String : "This is string" * Unicode : "This string encoded to Unicode" * * GUID : 11223344-5566-7788-99aa-bbccddeeff00 * DevicePath : "\PciRoot(0)\Pci(0x1f,1)\Usb(0,0)" */ #define ACPI_DM_GENERIC_ENTRY(FieldType, FieldName)\ {{FieldType, 0, FieldName, 0}, ACPI_DMT_TERMINATOR} ACPI_DMTABLE_INFO AcpiDmTableInfoGeneric[][2] = { ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT8, "UINT8"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT16, "UINT16"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT24, "UINT24"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT32, "UINT32"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT56, "UINT56"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UINT64, "UINT64"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "String"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UNICODE, "Unicode"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_BUFFER, "Buffer"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_UUID, "GUID"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_STRING, "DevicePath"), ACPI_DM_GENERIC_ENTRY (ACPI_DMT_LABEL, "Label"), {ACPI_DMT_TERMINATOR} };
dcui/FreeBSD-9.3_kernel
sys/contrib/dev/acpica/common/dmtbinfo.c
C
bsd-3-clause
81,813
--- layout: data_model title: AddressFamilyType this_version: 1.0.1 --- <div class="alert alert-danger bs-alert-old-docs"> <strong>Heads up!</strong> These docs are for STIX 1.0.1, which is not the latest version (1.2). <a href="/data-model/1.2/NetworkSocketObj/AddressFamilyType">View the latest!</a> </div> <div class="row"> <div class="col-md-10"> <h1>AddressFamilyType<span class="subdued">Network Socket Object Schema</span></h1> <p class="data-model-description">AddressFamilyType specifies address family types, via a union of the AddressFamilyTypeEnum type and the atomic xs:string type. Its base type is the CybOX Core BaseObjectPropertyType, for permitting complex (i.e. regular-expression based) specifications.</p> </div> <div id="nav-area" class="col-md-2"> <p> <form id="nav-version"> <select> <option value="1.2" >STIX 1.2</option> <option value="1.1.1" >STIX 1.1.1</option> <option value="1.1" >STIX 1.1</option> <option value="1.0.1" selected="selected">STIX 1.0.1</option> <option value="1.0" >STIX 1.0</option> </select> </form> </p> </div> </div> <hr /> <h2>Fields</h2> <table class="table table-striped table-hover"> <thead> <tr> <th>Field Name</th> <th>Type</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td>@id<span class="occurrence">optional</span></td> <td> QName </td> <td> <p>The id field specifies a unique ID for this Object Property.</p> </td> </tr> <tr> <td>@idref<span class="occurrence">optional</span></td> <td> QName </td> <td> <p>The idref field specifies a unique ID reference for this Object Property.</p> </td> </tr> <tr> <td>@datatype<span class="occurrence">optional</span></td> <td> DatatypeEnum </td> <td> <p>This attribute is optional and specifies the expected type for the value of the specified property.</p> </td> </tr> <tr> <td>@appears_random<span class="occurrence">optional</span></td> <td> boolean </td> <td> <p>This field is optional and conveys whether the associated object property value appears to somewhat random in nature. An object property with this field set to TRUE need not provide any further information including a value. If more is known about the particular variation of randomness, a regex value could be provided to outline what is known of the structure.</p> </td> </tr> <tr> <td>@is_obfuscated<span class="occurrence">optional</span></td> <td> boolean </td> <td> <p>This field is optional and conveys whether the associated Object property has been obfuscated.</p> </td> </tr> <tr> <td>@obfuscation_algorithm_ref<span class="occurrence">optional</span></td> <td> anyURI </td> <td> <p>This field is optional and conveys a reference to a description of the algorithm used to obfuscate this Object property.</p> </td> </tr> <tr> <td>@is_defanged<span class="occurrence">optional</span></td> <td> boolean </td> <td> <p>This field is optional and conveys whether the associated Object property has been defanged (representation changed to prevent malicious effects of handling/processing).</p> </td> </tr> <tr> <td>@defanging_algorithm_ref<span class="occurrence">optional</span></td> <td> anyURI </td> <td> <p>This field is optional and conveys a reference to a description of the algorithm used to defang (representation changed to prevent malicious effects of handling/processing) this Object property.</p> </td> </tr> <tr> <td>@refanging_transform_type<span class="occurrence">optional</span></td> <td> string </td> <td> <p>This field is optional and specifies the type (e.g. RegEx) of refanging transform specified in the optional accompanying refangingTransform property.</p> </td> </tr> <tr> <td>@refanging_transform<span class="occurrence">optional</span></td> <td> string </td> <td> <p>This field is optional and specifies an automated transform that can be applied to the Object property content in order to refang it to its original format.</p> </td> </tr> <tr> <td>@condition<span class="occurrence">optional</span></td> <td> ConditionTypeEnum </td> <td> <p>This field is optional and defines the relevant condition to apply to the value.</p> </td> </tr> <tr> <td>@apply_condition<span class="occurrence">optional</span></td> <td> ConditionApplicationEnum </td> <td> <p>This field indicates how a condition should be applied when the field body contains a list of values. (Its value is moot if the field value contains only a single value - both possible values for this field would have the same behavior.) If this field is set to ANY, then a pattern is considered to be matched if the provided condition successfully evaluates for any of the values in the field body. If the field is set to ALL, then the patern only matches if the provided condition successfully evaluates for every value in the field body.</p> </td> </tr> <tr> <td>@bit_mask<span class="occurrence">optional</span></td> <td> hexBinary </td> <td> <p>Used to specify a bit_mask in conjunction with one of the defined binary conditions (bitwiseAnd, bitwiseOr, and bitwiseXor). This bitmask is then uses as one operand in the indicated bitwise computation.</p> </td> </tr> <tr> <td>@pattern_type<span class="occurrence">optional</span></td> <td> PatternTypeEnum </td> <td> <p>This field is optional and defines the type of pattern used if one is specified for the field value. This is applicable only if the Condition field is set to 'FitsPattern'. </p> </td> </tr> <tr> <td>@regex_syntax<span class="occurrence">optional</span></td> <td> string </td> <td> <p>This field is optional and defines the syntax format used for a regular expression, if one is specified for the field value. This is applicable only if the Condition field is set to 'FitsPattern'.</p> <p> </p> <p> Setting this attribute with an empty value (e.g., "") or omitting it entirely notifies CybOX consumers and pattern evaluators that the corresponding regular expression utilizes capabilities, character classes, escapes, and other lexical tokens defined by the CybOX Language Specification. </p> <p> </p> <p> Setting this attribute with a non-empty value notifies CybOX consumers and pattern evaluators that the corresponding regular expression utilizes capabilities not definied by the CybOX Language Specification. The regular expression must be evaluated through a compatible regular expression engine in this case.</p> <p> </p> </td> </tr> <tr> <td>@has_changed<span class="occurrence">optional</span></td> <td> boolean </td> <td> <p>This field is optional and conveys a targeted observation pattern of whether the associated field value has changed. This field would be leveraged within a pattern observable triggering on whether the value of a single field value has changed.</p> </td> </tr> <tr> <td>@trend<span class="occurrence">optional</span></td> <td> boolean </td> <td> <p>This field is optional and conveys a targeted observation pattern of the nature of any trend in the associated field value. This field would be leveraged within a pattern observable triggering on the matching of a specified trend in the value of a single specified field.</p> </td> </tr> </tbody> </table>
johnwunder/johnwunder.github.io
data-model/1.0.1/NetworkSocketObj/AddressFamilyType/index.html
HTML
bsd-3-clause
9,017
// Copyright 2012 The Go Authors. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. /* In the absence of any formal way to specify interfaces in JavaScript, here's a skeleton implementation of a playground transport. function Transport() { // Set up any transport state (eg, make a websocket connnection). return { Run: function(body, output, options) { // Compile and run the program 'body' with 'options'. // Call the 'output' callback to display program output. return { Kill: function() { // Kill the running program. } }; } }; } // The output callback is called multiple times, and each time it is // passed an object of this form. var write = { Kind: 'string', // 'start', 'stdout', 'stderr', 'end' Body: 'string' // content of write or end status message } // The first call must be of Kind 'start' with no body. // Subsequent calls may be of Kind 'stdout' or 'stderr' // and must have a non-null Body string. // The final call should be of Kind 'end' with an optional // Body string, signifying a failure ("killed", for example). // The output callback must be of this form. // See PlaygroundOutput (below) for an implementation. function outputCallback(write) { } */ function HTTPTransport() { 'use strict'; // TODO(adg): support stderr function playback(output, events) { var timeout; output({Kind: 'start'}); function next() { if (events.length === 0) { output({Kind: 'end'}); return; } var e = events.shift(); if (e.Delay === 0) { output({Kind: 'stdout', Body: e.Message}); next(); return; } timeout = setTimeout(function() { output({Kind: 'stdout', Body: e.Message}); next(); }, e.Delay / 1000000); } next(); return { Stop: function() { clearTimeout(timeout); } } } function error(output, msg) { output({Kind: 'start'}); output({Kind: 'stderr', Body: msg}); output({Kind: 'end'}); } var seq = 0; return { Run: function(body, output, options) { seq++; var cur = seq; var playing; $.ajax('/compile', { type: 'POST', data: {'version': 2, 'body': body}, dataType: 'json', success: function(data) { if (seq != cur) return; if (!data) return; if (playing != null) playing.Stop(); if (data.Errors) { error(output, data.Errors); return; } playing = playback(output, data.Events); }, error: function() { error(output, 'Error communicating with remote server.'); } }); return { Kill: function() { if (playing != null) playing.Stop(); output({Kind: 'end', Body: 'killed'}); } }; } }; } function SocketTransport() { 'use strict'; var id = 0; var outputs = {}; var started = {}; var websocket = new WebSocket('ws://' + window.location.host + '/socket'); websocket.onclose = function() { console.log('websocket connection closed'); } websocket.onmessage = function(e) { var m = JSON.parse(e.data); var output = outputs[m.Id]; if (output === null) return; if (!started[m.Id]) { output({Kind: 'start'}); started[m.Id] = true; } output({Kind: m.Kind, Body: m.Body}); } function send(m) { websocket.send(JSON.stringify(m)); } return { Run: function(body, output, options) { var thisID = id+''; id++; outputs[thisID] = output; send({Id: thisID, Kind: 'run', Body: body, Options: options}); return { Kill: function() { send({Id: thisID, Kind: 'kill'}); } }; } }; } function PlaygroundOutput(el) { 'use strict'; return function(write) { if (write.Kind == 'start') { el.innerHTML = ''; return; } var cl = 'system'; if (write.Kind == 'stdout' || write.Kind == 'stderr') cl = write.Kind; var m = write.Body; if (write.Kind == 'end') m = '\nProgram exited' + (m?(': '+m):'.'); if (m.indexOf('IMAGE:') === 0) { // TODO(adg): buffer all writes before creating image var url = 'data:image/png;base64,' + m.substr(6); var img = document.createElement('img'); img.src = url; el.appendChild(img); return; } // ^L clears the screen. var s = m.split('\x0c'); if (s.length > 1) { el.innerHTML = ''; m = s.pop(); } m = m.replace(/&/g, '&amp;'); m = m.replace(/</g, '&lt;'); m = m.replace(/>/g, '&gt;'); var needScroll = (el.scrollTop + el.offsetHeight) == el.scrollHeight; var span = document.createElement('span'); span.className = cl; span.innerHTML = m; el.appendChild(span); if (needScroll) el.scrollTop = el.scrollHeight - el.offsetHeight; } } (function() { function lineHighlight(error) { var regex = /prog.go:([0-9]+)/g; var r = regex.exec(error); while (r) { $(".lines div").eq(r[1]-1).addClass("lineerror"); r = regex.exec(error); } } function highlightOutput(wrappedOutput) { return function(write) { if (write.Body) lineHighlight(write.Body); wrappedOutput(write); } } function lineClear() { $(".lineerror").removeClass("lineerror"); } // opts is an object with these keys // codeEl - code editor element // outputEl - program output element // runEl - run button element // fmtEl - fmt button element (optional) // fmtImportEl - fmt "imports" checkbox element (optional) // shareEl - share button element (optional) // shareURLEl - share URL text input element (optional) // shareRedirect - base URL to redirect to on share (optional) // toysEl - toys select element (optional) // enableHistory - enable using HTML5 history API (optional) // transport - playground transport to use (default is HTTPTransport) function playground(opts) { var code = $(opts.codeEl); var transport = opts['transport'] || new HTTPTransport(); var running; // autoindent helpers. function insertTabs(n) { // find the selection start and end var start = code[0].selectionStart; var end = code[0].selectionEnd; // split the textarea content into two, and insert n tabs var v = code[0].value; var u = v.substr(0, start); for (var i=0; i<n; i++) { u += "\t"; } u += v.substr(end); // set revised content code[0].value = u; // reset caret position after inserted tabs code[0].selectionStart = start+n; code[0].selectionEnd = start+n; } function autoindent(el) { var curpos = el.selectionStart; var tabs = 0; while (curpos > 0) { curpos--; if (el.value[curpos] == "\t") { tabs++; } else if (tabs > 0 || el.value[curpos] == "\n") { break; } } setTimeout(function() { insertTabs(tabs); }, 1); } function keyHandler(e) { if (e.keyCode == 9 && !e.ctrlKey) { // tab (but not ctrl-tab) insertTabs(1); e.preventDefault(); return false; } if (e.keyCode == 13) { // enter if (e.shiftKey) { // +shift run(); e.preventDefault(); return false; } else { autoindent(e.target); } } return true; } code.unbind('keydown').bind('keydown', keyHandler); var outdiv = $(opts.outputEl).empty(); var output = $('<pre/>').appendTo(outdiv); function body() { return $(opts.codeEl).val(); } function setBody(text) { $(opts.codeEl).val(text); } function origin(href) { return (""+href).split("/").slice(0, 3).join("/"); } var pushedEmpty = (window.location.pathname == "/"); function inputChanged() { if (pushedEmpty) { return; } pushedEmpty = true; $(opts.shareURLEl).hide(); window.history.pushState(null, "", "/"); } function popState(e) { if (e === null) { return; } if (e && e.state && e.state.code) { setBody(e.state.code); } } var rewriteHistory = false; if (window.history && window.history.pushState && window.addEventListener && opts.enableHistory) { rewriteHistory = true; code[0].addEventListener('input', inputChanged); window.addEventListener('popstate', popState); } function setError(error) { if (running) running.Kill(); lineClear(); lineHighlight(error); output.empty().addClass("error").text(error); } function loading() { lineClear(); if (running) running.Kill(); output.removeClass("error").text('Waiting for remote server...'); } function run() { loading(); running = transport.Run(body(), highlightOutput(PlaygroundOutput(output[0]))); } function fmt() { loading(); var data = {"body": body()}; if ($(opts.fmtImportEl).is(":checked")) { data["imports"] = "true"; } $.ajax("/fmt", { data: data, type: "POST", dataType: "json", success: function(data) { if (data.Error) { setError(data.Error); } else { setBody(data.Body); setError(""); } } }); } $(opts.runEl).click(run); $(opts.fmtEl).click(fmt); if (opts.shareEl !== null && (opts.shareURLEl !== null || opts.shareRedirect !== null)) { var shareURL; if (opts.shareURLEl) { shareURL = $(opts.shareURLEl).hide(); } var sharing = false; $(opts.shareEl).click(function() { if (sharing) return; sharing = true; var sharingData = body(); $.ajax("/share", { processData: false, data: sharingData, type: "POST", complete: function(xhr) { sharing = false; if (xhr.status != 200) { alert("Server error; try again."); return; } if (opts.shareRedirect) { window.location = opts.shareRedirect + xhr.responseText; } if (shareURL) { var path = "/p/" + xhr.responseText; var url = origin(window.location) + path; shareURL.show().val(url).focus().select(); if (rewriteHistory) { var historyData = {"code": sharingData}; window.history.pushState(historyData, "", path); pushedEmpty = false; } } } }); }); } if (opts.toysEl !== null) { $(opts.toysEl).bind('change', function() { var toy = $(this).val(); $.ajax("/doc/play/"+toy, { processData: false, type: "GET", complete: function(xhr) { if (xhr.status != 200) { alert("Server error; try again."); return; } setBody(xhr.responseText); } }); }); } } window.playground = playground; })();
polaris1119/go.tools
godoc/static/playground.js
JavaScript
bsd-3-clause
11,347
/** * Select2 Slovak translation. * * Author: David Vallner <[email protected]> */ (function ($) { "use strict"; // use text for the numbers 2 through 4 var smallNumbers = { 2: function (masc) { return (masc ? "dva" : "dve"); }, 3: function () { return "tri"; }, 4: function () { return "štyri"; } } $.extend($.fn.select2.defaults, { formatNoMatches: function () { return "Nenašli sa žiadne položky"; }, formatInputTooShort: function (input, min) { var n = min - input.length; if (n == 1) { return "Prosím zadajte ešte jeden znak"; } else if (n <= 4) { return "Prosím zadajte ešte ďalšie " + smallNumbers[n](true) + " znaky"; } else { return "Prosím zadajte ešte ďalších " + n + " znakov"; } }, formatInputTooLong: function (input, max) { var n = input.length - max; if (n == 1) { return "Prosím zadajte o jeden znak menej"; } else if (n <= 4) { return "Prosím zadajte o " + smallNumbers[n](true) + " znaky menej"; } else { return "Prosím zadajte o " + n + " znakov menej"; } }, formatSelectionTooBig: function (limit) { if (limit == 1) { return "Môžete zvoliť len jednu položku"; } else if (limit <= 4) { return "Môžete zvoliť najviac " + smallNumbers[limit](false) + " položky"; } else { return "Môžete zvoliť najviac " + limit + " položiek"; } }, formatLoadMore: function (pageNumber) { return "Načítavajú sa ďalšie výsledky..."; }, formatSearching: function () { return "Vyhľadávanie..."; } }); })(jQuery);
il-marc/Yii-BookStore
vendor/marciocamello/yii2-x-editable/assets/select2/select2_locale_sk.js
JavaScript
bsd-3-clause
1,591
from datetime import datetime, timedelta from dateutil import tz import numpy as np import pandas as pd from pandas import DataFrame, Index, Series, Timestamp, date_range from pandas.util import testing as tm class TestDatetimeIndex(object): def test_setitem_with_datetime_tz(self): # 16889 # support .loc with alignment and tz-aware DatetimeIndex mask = np.array([True, False, True, False]) idx = date_range('20010101', periods=4, tz='UTC') df = DataFrame({'a': np.arange(4)}, index=idx).astype('float64') result = df.copy() result.loc[mask, :] = df.loc[mask, :] tm.assert_frame_equal(result, df) result = df.copy() result.loc[mask] = df.loc[mask] tm.assert_frame_equal(result, df) idx = date_range('20010101', periods=4) df = DataFrame({'a': np.arange(4)}, index=idx).astype('float64') result = df.copy() result.loc[mask, :] = df.loc[mask, :] tm.assert_frame_equal(result, df) result = df.copy() result.loc[mask] = df.loc[mask] tm.assert_frame_equal(result, df) def test_indexing_with_datetime_tz(self): # 8260 # support datetime64 with tz idx = Index(date_range('20130101', periods=3, tz='US/Eastern'), name='foo') dr = date_range('20130110', periods=3) df = DataFrame({'A': idx, 'B': dr}) df['C'] = idx df.iloc[1, 1] = pd.NaT df.iloc[1, 2] = pd.NaT # indexing result = df.iloc[1] expected = Series([Timestamp('2013-01-02 00:00:00-0500', tz='US/Eastern'), np.nan, np.nan], index=list('ABC'), dtype='object', name=1) tm.assert_series_equal(result, expected) result = df.loc[1] expected = Series([Timestamp('2013-01-02 00:00:00-0500', tz='US/Eastern'), np.nan, np.nan], index=list('ABC'), dtype='object', name=1) tm.assert_series_equal(result, expected) # indexing - fast_xs df = DataFrame({'a': date_range('2014-01-01', periods=10, tz='UTC')}) result = df.iloc[5] expected = Timestamp('2014-01-06 00:00:00+0000', tz='UTC', freq='D') assert result == expected result = df.loc[5] assert result == expected # indexing - boolean result = df[df.a > df.a[3]] expected = df.iloc[4:] tm.assert_frame_equal(result, expected) # indexing - setting an element df = DataFrame(data=pd.to_datetime( ['2015-03-30 20:12:32', '2015-03-12 00:11:11']), columns=['time']) df['new_col'] = ['new', 'old'] df.time = df.set_index('time').index.tz_localize('UTC') v = df[df.new_col == 'new'].set_index('time').index.tz_convert( 'US/Pacific') # trying to set a single element on a part of a different timezone # this converts to object df2 = df.copy() df2.loc[df2.new_col == 'new', 'time'] = v expected = Series([v[0], df.loc[1, 'time']], name='time') tm.assert_series_equal(df2.time, expected) v = df.loc[df.new_col == 'new', 'time'] + pd.Timedelta('1s') df.loc[df.new_col == 'new', 'time'] = v tm.assert_series_equal(df.loc[df.new_col == 'new', 'time'], v) def test_consistency_with_tz_aware_scalar(self): # xef gh-12938 # various ways of indexing the same tz-aware scalar df = Series([Timestamp('2016-03-30 14:35:25', tz='Europe/Brussels')]).to_frame() df = pd.concat([df, df]).reset_index(drop=True) expected = Timestamp('2016-03-30 14:35:25+0200', tz='Europe/Brussels') result = df[0][0] assert result == expected result = df.iloc[0, 0] assert result == expected result = df.loc[0, 0] assert result == expected result = df.iat[0, 0] assert result == expected result = df.at[0, 0] assert result == expected result = df[0].loc[0] assert result == expected result = df[0].at[0] assert result == expected def test_indexing_with_datetimeindex_tz(self): # GH 12050 # indexing on a series with a datetimeindex with tz index = date_range('2015-01-01', periods=2, tz='utc') ser = Series(range(2), index=index, dtype='int64') # list-like indexing for sel in (index, list(index)): # getitem tm.assert_series_equal(ser[sel], ser) # setitem result = ser.copy() result[sel] = 1 expected = Series(1, index=index) tm.assert_series_equal(result, expected) # .loc getitem tm.assert_series_equal(ser.loc[sel], ser) # .loc setitem result = ser.copy() result.loc[sel] = 1 expected = Series(1, index=index) tm.assert_series_equal(result, expected) # single element indexing # getitem assert ser[index[1]] == 1 # setitem result = ser.copy() result[index[1]] = 5 expected = Series([0, 5], index=index) tm.assert_series_equal(result, expected) # .loc getitem assert ser.loc[index[1]] == 1 # .loc setitem result = ser.copy() result.loc[index[1]] = 5 expected = Series([0, 5], index=index) tm.assert_series_equal(result, expected) def test_partial_setting_with_datetimelike_dtype(self): # GH9478 # a datetimeindex alignment issue with partial setting df = DataFrame(np.arange(6.).reshape(3, 2), columns=list('AB'), index=date_range('1/1/2000', periods=3, freq='1H')) expected = df.copy() expected['C'] = [expected.index[0]] + [pd.NaT, pd.NaT] mask = df.A < 1 df.loc[mask, 'C'] = df.loc[mask].index tm.assert_frame_equal(df, expected) def test_loc_setitem_datetime(self): # GH 9516 dt1 = Timestamp('20130101 09:00:00') dt2 = Timestamp('20130101 10:00:00') for conv in [lambda x: x, lambda x: x.to_datetime64(), lambda x: x.to_pydatetime(), lambda x: np.datetime64(x)]: df = DataFrame() df.loc[conv(dt1), 'one'] = 100 df.loc[conv(dt2), 'one'] = 200 expected = DataFrame({'one': [100.0, 200.0]}, index=[dt1, dt2]) tm.assert_frame_equal(df, expected) def test_series_partial_set_datetime(self): # GH 11497 idx = date_range('2011-01-01', '2011-01-02', freq='D', name='idx') ser = Series([0.1, 0.2], index=idx, name='s') result = ser.loc[[Timestamp('2011-01-01'), Timestamp('2011-01-02')]] exp = Series([0.1, 0.2], index=idx, name='s') tm.assert_series_equal(result, exp, check_index_type=True) keys = [Timestamp('2011-01-02'), Timestamp('2011-01-02'), Timestamp('2011-01-01')] exp = Series([0.2, 0.2, 0.1], index=pd.DatetimeIndex(keys, name='idx'), name='s') tm.assert_series_equal(ser.loc[keys], exp, check_index_type=True) keys = [Timestamp('2011-01-03'), Timestamp('2011-01-02'), Timestamp('2011-01-03')] exp = Series([np.nan, 0.2, np.nan], index=pd.DatetimeIndex(keys, name='idx'), name='s') with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): tm.assert_series_equal(ser.loc[keys], exp, check_index_type=True) def test_series_partial_set_period(self): # GH 11497 idx = pd.period_range('2011-01-01', '2011-01-02', freq='D', name='idx') ser = Series([0.1, 0.2], index=idx, name='s') result = ser.loc[[pd.Period('2011-01-01', freq='D'), pd.Period('2011-01-02', freq='D')]] exp = Series([0.1, 0.2], index=idx, name='s') tm.assert_series_equal(result, exp, check_index_type=True) keys = [pd.Period('2011-01-02', freq='D'), pd.Period('2011-01-02', freq='D'), pd.Period('2011-01-01', freq='D')] exp = Series([0.2, 0.2, 0.1], index=pd.PeriodIndex(keys, name='idx'), name='s') tm.assert_series_equal(ser.loc[keys], exp, check_index_type=True) keys = [pd.Period('2011-01-03', freq='D'), pd.Period('2011-01-02', freq='D'), pd.Period('2011-01-03', freq='D')] exp = Series([np.nan, 0.2, np.nan], index=pd.PeriodIndex(keys, name='idx'), name='s') with tm.assert_produces_warning(FutureWarning, check_stacklevel=False): result = ser.loc[keys] tm.assert_series_equal(result, exp) def test_nanosecond_getitem_setitem_with_tz(self): # GH 11679 data = ['2016-06-28 08:30:00.123456789'] index = pd.DatetimeIndex(data, dtype='datetime64[ns, America/Chicago]') df = DataFrame({'a': [10]}, index=index) result = df.loc[df.index[0]] expected = Series(10, index=['a'], name=df.index[0]) tm.assert_series_equal(result, expected) result = df.copy() result.loc[df.index[0], 'a'] = -1 expected = DataFrame(-1, index=index, columns=['a']) tm.assert_frame_equal(result, expected) def test_loc_getitem_across_dst(self): # GH 21846 idx = pd.date_range('2017-10-29 01:30:00', tz='Europe/Berlin', periods=5, freq='30 min') series2 = pd.Series([0, 1, 2, 3, 4], index=idx) t_1 = pd.Timestamp('2017-10-29 02:30:00+02:00', tz='Europe/Berlin', freq='30min') t_2 = pd.Timestamp('2017-10-29 02:00:00+01:00', tz='Europe/Berlin', freq='30min') result = series2.loc[t_1:t_2] expected = pd.Series([2, 3], index=idx[2:4]) tm.assert_series_equal(result, expected) result = series2[t_1] expected = 2 assert result == expected def test_loc_incremental_setitem_with_dst(self): # GH 20724 base = datetime(2015, 11, 1, tzinfo=tz.gettz("US/Pacific")) idxs = [base + timedelta(seconds=i * 900) for i in range(16)] result = pd.Series([0], index=[idxs[0]]) for ts in idxs: result.loc[ts] = 1 expected = pd.Series(1, index=idxs) tm.assert_series_equal(result, expected) def test_loc_setitem_with_existing_dst(self): # GH 18308 start = pd.Timestamp('2017-10-29 00:00:00+0200', tz='Europe/Madrid') end = pd.Timestamp('2017-10-29 03:00:00+0100', tz='Europe/Madrid') ts = pd.Timestamp('2016-10-10 03:00:00', tz='Europe/Madrid') idx = pd.date_range(start, end, closed='left', freq="H") result = pd.DataFrame(index=idx, columns=['value']) result.loc[ts, 'value'] = 12 expected = pd.DataFrame([np.nan] * len(idx) + [12], index=idx.append(pd.DatetimeIndex([ts])), columns=['value'], dtype=object) tm.assert_frame_equal(result, expected)
GuessWhoSamFoo/pandas
pandas/tests/indexing/test_datetime.py
Python
bsd-3-clause
11,482
/*jslint browser: true, devel: true, node: true, ass: true, nomen: true, unparam: true, indent: 4 */ /** * @license * Copyright (c) 2015 The ExpandJS authors. All rights reserved. * This code may only be used under the BSD style license found at https://expandjs.github.io/LICENSE.txt * The complete set of authors may be found at https://expandjs.github.io/AUTHORS.txt * The complete set of contributors may be found at https://expandjs.github.io/CONTRIBUTORS.txt */ (function () { "use strict"; var assertArgument = require('../assert/assertArgument'), includes = require('../collection/includes'), isArray = require('../tester/isArray'), isString = require('../tester/isString'), push = require('../array/push'); /** * Adds a value at the end of an array, if it doesn't already exist, * and returns the passed element. * * A string can also be passed instead of an array, and the value will * be added at the end of the string, if it doesn't already exist in * the string. This time the whole string will be returned. * * ```js * var list = [1, 2, 3]; * * XP.append(list, 4); * // => 4 * * console.log(list); * // => [1, 2, 3, 4] * * XP.append(list, 1); * // => 1 * * console.log(list); * // => [1, 2, 3, 4] * * * var file = '123'; * * XP.append(file, '.js'); * // => '123.js' * * console.log(file); * // => '123.js' * * XP.append(file, '.js') * // => '123.js' * ``` * * @function append * @param {Array | string} array The array/string to modify. * @param {*} value The value to be added to the array/string. * @returns {*} Returns the appended `value`. */ module.exports = function append(array, value) { assertArgument(isString(array) || isArray(array), 1, 'Array or string'); return !includes(array, value) ? push(array, value) : (isString(array) ? array : value); }; }());
rl189020/expandjs
lib/array/append.js
JavaScript
bsd-3-clause
2,087
# Copied from # https://github.com/dev-cafe/cmake-cookbook/blob/master/chapter-07/recipe-03/c-cxx-example/set_compiler_flag.cmake # Adapted from # https://github.com/robertodr/ddPCM/blob/expose-C-api/cmake/custom/compilers/SetCompilerFlag.cmake # which was adapted by Roberto Di Remigio from # https://github.com/SethMMorton/cmake_fortran_template/blob/master/cmake/Modules/SetCompileFlag.cmake # Given a list of flags, this stateless function will try each, one at a time, # and set result to the first flag that works. # If none of the flags works, result is "". # If the REQUIRED key is given and no flag is found, a FATAL_ERROR is raised. # # Call is: # set_compile_flag(result (Fortran|C|CXX) <REQUIRED> flag1 flag2 ...) # # Example: # set_compiler_flag(working_compile_flag C REQUIRED "-Wall" "-warn all") include(CheckCCompilerFlag) include(CheckCXXCompilerFlag) include(CheckFortranCompilerFlag) function(set_compiler_flag _result _lang) # build a list of flags from the arguments set(_list_of_flags) # also figure out whether the function # is required to find a flag set(_flag_is_required FALSE) foreach(_arg IN ITEMS ${ARGN}) string(TOUPPER "${_arg}" _arg_uppercase) if(_arg_uppercase STREQUAL "REQUIRED") set(_flag_is_required TRUE) else() list(APPEND _list_of_flags "${_arg}") endif() endforeach() set(_flag_found FALSE) # loop over all flags, try to find the first which works foreach(flag IN ITEMS ${_list_of_flags}) unset(_${flag}_works CACHE) if(_lang STREQUAL "C") check_c_compiler_flag("${flag}" _${flag}_works) elseif(_lang STREQUAL "CXX") check_cxx_compiler_flag("${flag}" _${flag}_works) elseif(_lang STREQUAL "Fortran") check_Fortran_compiler_flag("${flag}" _${flag}_works) else() message(FATAL_ERROR "Unknown language in set_compiler_flag: ${_lang}") endif() # if the flag works, use it, and exit # otherwise try next flag if(_${flag}_works) set(${_result} "${flag}" PARENT_SCOPE) set(_flag_found TRUE) break() endif() endforeach() # raise an error if no flag was found if(_flag_is_required AND NOT _flag_found) message(FATAL_ERROR "None of the required flags were supported") endif() endfunction()
xtensor-stack/xtensor
test/set_compiler_flag.cmake
CMake
bsd-3-clause
2,272
#ifndef _ROS_SERVICE_GetMap_h #define _ROS_SERVICE_GetMap_h #include <stdint.h> #include <string.h> #include <stdlib.h> #include "ros/msg.h" #include "rtabmap/MapData.h" namespace rtabmap { static const char GETMAP[] = "rtabmap/GetMap"; class GetMapRequest : public ros::Msg { public: bool global; bool optimized; bool graphOnly; virtual int serialize(unsigned char *outbuffer) const { int offset = 0; union { bool real; uint8_t base; } u_global; u_global.real = this->global; *(outbuffer + offset + 0) = (u_global.base >> (8 * 0)) & 0xFF; offset += sizeof(this->global); union { bool real; uint8_t base; } u_optimized; u_optimized.real = this->optimized; *(outbuffer + offset + 0) = (u_optimized.base >> (8 * 0)) & 0xFF; offset += sizeof(this->optimized); union { bool real; uint8_t base; } u_graphOnly; u_graphOnly.real = this->graphOnly; *(outbuffer + offset + 0) = (u_graphOnly.base >> (8 * 0)) & 0xFF; offset += sizeof(this->graphOnly); return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; union { bool real; uint8_t base; } u_global; u_global.base = 0; u_global.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); this->global = u_global.real; offset += sizeof(this->global); union { bool real; uint8_t base; } u_optimized; u_optimized.base = 0; u_optimized.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); this->optimized = u_optimized.real; offset += sizeof(this->optimized); union { bool real; uint8_t base; } u_graphOnly; u_graphOnly.base = 0; u_graphOnly.base |= ((uint8_t) (*(inbuffer + offset + 0))) << (8 * 0); this->graphOnly = u_graphOnly.real; offset += sizeof(this->graphOnly); return offset; } const char * getType(){ return GETMAP; }; const char * getMD5(){ return "6213f9f13cced23f4d224b22f59d839c"; }; }; class GetMapResponse : public ros::Msg { public: rtabmap::MapData data; virtual int serialize(unsigned char *outbuffer) const { int offset = 0; offset += this->data.serialize(outbuffer + offset); return offset; } virtual int deserialize(unsigned char *inbuffer) { int offset = 0; offset += this->data.deserialize(inbuffer + offset); return offset; } const char * getType(){ return GETMAP; }; const char * getMD5(){ return "69f766e520db62e04759ab65a6133a3c"; }; }; class GetMap { public: typedef GetMapRequest Request; typedef GetMapResponse Response; }; } #endif
intelligenceBGU/komodo
ric_mc/Arduino/libraries/ros_lib/rtabmap/GetMap.h
C
bsd-3-clause
2,828
build_config = { "version": "0.1", "projects": { "w32-msgbox-shellcode-hash-list.asm": { # List of hashes "files": { "w32-msgbox-shellcode-hash-list.asm": { "sources": ["w32-msgbox-shellcode-hash-list.txt"], "build commands": [ ["hash\\hash.cmd", "--input=w32-msgbox-shellcode-hash-list.txt", "--output=w32-msgbox-shellcode-hash-list.asm"], ], }, }, }, "w32-msgbox-shellcode.bin": { "architecture": "x86", "dependencies": ["w32-msgbox-shellcode-hash-list.asm"], "files": { "w32-msgbox-shellcode.bin": { "sources": ["w32-msgbox-shellcode.asm"], "includes": ["w32-msgbox-shellcode-hash-list.asm"], }, }, }, "w32-msgbox-shellcode-esp.bin": { "architecture": "x86", "dependencies": ["w32-msgbox-shellcode-hash-list.asm"], "files": { "w32-msgbox-shellcode-esp.bin": { "sources": ["w32-msgbox-shellcode.asm"], "includes": ["w32-msgbox-shellcode-hash-list.asm"], "defines": {"STACK_ALIGN": "TRUE"}, }, }, }, "w32-msgbox-shellcode-eaf.bin": { "architecture": "x86", "dependencies": ["w32-msgbox-shellcode-hash-list.asm"], "files": { "w32-msgbox-shellcode-eaf.bin": { "sources": ["w32-msgbox-shellcode.asm"], "includes": ["w32-msgbox-shellcode-hash-list.asm"], "defines": {"DEFEAT_EAF": "TRUE"}, }, }, }, }, "test commands": ["test-w32-msgbox-shellcode.cmd"], }
ohio813/w32-msgbox-shellcode
build_config.py
Python
bsd-3-clause
1,682
/* * Copyright (C) 2006 Apple Inc. All rights reserved. * Copyright (C) 2006, 2008 Nikolas Zimmermann <[email protected]> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library 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 * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef SVGDocumentExtensions_h #define SVGDocumentExtensions_h #include "core/layout/svg/SVGResourcesCache.h" #include "platform/geometry/FloatPoint.h" #include "platform/heap/Handle.h" #include "wtf/Forward.h" #include "wtf/HashMap.h" #include "wtf/HashSet.h" #include "wtf/text/AtomicStringHash.h" namespace blink { class Document; class LayoutSVGResourceContainer; class SubtreeLayoutScope; class SVGSVGElement; class SVGElement; class Element; class SVGDocumentExtensions : public NoBaseWillBeGarbageCollectedFinalized<SVGDocumentExtensions> { WTF_MAKE_NONCOPYABLE(SVGDocumentExtensions); USING_FAST_MALLOC_WILL_BE_REMOVED(SVGDocumentExtensions); public: typedef WillBeHeapHashSet<RawPtrWillBeMember<Element>> SVGPendingElements; explicit SVGDocumentExtensions(Document*); ~SVGDocumentExtensions(); void addTimeContainer(SVGSVGElement*); void removeTimeContainer(SVGSVGElement*); // Records the SVG element as having a Web Animation on an SVG attribute that needs applying. void addWebAnimationsPendingSVGElement(SVGElement&); void addResource(const AtomicString& id, LayoutSVGResourceContainer*); void removeResource(const AtomicString& id); LayoutSVGResourceContainer* resourceById(const AtomicString& id) const; static void serviceOnAnimationFrame(Document&, double monotonicAnimationStartTime); void startAnimations(); void pauseAnimations(); void dispatchSVGLoadEventToOutermostSVGElements(); void reportError(const String&); SVGResourcesCache& resourcesCache() { return m_resourcesCache; } void addSVGRootWithRelativeLengthDescendents(SVGSVGElement*); void removeSVGRootWithRelativeLengthDescendents(SVGSVGElement*); bool isSVGRootWithRelativeLengthDescendents(SVGSVGElement*) const; void invalidateSVGRootsWithRelativeLengthDescendents(SubtreeLayoutScope*); bool zoomAndPanEnabled() const; void startPan(const FloatPoint& start); void updatePan(const FloatPoint& pos) const; static SVGSVGElement* rootElement(const Document&); SVGSVGElement* rootElement() const; DECLARE_TRACE(); private: RawPtrWillBeMember<Document> m_document; WillBeHeapHashSet<RawPtrWillBeMember<SVGSVGElement>> m_timeContainers; // For SVG 1.2 support this will need to be made more general. using SVGElementSet = WillBeHeapHashSet<RefPtrWillBeMember<SVGElement>>; SVGElementSet m_webAnimationsPendingSVGElements; HashMap<AtomicString, LayoutSVGResourceContainer*> m_resources; WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<SVGPendingElements>> m_pendingResources; // Resources that are pending. WillBeHeapHashMap<AtomicString, OwnPtrWillBeMember<SVGPendingElements>> m_pendingResourcesForRemoval; // Resources that are pending and scheduled for removal. SVGResourcesCache m_resourcesCache; WillBeHeapHashSet<RawPtrWillBeMember<SVGSVGElement>> m_relativeLengthSVGRoots; // Root SVG elements with relative length descendants. FloatPoint m_translate; #if ENABLE(ASSERT) bool m_inRelativeLengthSVGRootsInvalidation; #endif public: // This HashMap contains a list of pending resources. Pending resources, are such // which are referenced by any object in the SVG document, but do NOT exist yet. // For instance, dynamically build gradients / patterns / clippers... void addPendingResource(const AtomicString& id, Element*); bool hasPendingResource(const AtomicString& id) const; bool isElementPendingResources(Element*) const; bool isElementPendingResource(Element*, const AtomicString& id) const; void clearHasPendingResourcesIfPossible(Element*); void removeElementFromPendingResources(Element*); PassOwnPtrWillBeRawPtr<SVGPendingElements> removePendingResource(const AtomicString& id); void serviceAnimations(double monotonicAnimationStartTime); // The following two functions are used for scheduling a pending resource to be removed. void markPendingResourcesForRemoval(const AtomicString&); Element* removeElementFromPendingResourcesForRemoval(const AtomicString&); private: PassOwnPtrWillBeRawPtr<SVGPendingElements> removePendingResourceForRemoval(const AtomicString&); }; } // namespace blink #endif
ds-hwang/chromium-crosswalk
third_party/WebKit/Source/core/svg/SVGDocumentExtensions.h
C
bsd-3-clause
5,133
<?php namespace Reliv\RcmApiLib\Http; use Reliv\RcmApiLib\Model\ApiMessage; use Reliv\RcmApiLib\Model\ApiMessages; /** * @author James Jervis - https://github.com/jerv13 */ trait BasicApiResponseTrait { /** * @var mixed */ protected $data = null; /** * @var ApiMessages */ protected $messages; /** * setData * * @param array|null $data * * @return void */ public function setData($data) { $this->data = $data; } /** * getData * * @return mixed */ public function getData() { return $this->data; } /** * addApiMessages * * @param array $apiMessages ApiMessage * * @return void */ public function addApiMessages($apiMessages = []) { foreach ($apiMessages as $apiMessage) { $this->addApiMessage($apiMessage); } } /** * setApiMessages * * @param ApiMessages $apiMessages * * @return void */ public function setApiMessages(ApiMessages $apiMessages) { $this->messages = $apiMessages; } /** * getApiMessages * * @return ApiMessages */ public function getApiMessages() { return $this->messages; } /** * addApiMessage * * @param ApiMessage $apiMessage * * @return void */ public function addApiMessage(ApiMessage $apiMessage) { $this->messages->add($apiMessage); } }
jerv13/rcm-api-lib
src/Http/BasicApiResponseTrait.php
PHP
bsd-3-clause
1,530
// Copyright 2021 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. import 'chrome://resources/cr_elements/cr_button/cr_button.m.js'; import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.m.js'; import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js'; import {I18nBehavior} from '../i18n_setup.js'; /** * Info dialog that can be populated with custom text via slotting. * @polymer * @extends {PolymerElement} */ export class InfoDialogElement extends mixinBehaviors ([I18nBehavior], PolymerElement) { static get is() { return 'ntp-info-dialog'; } static get template() { return html`{__html_template__}`; } showModal() { this.$.dialog.showModal(); } /** @private */ onCloseClick_() { this.$.dialog.close(); } } customElements.define(InfoDialogElement.is, InfoDialogElement);
ric2b/Vivaldi-browser
chromium/chrome/browser/resources/new_tab_page/modules/info_dialog.js
JavaScript
bsd-3-clause
983
// Copyright 2017 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/win/com_init_check_hook.h" #include <windows.h> #include <objbase.h> #include <stdint.h> #include <string.h> #include "base/notreached.h" #include "base/strings/stringprintf.h" #include "base/synchronization/lock.h" #include "base/win/com_init_util.h" #include "base/win/patch_util.h" namespace base { namespace win { #if defined(COM_INIT_CHECK_HOOK_ENABLED) namespace { // Hotpatchable Microsoft x86 32-bit functions take one of two forms: // Newer format: // RelAddr Binary Instruction Remarks // -5 cc int 3 // -4 cc int 3 // -3 cc int 3 // -2 cc int 3 // -1 cc int 3 // 0 8bff mov edi,edi Actual entry point and no-op. // 2 ... Actual body. // // Older format: // RelAddr Binary Instruction Remarks // -5 90 nop // -4 90 nop // -3 90 nop // -2 90 nop // -1 90 nop // 0 8bff mov edi,edi Actual entry point and no-op. // 2 ... Actual body. // // The "int 3" or nop sled as well as entry point no-op are critical, as they // are just enough to patch in a short backwards jump to -5 (2 bytes) then that // can do a relative 32-bit jump about 2GB before or after the current address. // // To perform a hotpatch, we need to figure out where we want to go and where // we are now as the final jump is relative. Let's say we want to jump to // 0x12345678. Relative jumps are calculated from eip, which for our jump is the // next instruction address. For the example above, that means we start at a 0 // base address. // // Our patch will then look as follows: // RelAddr Binary Instruction Remarks // -5 e978563412 jmp 0x12345678-(-0x5+0x5) Note little-endian format. // 0 ebf9 jmp -0x5-(0x0+0x2) Goes to RelAddr -0x5. // 2 ... Actual body. // Note: The jmp instructions above are structured as // Address(Destination)-(Address(jmp Instruction)+sizeof(jmp Instruction)) // The struct below is provided for convenience and must be packed together byte // by byte with no word alignment padding. This comes at a very small // performance cost because now there are shifts handling the fields, but // it improves readability. #pragma pack(push, 1) struct StructuredHotpatch { unsigned char jmp_32_relative = 0xe9; // jmp relative 32-bit. int32_t relative_address = 0; // 32-bit signed operand. unsigned char jmp_8_relative = 0xeb; // jmp relative 8-bit. unsigned char back_address = 0xf9; // Operand of -7. }; #pragma pack(pop) static_assert(sizeof(StructuredHotpatch) == 7, "Needs to be exactly 7 bytes for the hotpatch to work."); // nop Function Padding with "mov edi,edi" const unsigned char g_hotpatch_placeholder_nop[] = {0x90, 0x90, 0x90, 0x90, 0x90, 0x8b, 0xff}; // int 3 Function Padding with "mov edi,edi" const unsigned char g_hotpatch_placeholder_int3[] = {0xcc, 0xcc, 0xcc, 0xcc, 0xcc, 0x8b, 0xff}; class HookManager { public: static HookManager* GetInstance() { static auto* hook_manager = new HookManager(); return hook_manager; } HookManager(const HookManager&) = delete; HookManager& operator=(const HookManager&) = delete; void RegisterHook() { AutoLock auto_lock(lock_); ++init_count_; if (disabled_) return; if (init_count_ == 1) WriteHook(); } void UnregisterHook() { AutoLock auto_lock(lock_); DCHECK_NE(0U, init_count_); --init_count_; if (disabled_) return; if (init_count_ == 0) RevertHook(); } void DisableCOMChecksForProcess() { AutoLock auto_lock(lock_); if (disabled_) return; disabled_ = true; if (init_count_ > 0) RevertHook(); } private: enum class HotpatchPlaceholderFormat { // The hotpatch placeholder is currently unknown UNKNOWN, // The hotpatch placeholder used int 3's in the sled. INT3, // The hotpatch placeholder used nop's in the sled. NOP, // This function has already been patched by a different component. EXTERNALLY_PATCHED, }; HookManager() = default; ~HookManager() = default; void WriteHook() { lock_.AssertAcquired(); DCHECK(!ole32_library_); ole32_library_ = ::LoadLibrary(L"ole32.dll"); if (!ole32_library_) return; // See banner comment above why this subtracts 5 bytes. co_create_instance_padded_address_ = reinterpret_cast<uint32_t>( GetProcAddress(ole32_library_, "CoCreateInstance")) - 5; // See banner comment above why this adds 7 bytes. original_co_create_instance_body_function_ = reinterpret_cast<decltype(original_co_create_instance_body_function_)>( co_create_instance_padded_address_ + 7); uint32_t dchecked_co_create_instance_address = reinterpret_cast<uint32_t>(&HookManager::DCheckedCoCreateInstance); uint32_t jmp_offset_base_address = co_create_instance_padded_address_ + 5; structured_hotpatch_.relative_address = dchecked_co_create_instance_address - jmp_offset_base_address; HotpatchPlaceholderFormat format = GetHotpatchPlaceholderFormat( reinterpret_cast<const void*>(co_create_instance_padded_address_)); if (format == HotpatchPlaceholderFormat::UNKNOWN) { NOTREACHED() << "Unrecognized hotpatch function format: " << FirstSevenBytesToString( co_create_instance_padded_address_); return; } else if (format == HotpatchPlaceholderFormat::EXTERNALLY_PATCHED) { hotpatch_placeholder_format_ = format; NOTREACHED() << "CoCreateInstance appears to be previously patched. <" << FirstSevenBytesToString( co_create_instance_padded_address_) << "> Attempted to write <" << FirstSevenBytesToString( reinterpret_cast<uint32_t>(&structured_hotpatch_)) << ">"; return; } DCHECK_EQ(hotpatch_placeholder_format_, HotpatchPlaceholderFormat::UNKNOWN); DWORD patch_result = internal::ModifyCode( reinterpret_cast<void*>(co_create_instance_padded_address_), reinterpret_cast<void*>(&structured_hotpatch_), sizeof(structured_hotpatch_)); if (patch_result == NO_ERROR) hotpatch_placeholder_format_ = format; } void RevertHook() { lock_.AssertAcquired(); DWORD revert_result = NO_ERROR; switch (hotpatch_placeholder_format_) { case HotpatchPlaceholderFormat::INT3: if (WasHotpatchChanged()) return; revert_result = internal::ModifyCode( reinterpret_cast<void*>(co_create_instance_padded_address_), reinterpret_cast<const void*>(&g_hotpatch_placeholder_int3), sizeof(g_hotpatch_placeholder_int3)); break; case HotpatchPlaceholderFormat::NOP: if (WasHotpatchChanged()) return; revert_result = internal::ModifyCode( reinterpret_cast<void*>(co_create_instance_padded_address_), reinterpret_cast<const void*>(&g_hotpatch_placeholder_nop), sizeof(g_hotpatch_placeholder_nop)); break; case HotpatchPlaceholderFormat::EXTERNALLY_PATCHED: case HotpatchPlaceholderFormat::UNKNOWN: break; } DCHECK_EQ(revert_result, static_cast<DWORD>(NO_ERROR)) << "Failed to revert CoCreateInstance hot-patch"; hotpatch_placeholder_format_ = HotpatchPlaceholderFormat::UNKNOWN; if (ole32_library_) { ::FreeLibrary(ole32_library_); ole32_library_ = nullptr; } co_create_instance_padded_address_ = 0; original_co_create_instance_body_function_ = nullptr; } HotpatchPlaceholderFormat GetHotpatchPlaceholderFormat(const void* address) { if (::memcmp(reinterpret_cast<void*>(co_create_instance_padded_address_), reinterpret_cast<const void*>(&g_hotpatch_placeholder_int3), sizeof(g_hotpatch_placeholder_int3)) == 0) { return HotpatchPlaceholderFormat::INT3; } if (::memcmp(reinterpret_cast<void*>(co_create_instance_padded_address_), reinterpret_cast<const void*>(&g_hotpatch_placeholder_nop), sizeof(g_hotpatch_placeholder_nop)) == 0) { return HotpatchPlaceholderFormat::NOP; } const unsigned char* instruction_bytes = reinterpret_cast<const unsigned char*>( co_create_instance_padded_address_); const unsigned char entry_point_byte = instruction_bytes[5]; // Check for all of the common jmp opcodes. if (entry_point_byte == 0xeb || entry_point_byte == 0xe9 || entry_point_byte == 0xff || entry_point_byte == 0xea) { return HotpatchPlaceholderFormat::EXTERNALLY_PATCHED; } return HotpatchPlaceholderFormat::UNKNOWN; } bool WasHotpatchChanged() { if (::memcmp(reinterpret_cast<void*>(co_create_instance_padded_address_), reinterpret_cast<const void*>(&structured_hotpatch_), sizeof(structured_hotpatch_)) == 0) { return false; } NOTREACHED() << "CoCreateInstance patch overwritten. Expected: <" << FirstSevenBytesToString(co_create_instance_padded_address_) << ">, Actual: <" << FirstSevenBytesToString( reinterpret_cast<uint32_t>(&structured_hotpatch_)) << ">"; return true; } // Indirect call to original_co_create_instance_body_function_ triggers CFI // so this function must have CFI disabled. static DISABLE_CFI_ICALL HRESULT __stdcall DCheckedCoCreateInstance( const CLSID& rclsid, IUnknown* pUnkOuter, DWORD dwClsContext, REFIID riid, void** ppv) { // Chromium COM callers need to make sure that their thread is configured to // process COM objects to avoid creating an implicit MTA or silently failing // STA object creation call due to the SUCCEEDED() pattern for COM calls. // // If you hit this assert as part of migrating to the Task Scheduler, // evaluate your threading guarantees and dispatch your work with // base::CreateCOMSTATaskRunner(). // // If you need MTA support, ping //base/task/thread_pool/OWNERS. AssertComInitialized( "CoCreateInstance calls in Chromium require explicit COM " "initialization via base::CreateCOMSTATaskRunner() or " "ScopedCOMInitializer. See the comment in DCheckedCoCreateInstance for " "more details."); return original_co_create_instance_body_function_(rclsid, pUnkOuter, dwClsContext, riid, ppv); } // Returns the first 7 bytes in hex as a string at |address|. static std::string FirstSevenBytesToString(uint32_t address) { const unsigned char* bytes = reinterpret_cast<const unsigned char*>(address); return base::StringPrintf("%02x %02x %02x %02x %02x %02x %02x", bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5], bytes[6]); } // Synchronizes everything in this class. base::Lock lock_; size_t init_count_ = 0; bool disabled_ = false; HMODULE ole32_library_ = nullptr; uint32_t co_create_instance_padded_address_ = 0; HotpatchPlaceholderFormat hotpatch_placeholder_format_ = HotpatchPlaceholderFormat::UNKNOWN; StructuredHotpatch structured_hotpatch_; static decltype( ::CoCreateInstance)* original_co_create_instance_body_function_; }; decltype(::CoCreateInstance)* HookManager::original_co_create_instance_body_function_ = nullptr; } // namespace #endif // defined(COM_INIT_CHECK_HOOK_ENABLED) ComInitCheckHook::ComInitCheckHook() { #if defined(COM_INIT_CHECK_HOOK_ENABLED) HookManager::GetInstance()->RegisterHook(); #endif // defined(COM_INIT_CHECK_HOOK_ENABLED) } ComInitCheckHook::~ComInitCheckHook() { #if defined(COM_INIT_CHECK_HOOK_ENABLED) HookManager::GetInstance()->UnregisterHook(); #endif // defined(COM_INIT_CHECK_HOOK_ENABLED) } void ComInitCheckHook::DisableCOMChecksForProcess() { #if defined(COM_INIT_CHECK_HOOK_ENABLED) HookManager::GetInstance()->DisableCOMChecksForProcess(); #endif } } // namespace win } // namespace base
ric2b/Vivaldi-browser
chromium/base/win/com_init_check_hook.cc
C++
bsd-3-clause
12,808
- infos = Information about ccode plugin is in keys below - infos/author = Markus Raab <[email protected]> - infos/licence = BSD - infos/provides = code - infos/needs = - infos/recommends = - infos/placements = postgetstorage presetstorage - infos/status = unittest nodep libc configurable discouraged - infos/description = Decoding/Encoding engine which escapes unwanted characters. # CCode ## Introduction The `ccode` plugin replaces (escapes) any special characters with two characters: - an escape character (default: `\`) and - another character representing the escaped character (e.g `n` for newline) before writing a `KeySet`. The plugin undoes this modification after reading a `KeySet`. CCode provides a reasonable default configuration, using the usual escape sequences for C strings (e.g. `\n` for newline, `\t` for tab). You can also configure the escape character (`/escape`) and the mapping for special characters (`chars`). ## Installation See [installation](/doc/INSTALL.md). The package is called `libelektra5-extra`. ## Restrictions This method of encoding characters is not as powerful as the hexcode plugin in terms of reduction. The hexcode plugin allows reduction of the character set to '0'-'9', 'a'-'f' and one escape character. So it can represent any key value with only 17 characters. On the other hand, ccode cannot reduce the set more than by half. So when all control characters and non-ASCII characters need to vanish, it cannot be done with the ccode plugin. But it is perfectly suitable to reduce by some characters. The advantages are that the size only doubles in the worst case and that it is much easier to read. ## C In the C language, the following escape characters are present. - `b`: backspace, hex: 08 - `t`: horizontal tab, hex: 09 - `n`: new line feed, hex: 0A - `v`: vertical tab, hex: 0B - `f`: form feed, hex: 0C - `r`: carriage return, hex: 0D - `\\`: back slash, hex: 5C - `'`: single quote, hex: 27 - `"`: double quote, hex: 22 - `0`: null, hex: 00 This is also the default mapping. ### Contract Add `ccode` to `infos/needs` for any plugin that you want to be filtered by ccode.
petermax2/libelektra
src/plugins/ccode/README.md
Markdown
bsd-3-clause
2,153
/* * Copyright (c) 2012 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "config.h" #include "core/platform/graphics/harfbuzz/HarfBuzzFace.h" #include "core/platform/graphics/FontPlatformData.h" #include "hb-ot.h" #include "hb.h" namespace WebCore { const hb_tag_t HarfBuzzFace::vertTag = HB_TAG('v', 'e', 'r', 't'); const hb_tag_t HarfBuzzFace::vrt2Tag = HB_TAG('v', 'r', 't', '2'); // Though we have FontCache class, which provides the cache mechanism for // WebKit's font objects, we also need additional caching layer for HarfBuzz // to reduce the memory consumption because hb_face_t should be associated with // underling font data (e.g. CTFontRef, FTFace). class FaceCacheEntry : public RefCounted<FaceCacheEntry> { public: static PassRefPtr<FaceCacheEntry> create(hb_face_t* face) { ASSERT(face); return adoptRef(new FaceCacheEntry(face)); } ~FaceCacheEntry() { hb_face_destroy(m_face); } hb_face_t* face() { return m_face; } HashMap<uint32_t, uint16_t>* glyphCache() { return &m_glyphCache; } private: explicit FaceCacheEntry(hb_face_t* face) : m_face(face) { } hb_face_t* m_face; HashMap<uint32_t, uint16_t> m_glyphCache; }; typedef HashMap<uint64_t, RefPtr<FaceCacheEntry>, WTF::IntHash<uint64_t>, WTF::UnsignedWithZeroKeyHashTraits<uint64_t> > HarfBuzzFaceCache; static HarfBuzzFaceCache* harfBuzzFaceCache() { DEFINE_STATIC_LOCAL(HarfBuzzFaceCache, s_harfBuzzFaceCache, ()); return &s_harfBuzzFaceCache; } HarfBuzzFace::HarfBuzzFace(FontPlatformData* platformData, uint64_t uniqueID) : m_platformData(platformData) , m_uniqueID(uniqueID) , m_scriptForVerticalText(HB_SCRIPT_INVALID) { HarfBuzzFaceCache::AddResult result = harfBuzzFaceCache()->add(m_uniqueID, 0); if (result.isNewEntry) result.iterator->value = FaceCacheEntry::create(createFace()); result.iterator->value->ref(); m_face = result.iterator->value->face(); m_glyphCacheForFaceCacheEntry = result.iterator->value->glyphCache(); } HarfBuzzFace::~HarfBuzzFace() { HarfBuzzFaceCache::iterator result = harfBuzzFaceCache()->find(m_uniqueID); ASSERT(result != harfBuzzFaceCache()->end()); ASSERT(result.get()->value->refCount() > 1); result.get()->value->deref(); if (result.get()->value->refCount() == 1) harfBuzzFaceCache()->remove(m_uniqueID); } static hb_script_t findScriptForVerticalGlyphSubstitution(hb_face_t* face) { static const unsigned maxCount = 32; unsigned scriptCount = maxCount; hb_tag_t scriptTags[maxCount]; hb_ot_layout_table_get_script_tags(face, HB_OT_TAG_GSUB, 0, &scriptCount, scriptTags); for (unsigned scriptIndex = 0; scriptIndex < scriptCount; ++scriptIndex) { unsigned languageCount = maxCount; hb_tag_t languageTags[maxCount]; hb_ot_layout_script_get_language_tags(face, HB_OT_TAG_GSUB, scriptIndex, 0, &languageCount, languageTags); for (unsigned languageIndex = 0; languageIndex < languageCount; ++languageIndex) { unsigned featureIndex; if (hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, HarfBuzzFace::vertTag, &featureIndex) || hb_ot_layout_language_find_feature(face, HB_OT_TAG_GSUB, scriptIndex, languageIndex, HarfBuzzFace::vrt2Tag, &featureIndex)) return hb_ot_tag_to_script(scriptTags[scriptIndex]); } } return HB_SCRIPT_INVALID; } void HarfBuzzFace::setScriptForVerticalGlyphSubstitution(hb_buffer_t* buffer) { if (m_scriptForVerticalText == HB_SCRIPT_INVALID) m_scriptForVerticalText = findScriptForVerticalGlyphSubstitution(m_face); hb_buffer_set_script(buffer, m_scriptForVerticalText); } } // namespace WebCore
espadrine/opera
chromium/src/third_party/WebKit/Source/core/platform/graphics/harfbuzz/HarfBuzzFace.cpp
C++
bsd-3-clause
5,277
/* * * Copyright 2017 gRPC authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ #ifndef GRPC_CORE_LIB_GPRPP_ORPHANABLE_H #define GRPC_CORE_LIB_GPRPP_ORPHANABLE_H #include <grpc/support/port_platform.h> #include <grpc/support/log.h> #include <grpc/support/sync.h> #include <cinttypes> #include <memory> #include "src/core/lib/debug/trace.h" #include "src/core/lib/gprpp/abstract.h" #include "src/core/lib/gprpp/debug_location.h" #include "src/core/lib/gprpp/memory.h" #include "src/core/lib/gprpp/ref_counted.h" #include "src/core/lib/gprpp/ref_counted_ptr.h" namespace grpc_core { // A base class for orphanable objects, which have one external owner // but are not necessarily destroyed immediately when the external owner // gives up ownership. Instead, the owner calls the object's Orphan() // method, and the object then takes responsibility for its own cleanup // and destruction. class Orphanable { public: // Gives up ownership of the object. The implementation must arrange // to eventually destroy the object without further interaction from the // caller. virtual void Orphan() GRPC_ABSTRACT; // Not copyable or movable. Orphanable(const Orphanable&) = delete; Orphanable& operator=(const Orphanable&) = delete; GRPC_ABSTRACT_BASE_CLASS protected: Orphanable() {} virtual ~Orphanable() {} }; template <typename T> class OrphanableDelete { public: void operator()(T* p) { p->Orphan(); } }; template <typename T, typename Deleter = OrphanableDelete<T>> using OrphanablePtr = std::unique_ptr<T, Deleter>; template <typename T, typename... Args> inline OrphanablePtr<T> MakeOrphanable(Args&&... args) { return OrphanablePtr<T>(New<T>(std::forward<Args>(args)...)); } // A type of Orphanable with internal ref-counting. template <typename Child> class InternallyRefCounted : public Orphanable { public: // Not copyable nor movable. InternallyRefCounted(const InternallyRefCounted&) = delete; InternallyRefCounted& operator=(const InternallyRefCounted&) = delete; GRPC_ABSTRACT_BASE_CLASS protected: GRPC_ALLOW_CLASS_TO_USE_NON_PUBLIC_DELETE // Allow RefCountedPtr<> to access Unref() and IncrementRefCount(). template <typename T> friend class RefCountedPtr; // TraceFlagT is defined to accept both DebugOnlyTraceFlag and TraceFlag. // Note: RefCount tracing is only enabled on debug builds, even when a // TraceFlag is used. template <typename TraceFlagT = TraceFlag> explicit InternallyRefCounted(TraceFlagT* trace_flag = nullptr, intptr_t initial_refcount = 1) : refs_(initial_refcount, trace_flag) {} virtual ~InternallyRefCounted() = default; RefCountedPtr<Child> Ref() GRPC_MUST_USE_RESULT { IncrementRefCount(); return RefCountedPtr<Child>(static_cast<Child*>(this)); } RefCountedPtr<Child> Ref(const DebugLocation& location, const char* reason) GRPC_MUST_USE_RESULT { IncrementRefCount(location, reason); return RefCountedPtr<Child>(static_cast<Child*>(this)); } void Unref() { if (GPR_UNLIKELY(refs_.Unref())) { Delete(static_cast<Child*>(this)); } } void Unref(const DebugLocation& location, const char* reason) { if (GPR_UNLIKELY(refs_.Unref(location, reason))) { Delete(static_cast<Child*>(this)); } } private: void IncrementRefCount() { refs_.Ref(); } void IncrementRefCount(const DebugLocation& location, const char* reason) { refs_.Ref(location, reason); } grpc_core::RefCount refs_; }; } // namespace grpc_core #endif /* GRPC_CORE_LIB_GPRPP_ORPHANABLE_H */
endlessm/chromium-browser
third_party/grpc/src/src/core/lib/gprpp/orphanable.h
C
bsd-3-clause
4,129
#ifndef _NVMEM_H_ #define _NVMEM_H_ #define NVM_START 0x9D07F000 #define NVM_SIZE 0x1000 namespace openxc { namespace nvm { void initialize(); void store(); void load(); } // namespace nvm } // namespace openxc #endif
openxc/vi-firmware
src/platform/pic32/nvm.h
C
bsd-3-clause
230
/*========================================================================= Program: Visualization Toolkit Module: vtkWrapPythonType.c Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ #include "vtkWrapPythonType.h" #include "vtkWrapPythonClass.h" #include "vtkWrapPythonConstant.h" #include "vtkWrapPythonEnum.h" #include "vtkWrapPythonMethod.h" #include "vtkWrapPythonMethodDef.h" #include "vtkWrapPythonTemplate.h" #include "vtkWrap.h" #include "vtkParseExtras.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> /* -------------------------------------------------------------------- */ /* A struct for special types to store info about the type, it is fairly * small because not many operators or special features are wrapped */ typedef struct _SpecialTypeInfo { int has_print; /* there is "<<" stream operator */ int has_compare; /* there are comparison operators e.g. "<" */ int has_sequence; /* the [] operator takes a single integer */ } SpecialTypeInfo; /* -------------------------------------------------------------------- */ /* The following functions are for generating code for special types, * i.e. types that are not derived from vtkObjectBase */ /* -------------------------------------------------------------------- */ /* -------------------------------------------------------------------- */ /* generate function for printing a special object */ static void vtkWrapPython_NewDeleteProtocol( FILE *fp, const char *classname, ClassInfo *data) { const char *constructor; size_t n, m; /* remove namespaces and template parameters from the * class name to get the constructor name */ constructor = data->Name; m = vtkParse_UnscopedNameLength(constructor); while (constructor[m] == ':' && constructor[m+1] == ':') { constructor += m + 2; m = vtkParse_UnscopedNameLength(constructor); } for (n = 0; n < m; n++) { if (constructor[n] == '<') { break; } } /* the new method for python versions >= 2.2 */ fprintf(fp, "#if PY_VERSION_HEX >= 0x02020000\n" "static PyObject *\n" "Py%s_New(PyTypeObject *, PyObject *args, PyObject *kwds)\n" "{\n" " if (kwds && PyDict_Size(kwds))\n" " {\n" " PyErr_SetString(PyExc_TypeError,\n" " \"this function takes no keyword arguments\");\n" " return NULL;\n" " }\n" "\n" " return Py%s_%*.*s(NULL, args);\n" "}\n" "#endif\n" "\n", classname, classname, (int)n, (int)n, constructor); /* the delete method */ fprintf(fp, "static void Py%s_Delete(PyObject *self)\n" "{\n" " PyVTKSpecialObject *obj = (PyVTKSpecialObject *)self;\n" " if (obj->vtk_ptr)\n" " {\n" " delete static_cast<%s *>(obj->vtk_ptr);\n" " }\n" "#if PY_MAJOR_VERSION >= 2\n" " PyObject_Del(self);\n" "#else\n" " PyMem_DEL(self);\n" "#endif\n" "}\n" "\n", classname, data->Name); } /* -------------------------------------------------------------------- */ /* generate function for printing a special object */ static void vtkWrapPython_PrintProtocol( FILE *fp, const char *classname, ClassInfo *data, FileInfo *finfo, SpecialTypeInfo *info) { int i; FunctionInfo *func; /* look in the file for "operator<<" for printing */ for (i = 0; i < finfo->Contents->NumberOfFunctions; i++) { func = finfo->Contents->Functions[i]; if (func->Name && func->IsOperator && strcmp(func->Name, "operator<<") == 0) { if (func->NumberOfParameters == 2 && (func->Parameters[0]->Type & VTK_PARSE_UNQUALIFIED_TYPE) == VTK_PARSE_OSTREAM_REF && (func->Parameters[1]->Type & VTK_PARSE_BASE_TYPE) == VTK_PARSE_OBJECT && (func->Parameters[1]->Type & VTK_PARSE_POINTER_MASK) == 0 && strcmp(func->Parameters[1]->Class, data->Name) == 0) { info->has_print = 1; } } } /* the str function */ if (info->has_print) { fprintf(fp, "static PyObject *Py%s_String(PyObject *self)\n" "{\n" " PyVTKSpecialObject *obj = (PyVTKSpecialObject *)self;\n" " vtksys_ios::ostringstream os;\n" " if (obj->vtk_ptr)\n" " {\n" " os << *static_cast<const %s *>(obj->vtk_ptr);\n" " }\n" " const vtksys_stl::string &s = os.str();\n" " return PyString_FromStringAndSize(s.data(), s.size());\n" "}\n" "\n", classname, data->Name); } } /* -------------------------------------------------------------------- */ /* generate function for comparing special objects */ static void vtkWrapPython_RichCompareProtocol( FILE *fp, const char *classname, ClassInfo *data, FileInfo *finfo, SpecialTypeInfo *info) { static const char *compare_consts[6] = { "Py_LT", "Py_LE", "Py_EQ", "Py_NE", "Py_GT", "Py_GE" }; static const char *compare_tokens[6] = { "<", "<=", "==", "!=", ">", ">=" }; int compare_ops = 0; int i, n; FunctionInfo *func; /* look for comparison operator methods */ n = data->NumberOfFunctions + finfo->Contents->NumberOfFunctions; for (i = 0; i < n; i++) { if (i < data->NumberOfFunctions) { /* member function */ func = data->Functions[i]; if (func->NumberOfParameters != 1 || (func->Parameters[0]->Type & VTK_PARSE_BASE_TYPE) != VTK_PARSE_OBJECT || (func->Parameters[0]->Type & VTK_PARSE_POINTER_MASK) != 0 || strcmp(func->Parameters[0]->Class, data->Name) != 0) { continue; } } else { /* non-member function: both args must be of our type */ func = finfo->Contents->Functions[i - data->NumberOfFunctions]; if (func->NumberOfParameters != 2 || (func->Parameters[0]->Type & VTK_PARSE_BASE_TYPE) != VTK_PARSE_OBJECT || (func->Parameters[0]->Type & VTK_PARSE_POINTER_MASK) != 0 || strcmp(func->Parameters[0]->Class, data->Name) != 0 || (func->Parameters[1]->Type & VTK_PARSE_BASE_TYPE) != VTK_PARSE_OBJECT || (func->Parameters[1]->Type & VTK_PARSE_POINTER_MASK) != 0 || strcmp(func->Parameters[1]->Class, data->Name) != 0) { continue; } } if (func->IsOperator && func->Name != NULL) { if (strcmp(func->Name, "operator<") == 0) { compare_ops = (compare_ops | (1 << 0)); } else if (strcmp(func->Name, "operator<=") == 0) { compare_ops = (compare_ops | (1 << 1)); } else if (strcmp(func->Name, "operator==") == 0) { compare_ops = (compare_ops | (1 << 2)); } else if (strcmp(func->Name, "operator!=") == 0) { compare_ops = (compare_ops | (1 << 3)); } else if (strcmp(func->Name, "operator>") == 0) { compare_ops = (compare_ops | (1 << 4)); } else if (strcmp(func->Name, "operator>=") == 0) { compare_ops = (compare_ops | (1 << 5)); } } } /* the compare function */ if (compare_ops != 0) { info->has_compare = 1; fprintf(fp, "#if PY_VERSION_HEX >= 0x02010000\n" "static PyObject *Py%s_RichCompare(\n" " PyObject *o1, PyObject *o2, int opid)\n" "{\n" " PyObject *n1 = NULL;\n" " PyObject *n2 = NULL;\n" " const %s *so1 = NULL;\n" " const %s *so2 = NULL;\n" " int result = -1;\n" "\n", classname, data->Name, data->Name); for (i = 1; i <= 2; i++) { /* use GetPointerFromSpecialObject to do type conversion, but * at least one of the args will already be the correct type */ fprintf(fp, " if (o%d->ob_type == &Py%s_Type)\n" " {\n" " PyVTKSpecialObject *s%d = (PyVTKSpecialObject *)o%d;\n" " so%d = static_cast<const %s *>(s%d->vtk_ptr);\n" " }\n" " else\n" " {\n" " so%d = static_cast<const %s *>(\n" " vtkPythonUtil::GetPointerFromSpecialObject(\n" " o%d, \"%s\", &n%d));\n" " if (so%d == NULL)\n" " {\n" " PyErr_Clear();\n" " Py_INCREF(Py_NotImplemented);\n" " return Py_NotImplemented;\n" " }\n" " }\n" "\n", i, classname, i, i, i, data->Name, i, i, data->Name, i, classname, i, i); } /* the switch statement for all possible compare ops */ fprintf(fp, " switch (opid)\n" " {\n"); for (i = 0; i < 6; i++) { if ( ((compare_ops >> i) & 1) != 0 ) { fprintf(fp, " case %s:\n" " result = ((*so1) %s (*so2));\n" " break;\n", compare_consts[i], compare_tokens[i]); } else { fprintf(fp, " case %s:\n" " break;\n", compare_consts[i]); } } fprintf(fp, " }\n" "\n"); /* delete temporary objects, there will be at most one */ fprintf(fp, " if (n1)\n" " {\n" " Py_DECREF(n1);\n" " }\n" " else if (n2)\n" " {\n" " Py_DECREF(n2);\n" " }\n" "\n"); /* return the result */ fprintf(fp, " if (result == -1)\n" " {\n" " PyErr_SetString(PyExc_TypeError, (char *)\"operation not available\");\n" " return NULL;\n" " }\n" "\n" "#if PY_VERSION_HEX >= 0x02030000\n" " // avoids aliasing issues with Py_INCREF(Py_False)\n" " return PyBool_FromLong((long)result);\n" "#else\n" " if (result == 0)\n" " {\n" " Py_INCREF(Py_False);\n" " return Py_False;\n" " }\n" " Py_INCREF(Py_True);\n" " return Py_True;\n" "#endif\n" "}\n" "#endif\n" "\n"); } } /* -------------------------------------------------------------------- */ /* generate functions for indexing into special objects */ static void vtkWrapPython_SequenceProtocol( FILE *fp, const char *classname, ClassInfo *data, HierarchyInfo *hinfo, SpecialTypeInfo *info) { int i; FunctionInfo *func; FunctionInfo *getItemFunc = 0; FunctionInfo *setItemFunc = 0; /* look for [] operator */ for (i = 0; i < data->NumberOfFunctions; i++) { func = data->Functions[i]; if (func->Name && func->IsOperator && strcmp(func->Name, "operator[]") == 0 && vtkWrapPython_MethodCheck(data, func, hinfo)) { if (func->NumberOfParameters == 1 && func->ReturnValue && vtkWrap_IsInteger(func->Parameters[0])) { if (!setItemFunc && vtkWrap_IsNonConstRef(func->ReturnValue)) { setItemFunc = func; } if (!getItemFunc || (func->IsConst && !getItemFunc->IsConst)) { getItemFunc = func; } } } } if (getItemFunc && getItemFunc->SizeHint) { info->has_sequence = 1; fprintf(fp, "Py_ssize_t Py%s_SequenceSize(PyObject *self)\n" "{\n" " void *vp = vtkPythonArgs::GetSelfPointer(self);\n" " %s *op = static_cast<%s *>(vp);\n" "\n" " return static_cast<Py_ssize_t>(op->%s);\n" "}\n\n", classname, data->Name, data->Name, getItemFunc->SizeHint); fprintf(fp, "PyObject *Py%s_SequenceItem(PyObject *self, Py_ssize_t i)\n" "{\n" " void *vp = vtkPythonArgs::GetSelfPointer(self);\n" " %s *op = static_cast<%s *>(vp);\n" "\n", classname, data->Name, data->Name); vtkWrapPython_DeclareVariables(fp, data, getItemFunc); fprintf(fp, " temp0 = static_cast<%s>(i);\n" "\n" " if (temp0 < 0 || temp0 >= op->%s)\n" " {\n" " PyErr_SetString(PyExc_IndexError, \"index out of range\");\n" " }\n" " else\n" " {\n", vtkWrap_GetTypeName(getItemFunc->Parameters[0]), getItemFunc->SizeHint); fprintf(fp, " "); vtkWrap_DeclareVariable(fp, data, getItemFunc->ReturnValue, "tempr", -1, VTK_WRAP_RETURN | VTK_WRAP_NOSEMI); fprintf(fp, " = %s(*op)[temp0];\n" "\n", (vtkWrap_IsRef(getItemFunc->ReturnValue) ? "&" : "")); vtkWrapPython_ReturnValue(fp, data, getItemFunc->ReturnValue, 1); fprintf(fp, " }\n" "\n" " return result;\n" "}\n\n"); if (setItemFunc) { fprintf(fp, "int Py%s_SequenceSetItem(\n" " PyObject *self, Py_ssize_t i, PyObject *arg1)\n" "{\n" " void *vp = vtkPythonArgs::GetSelfPointer(self);\n" " %s *op = static_cast<%s *>(vp);\n" "\n", classname, data->Name, data->Name); vtkWrap_DeclareVariable(fp, data, setItemFunc->Parameters[0], "temp", 0, VTK_WRAP_ARG); vtkWrap_DeclareVariable(fp, data, setItemFunc->ReturnValue, "temp", 1, VTK_WRAP_ARG); fprintf(fp, " int result = -1;\n" "\n" " temp0 = static_cast<%s>(i);\n" "\n" " if (temp0 < 0 || temp0 >= op->%s)\n" " {\n" " PyErr_SetString(PyExc_IndexError, \"index out of range\");\n" " }\n" " else if (", vtkWrap_GetTypeName(setItemFunc->Parameters[0]), getItemFunc->SizeHint); vtkWrapPython_GetSingleArgument( fp, data, 1, setItemFunc->ReturnValue, 1); fprintf(fp,")\n" " {\n" " (*op)[temp0] = %stemp1;\n" "\n", ((vtkWrap_IsRef(getItemFunc->ReturnValue) && vtkWrap_IsObject(getItemFunc->ReturnValue)) ? "*" : "")); fprintf(fp, " if (PyErr_Occurred() == NULL)\n" " {\n" " result = 0;\n" " }\n" " }\n" "\n" " return result;\n" "}\n\n"); } fprintf(fp, "static PySequenceMethods Py%s_AsSequence = {\n" " Py%s_SequenceSize, // sq_length\n" " 0, // sq_concat\n" " 0, // sq_repeat\n" " Py%s_SequenceItem, // sq_item\n" " 0, // sq_slice\n", classname, classname, classname); if (setItemFunc) { fprintf(fp, " Py%s_SequenceSetItem, // sq_ass_item\n", classname); } else { fprintf(fp, " 0, // sq_ass_item\n"); } fprintf(fp, " 0, // sq_ass_slice\n" " 0, // sq_contains\n" "#if PY_VERSION_HEX >= 0x2000000\n" " 0, // sq_inplace_concat\n" " 0, // sq_inplace_repeat\n" "#endif\n" "};\n\n"); } } /* -------------------------------------------------------------------- */ /* generate function for hashing special objects */ static void vtkWrapPython_HashProtocol( FILE *fp, const char *classname, ClassInfo *data) { /* the hash function, defined only for specific types */ fprintf(fp, "static long Py%s_Hash(PyObject *self)\n", classname); if (strcmp(data->Name, "vtkTimeStamp") == 0) { /* hash for vtkTimeStamp is just the timestamp itself */ fprintf(fp, "{\n" " PyVTKSpecialObject *obj = (PyVTKSpecialObject *)self;\n" " const vtkTimeStamp *op = static_cast<const vtkTimeStamp *>(obj->vtk_ptr);\n" " unsigned long mtime = *op;\n" " long h = (long)mtime;\n" " if (h != -1) { return h; }\n" " return -2;\n" "}\n" "\n"); } else if (strcmp(data->Name, "vtkVariant") == 0) { /* hash for vtkVariant is cached to avoid recomputation, this is * safe because vtkVariant is an immutable object, and is necessary * because computing the hash for vtkVariant is very expensive */ fprintf(fp, "{\n" " PyVTKSpecialObject *obj = (PyVTKSpecialObject *)self;\n" " const vtkVariant *op = static_cast<const vtkVariant *>(obj->vtk_ptr);\n" " long h = obj->vtk_hash;\n" " if (h != -1)\n" " {\n" " return h;\n" " }\n" " h = vtkPythonUtil::VariantHash(op);\n" " obj->vtk_hash = h;\n" " return h;\n" "}\n" "\n"); } else { /* if hash is not implemented, raise an exception */ fprintf(fp, "{\n" "#if PY_VERSION_HEX >= 0x020600B2\n" " return PyObject_HashNotImplemented(self);\n" "#else\n" " char text[256];\n" " sprintf(text, \"unhashable type: \'%%s\'\", self->ob_type->tp_name);\n" " PyErr_SetString(PyExc_TypeError, text);\n" " return -1;\n" "#endif\n" "}\n" "\n"); } } /* -------------------------------------------------------------------- */ /* generate extra functions for a special object */ static void vtkWrapPython_SpecialTypeProtocols( FILE *fp, const char *classname, ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo, SpecialTypeInfo *info) { /* clear all info about the type */ info->has_print = 0; info->has_compare = 0; info->has_sequence = 0; vtkWrapPython_NewDeleteProtocol(fp, classname, data); vtkWrapPython_PrintProtocol(fp, classname, data, finfo, info); vtkWrapPython_RichCompareProtocol(fp, classname, data, finfo, info); vtkWrapPython_SequenceProtocol(fp, classname, data, hinfo, info); vtkWrapPython_HashProtocol(fp, classname, data); } /* -------------------------------------------------------------------- */ /* For classes that aren't derived from vtkObjectBase, check to see if * they are wrappable */ int vtkWrapPython_IsSpecialTypeWrappable(ClassInfo *data) { /* no templated types */ if (data->Template) { return 0; } /* no abstract classes */ if (data->IsAbstract) { return 0; } if (strncmp(data->Name, "vtk", 3) != 0) { return 0; } /* require public destructor and copy contructor */ if (!vtkWrap_HasPublicDestructor(data) || !vtkWrap_HasPublicCopyConstructor(data)) { return 0; } return 1; } /* -------------------------------------------------------------------- */ /* write out a special type object */ void vtkWrapPython_GenerateSpecialType( FILE *fp, const char *classname, ClassInfo *data, FileInfo *finfo, HierarchyInfo *hinfo) { char supername[1024]; const char *name; SpecialTypeInfo info; const char *constructor; size_t n, m; int i; int has_constants = 0; int has_superclass = 0; int is_external = 0; /* remove namespaces and template parameters from the * class name to get the constructor name */ constructor = data->Name; m = vtkParse_UnscopedNameLength(constructor); while (constructor[m] == ':' && constructor[m+1] == ':') { constructor += m + 2; m = vtkParse_UnscopedNameLength(constructor); } for (n = 0; n < m; n++) { if (constructor[n] == '<') { break; } } /* forward declaration of the type object */ fprintf(fp, "#ifndef DECLARED_Py%s_Type\n" "extern %s PyTypeObject Py%s_Type;\n" "#define DECLARED_Py%s_Type\n" "#endif\n" "\n", classname, "VTK_PYTHON_EXPORT", classname, classname); /* and the superclass */ has_superclass = vtkWrapPython_HasWrappedSuperClass( hinfo, data->Name, &is_external); if (has_superclass) { name = vtkWrapPython_GetSuperClass(data, hinfo); vtkWrapPython_PythonicName(name, supername); fprintf(fp, "#ifndef DECLARED_Py%s_Type\n" "extern %s PyTypeObject Py%s_Type;\n" "#define DECLARED_Py%s_Type\n" "#endif\n" "\n", supername, (is_external ? "VTK_PYTHON_IMPORT" : "VTK_PYTHON_EXPORT"), supername, supername); } /* generate all constructor methods */ vtkWrapPython_GenerateMethods(fp, classname, data, finfo, hinfo, 0, 1); /* generate the method table for the New method */ fprintf(fp, "static PyMethodDef Py%s_NewMethod = \\\n" "{ (char*)\"%s\", Py%s_%*.*s, 1,\n" " (char*)\"\" };\n" "\n", classname, classname, classname, (int)n, (int)n, constructor); /* generate all functions and protocols needed for the type */ vtkWrapPython_SpecialTypeProtocols( fp, classname, data, finfo, hinfo, &info); /* Generate the TypeObject */ fprintf(fp, "PyTypeObject Py%s_Type = {\n" " PyObject_HEAD_INIT(&PyType_Type)\n" " 0,\n" " (char*)\"%s\", // tp_name\n" " sizeof(PyVTKSpecialObject), // tp_basicsize\n" " 0, // tp_itemsize\n" " Py%s_Delete, // tp_dealloc\n" " 0, // tp_print\n" " 0, // tp_getattr\n" " 0, // tp_setattr\n" " 0, // tp_compare\n" " PyVTKSpecialObject_Repr, // tp_repr\n", classname, classname, classname); fprintf(fp, " 0, // tp_as_number\n"); if (info.has_sequence) { fprintf(fp, " &Py%s_AsSequence, // tp_as_sequence\n", classname); } else { fprintf(fp, " 0, // tp_as_sequence\n"); } fprintf(fp, " 0, // tp_as_mapping\n" " Py%s_Hash, // tp_hash\n" " 0, // tp_call\n", classname); if (info.has_print) { fprintf(fp, " Py%s_String, // tp_str\n", classname); } else if (info.has_sequence) { fprintf(fp, " PyVTKSpecialObject_SequenceString, // tp_str\n"); } else { fprintf(fp, " 0, // tp_str\n"); } fprintf(fp, "#if PY_VERSION_HEX >= 0x02020000\n" " PyObject_GenericGetAttr, // tp_getattro\n" "#else\n" " PyVTKSpecialObject_GetAttr, // tp_getattro\n" "#endif\n" " 0, // tp_setattro\n" " 0, // tp_as_buffer\n" " Py_TPFLAGS_DEFAULT, // tp_flags\n" " 0, // tp_doc\n" " 0, // tp_traverse\n" " 0, // tp_clear\n"); if (info.has_compare) { fprintf(fp, "#if PY_VERSION_HEX >= 0x02010000\n" " Py%s_RichCompare, // tp_richcompare\n" "#else\n" " 0, // tp_richcompare\n" "#endif\n", classname); } else { fprintf(fp, " 0, // tp_richcompare\n"); } fprintf(fp, " 0, // tp_weaklistoffset\n" "#if PY_VERSION_HEX >= 0x02020000\n" " 0, // tp_iter\n" " 0, // tp_iternext\n"); /* class methods introduced in python 2.2 */ fprintf(fp, " Py%s_Methods, // tp_methods\n" " 0, // tp_members\n" " 0, // tp_getset\n", classname); if (has_superclass) { fprintf(fp, " &Py%s_Type, // tp_base\n", supername); } else { fprintf(fp, " 0, // tp_base\n"); } fprintf(fp, " 0, // tp_dict\n" " 0, // tp_descr_get\n" " 0, // tp_descr_set\n" " 0, // tp_dictoffset\n" " 0, // tp_init\n" " 0, // tp_alloc\n" " Py%s_New, // tp_new\n" "#if PY_VERSION_HEX >= 0x02030000\n" " PyObject_Del, // tp_free\n" "#else\n" " _PyObject_Del, // tp_free\n" "#endif\n" " 0, // tp_is_gc\n", classname); /* fields set by python itself */ fprintf(fp, " 0, // tp_bases\n" " 0, // tp_mro\n" " 0, // tp_cache\n" " 0, // tp_subclasses\n" " 0, // tp_weaklist\n" "#endif\n"); /* internal struct members */ fprintf(fp, " VTK_WRAP_PYTHON_SUPRESS_UNINITIALIZED\n" "};\n" "\n"); /* generate the copy constructor helper function */ fprintf(fp, "static void *Py%s_CCopy(const void *obj)\n" "{\n" " if (obj)\n" " {\n" " return new %s(*static_cast<const %s*>(obj));\n" " }\n" " return 0;\n" "}\n" "\n", classname, data->Name, data->Name); /* the method for adding the VTK extras to the type, * the unused "const char *" arg is the module name */ fprintf(fp, "static PyObject *Py%s_TypeNew(const char *)\n" "{\n" " PyObject *cls = PyVTKSpecialType_New(\n" " &Py%s_Type,\n" " Py%s_Methods,\n" " Py%s_%*.*s_Methods,\n" " &Py%s_NewMethod,\n" " Py%s_Doc(), &Py%s_CCopy);\n" "\n", classname, classname, classname, classname, (int)n, (int)n, constructor, classname, classname, classname); /* check whether the class has any constants as members */ for (i = 0; i < data->NumberOfConstants; i++) { if (data->Constants[i]->Access == VTK_ACCESS_PUBLIC) { has_constants = 1; } } if (has_constants) { fprintf(fp, " PyObject *d = Py%s_Type.tp_dict;\n" " PyObject *o;\n" "\n", classname); /* add any enum types defined in the class to its dict */ vtkWrapPython_AddPublicEnumTypes(fp, " ", "d", "o", data); /* add any constants defined in the class to its dict */ vtkWrapPython_AddPublicConstants(fp, " ", "d", "o", data); } fprintf(fp, " return cls;\n" "}\n" "\n"); }
hendradarwin/VTK
Wrapping/Tools/vtkWrapPythonType.c
C
bsd-3-clause
25,395
// Close variable scope from api-prefix.js })();
grammarly/browser-extensions
common-v2/api-suffix.js
JavaScript
bsd-3-clause
50
from django.test import TestCase from django.core.cache import cache from wagtail.wagtailcore.models import Page, PageViewRestriction, Site from wagtail.tests.testapp.models import SimplePage, EventIndex from .sitemap_generator import Sitemap class TestSitemapGenerator(TestCase): def setUp(self): self.home_page = Page.objects.get(id=2) self.child_page = self.home_page.add_child(instance=SimplePage( title="Hello world!", slug='hello-world', live=True, )) self.unpublished_child_page = self.home_page.add_child(instance=SimplePage( title="Unpublished", slug='unpublished', live=False, )) self.protected_child_page = self.home_page.add_child(instance=SimplePage( title="Protected", slug='protected', live=True, )) PageViewRestriction.objects.create(page=self.protected_child_page, password='hello') self.site = Site.objects.get(is_default_site=True) def test_get_pages(self): sitemap = Sitemap(self.site) pages = sitemap.get_pages() self.assertIn(self.child_page.page_ptr, pages) self.assertNotIn(self.unpublished_child_page.page_ptr, pages) self.assertNotIn(self.protected_child_page.page_ptr, pages) def test_get_urls(self): sitemap = Sitemap(self.site) urls = [url['location'] for url in sitemap.get_urls()] self.assertIn('http://localhost/', urls) # Homepage self.assertIn('http://localhost/hello-world/', urls) # Child page def test_get_urls_uses_specific(self): # Add an event page which has an extra url in the sitemap self.home_page.add_child(instance=EventIndex( title="Events", slug='events', live=True, )) sitemap = Sitemap(self.site) urls = [url['location'] for url in sitemap.get_urls()] self.assertIn('http://localhost/events/', urls) # Main view self.assertIn('http://localhost/events/past/', urls) # Sub view def test_render(self): sitemap = Sitemap(self.site) xml = sitemap.render() # Check that a URL has made it into the xml self.assertIn('http://localhost/hello-world/', xml) # Make sure the unpublished page didn't make it into the xml self.assertNotIn('http://localhost/unpublished/', xml) # Make sure the protected page didn't make it into the xml self.assertNotIn('http://localhost/protected/', xml) class TestSitemapView(TestCase): def test_sitemap_view(self): response = self.client.get('/sitemap.xml') self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, 'wagtailsitemaps/sitemap.xml') self.assertEqual(response['Content-Type'], 'text/xml; charset=utf-8') def test_sitemap_view_cache(self): cache_key = 'wagtail-sitemap:%d' % Site.objects.get(is_default_site=True).id # Check that the key is not in the cache self.assertNotIn(cache_key, cache) # Hit the view first_response = self.client.get('/sitemap.xml') self.assertEqual(first_response.status_code, 200) self.assertTemplateUsed(first_response, 'wagtailsitemaps/sitemap.xml') # Check that the key is in the cache self.assertIn(cache_key, cache) # Hit the view again. Should come from the cache this time second_response = self.client.get('/sitemap.xml') self.assertEqual(second_response.status_code, 200) self.assertTemplateNotUsed(second_response, 'wagtailsitemaps/sitemap.xml') # Sitemap should not be re rendered # Check that the content is the same self.assertEqual(first_response.content, second_response.content)
serzans/wagtail
wagtail/contrib/wagtailsitemaps/tests.py
Python
bsd-3-clause
3,848
<?php /** * Zend Framework (http://framework.zend.com/) * * @link http://github.com/zendframework/zf2 for the canonical source repository * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) * @license http://framework.zend.com/license/new-bsd New BSD License * @package Zend_Loader */ namespace Zend\Loader\Exception; require_once __DIR__ . '/ExceptionInterface.php'; /** * @category Zend * @package Zend_Loader * @subpackage Exception */ class RuntimeException extends \RuntimeException implements ExceptionInterface {}
gustavoeidt/ceranium
vendor/zendframework/zendframework/library/Zend/Loader/Exception/RuntimeException.php
PHP
bsd-3-clause
604
// Copyright 2020 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. /** @fileoverview Runs the EDU login flow tests. */ GEN_INCLUDE(['//chrome/test/data/webui/polymer_browser_test_base.js']); GEN('#include "content/public/test/browser_test.h"'); /* eslint-disable no-var */ const EduLoginTest = class extends PolymerTest { /** @override */ get browsePreload() { throw 'this is abstract and should be overridden by subclasses'; } get suiteName() { throw 'this is abstract and should be overridden by subclasses'; } /** @param {string} testName The name of the test to run. */ runMochaTest(testName) { runMochaTest(this.suiteName, testName); } }; var EduLoginButtonTest = class extends EduLoginTest { /** @override */ get browsePreload() { return 'chrome://chrome-signin/test_loader.html?module=chromeos/edu_login/edu_login_button_test.js'; } /** @override */ get suiteName() { return edu_login_button_tests.suiteName; } }; TEST_F('EduLoginButtonTest', 'OkButtonProperties', function() { this.runMochaTest(edu_login_button_tests.TestNames.OkButtonProperties); }); TEST_F('EduLoginButtonTest', 'NextButtonProperties', function() { this.runMochaTest(edu_login_button_tests.TestNames.NextButtonProperties); }); TEST_F('EduLoginButtonTest', 'BackButtonProperties', function() { this.runMochaTest(edu_login_button_tests.TestNames.BackButtonProperties); }); TEST_F('EduLoginButtonTest', 'OkButtonRtlIcon', function() { this.runMochaTest(edu_login_button_tests.TestNames.OkButtonRtlIcon); }); TEST_F('EduLoginButtonTest', 'NextButtonRtlIcon', function() { this.runMochaTest(edu_login_button_tests.TestNames.NextButtonRtlIcon); }); TEST_F('EduLoginButtonTest', 'BackButtonRtlIcon', function() { this.runMochaTest(edu_login_button_tests.TestNames.BackButtonRtlIcon); }); var EduLoginParentsTest = class extends EduLoginTest { /** @override */ get browsePreload() { return 'chrome://chrome-signin/test_loader.html?module=chromeos/edu_login/edu_login_parents_test.js'; } /** @override */ get suiteName() { return edu_login_parents_tests.suiteName; } }; TEST_F('EduLoginParentsTest', 'Initialize', function() { this.runMochaTest(edu_login_parents_tests.TestNames.Initialize); }); TEST_F('EduLoginParentsTest', 'NextButton', function() { this.runMochaTest(edu_login_parents_tests.TestNames.NextButton); }); TEST_F('EduLoginParentsTest', 'GoNext', function() { this.runMochaTest(edu_login_parents_tests.TestNames.GoNext); }); TEST_F('EduLoginParentsTest', 'SelectedParent', function() { this.runMochaTest(edu_login_parents_tests.TestNames.SelectedParent); }); TEST_F('EduLoginParentsTest', 'NoInternetError', function() { this.runMochaTest(edu_login_parents_tests.TestNames.NoInternetError); }); TEST_F('EduLoginParentsTest', 'CannotAddAccountError', function() { this.runMochaTest(edu_login_parents_tests.TestNames.CannotAddAccountError); }); var EduLoginParentSigninTest = class extends EduLoginTest { /** @override */ get browsePreload() { return 'chrome://chrome-signin/test_loader.html?module=chromeos/edu_login/edu_login_parent_signin_test.js'; } /** @override */ get suiteName() { return edu_login_parent_signin_tests.suiteName; } }; TEST_F('EduLoginParentSigninTest', 'Initialize', function() { this.runMochaTest(edu_login_parent_signin_tests.TestNames.Initialize); }); TEST_F('EduLoginParentSigninTest', 'WrongPassword', function() { this.runMochaTest(edu_login_parent_signin_tests.TestNames.WrongPassword); }); TEST_F('EduLoginParentSigninTest', 'ParentSigninSuccess', function() { this.runMochaTest( edu_login_parent_signin_tests.TestNames.ParentSigninSuccess); }); TEST_F('EduLoginParentSigninTest', 'ShowHidePassword', function() { this.runMochaTest(edu_login_parent_signin_tests.TestNames.ShowHidePassword); }); TEST_F('EduLoginParentSigninTest', 'ClearState', function() { this.runMochaTest(edu_login_parent_signin_tests.TestNames.ClearState); }); var EduLoginSigninTest = class extends EduLoginTest { /** @override */ get browsePreload() { return 'chrome://chrome-signin/test_loader.html?module=chromeos/edu_login/edu_login_signin_test.js'; } /** @override */ get suiteName() { return edu_login_signin_tests.suiteName; } }; TEST_F('EduLoginSigninTest', 'Init', function() { this.runMochaTest(edu_login_signin_tests.TestNames.Init); }); TEST_F('EduLoginSigninTest', 'WebUICallbacks', function() { this.runMochaTest(edu_login_signin_tests.TestNames.WebUICallbacks); }); TEST_F('EduLoginSigninTest', 'AuthExtHostCallbacks', function() { this.runMochaTest(edu_login_signin_tests.TestNames.AuthExtHostCallbacks); }); TEST_F('EduLoginSigninTest', 'GoBackInWebview', function() { this.runMochaTest(edu_login_signin_tests.TestNames.GoBackInWebview); });
ric2b/Vivaldi-browser
chromium/chrome/test/data/webui/chromeos/edu_login/edu_login_browsertest.js
JavaScript
bsd-3-clause
4,935
/* * Copyright (c) 2017, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. */ /** * @file * This file includes the platform-specific initializers. * */ #ifndef PLATFORM_KW41Z_H_ #define PLATFORM_KW41Z_H_ #include <openthread/config.h> #include <openthread-core-config.h> #include <stdint.h> #include <openthread/instance.h> /** * This function initializes the alarm service used by OpenThread. * */ void kw41zAlarmInit(void); /** * This function performs alarm driver processing. * * @param[in] aInstance The OpenThread instance structure. * */ void kw41zAlarmProcess(otInstance *aInstance); /** * This function initializes the radio service used by OpenThread. * */ void kw41zRadioInit(void); /** * This function performs radio driver processing. * * @param[in] aInstance The OpenThread instance structure. * */ void kw41zRadioProcess(otInstance *aInstance); /** * This function initializes the random number service used by OpenThread. * */ void kw41zRandomInit(void); /** * This function performs UART driver processing. * */ void kw41zUartProcess(void); #endif // PLATFORM_KW41Z_H_
erja-gp/openthread
examples/platforms/kw41z/platform-kw41z.h
C
bsd-3-clause
2,661
from __future__ import absolute_import, unicode_literals from django.db import connection from django.test import TestCase, skipUnlessDBFeature, skipIfDBFeature from django.utils import unittest from .models import Reporter, Article if connection.vendor == 'oracle': expectedFailureOnOracle = unittest.expectedFailure else: expectedFailureOnOracle = lambda f: f class IntrospectionTests(TestCase): def test_table_names(self): tl = connection.introspection.table_names() self.assertEqual(tl, sorted(tl)) self.assertTrue(Reporter._meta.db_table in tl, "'%s' isn't in table_list()." % Reporter._meta.db_table) self.assertTrue(Article._meta.db_table in tl, "'%s' isn't in table_list()." % Article._meta.db_table) def test_django_table_names(self): cursor = connection.cursor() cursor.execute('CREATE TABLE django_ixn_test_table (id INTEGER);') tl = connection.introspection.django_table_names() cursor.execute("DROP TABLE django_ixn_test_table;") self.assertTrue('django_ixn_testcase_table' not in tl, "django_table_names() returned a non-Django table") def test_django_table_names_retval_type(self): # Ticket #15216 cursor = connection.cursor() cursor.execute('CREATE TABLE django_ixn_test_table (id INTEGER);') tl = connection.introspection.django_table_names(only_existing=True) self.assertIs(type(tl), list) tl = connection.introspection.django_table_names(only_existing=False) self.assertIs(type(tl), list) def test_installed_models(self): tables = [Article._meta.db_table, Reporter._meta.db_table] models = connection.introspection.installed_models(tables) self.assertEqual(models, set([Article, Reporter])) def test_sequence_list(self): sequences = connection.introspection.sequence_list() expected = {'table': Reporter._meta.db_table, 'column': 'id'} self.assertTrue(expected in sequences, 'Reporter sequence not found in sequence_list()') def test_get_table_description_names(self): cursor = connection.cursor() desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table) self.assertEqual([r[0] for r in desc], [f.column for f in Reporter._meta.fields]) def test_get_table_description_types(self): cursor = connection.cursor() desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table) self.assertEqual( [datatype(r[1], r) for r in desc], ['IntegerField', 'CharField', 'CharField', 'CharField', 'BigIntegerField'] ) # The following test fails on Oracle due to #17202 (can't correctly # inspect the length of character columns). @expectedFailureOnOracle def test_get_table_description_col_lengths(self): cursor = connection.cursor() desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table) self.assertEqual( [r[3] for r in desc if datatype(r[1], r) == 'CharField'], [30, 30, 75] ) # Oracle forces null=True under the hood in some cases (see # https://docs.djangoproject.com/en/dev/ref/databases/#null-and-empty-strings) # so its idea about null_ok in cursor.description is different from ours. @skipIfDBFeature('interprets_empty_strings_as_nulls') def test_get_table_description_nullable(self): cursor = connection.cursor() desc = connection.introspection.get_table_description(cursor, Reporter._meta.db_table) self.assertEqual( [r[6] for r in desc], [False, False, False, False, True] ) # Regression test for #9991 - 'real' types in postgres @skipUnlessDBFeature('has_real_datatype') def test_postgresql_real_type(self): cursor = connection.cursor() cursor.execute("CREATE TABLE django_ixn_real_test_table (number REAL);") desc = connection.introspection.get_table_description(cursor, 'django_ixn_real_test_table') cursor.execute('DROP TABLE django_ixn_real_test_table;') self.assertEqual(datatype(desc[0][1], desc[0]), 'FloatField') def test_get_relations(self): cursor = connection.cursor() relations = connection.introspection.get_relations(cursor, Article._meta.db_table) # Older versions of MySQL don't have the chops to report on this stuff, # so just skip it if no relations come back. If they do, though, we # should test that the response is correct. if relations: # That's {field_index: (field_index_other_table, other_table)} self.assertEqual(relations, {3: (0, Reporter._meta.db_table), 4: (0, Article._meta.db_table)}) @skipUnlessDBFeature('can_introspect_foreign_keys') def test_get_key_columns(self): cursor = connection.cursor() key_columns = connection.introspection.get_key_columns(cursor, Article._meta.db_table) self.assertEqual( set(key_columns), set([('reporter_id', Reporter._meta.db_table, 'id'), ('response_to_id', Article._meta.db_table, 'id')])) def test_get_primary_key_column(self): cursor = connection.cursor() primary_key_column = connection.introspection.get_primary_key_column(cursor, Article._meta.db_table) self.assertEqual(primary_key_column, 'id') def test_get_indexes(self): cursor = connection.cursor() indexes = connection.introspection.get_indexes(cursor, Article._meta.db_table) self.assertEqual(indexes['reporter_id'], {'unique': False, 'primary_key': False}) def test_get_indexes_multicol(self): """ Test that multicolumn indexes are not included in the introspection results. """ cursor = connection.cursor() indexes = connection.introspection.get_indexes(cursor, Reporter._meta.db_table) self.assertNotIn('first_name', indexes) self.assertIn('id', indexes) def datatype(dbtype, description): """Helper to convert a data type into a string.""" dt = connection.introspection.get_field_type(dbtype, description) if type(dt) is tuple: return dt[0] else: return dt
mammique/django
tests/regressiontests/introspection/tests.py
Python
bsd-3-clause
6,467
/* * SEGS - Super Entity Game Server * http://www.segs.dev/ * Copyright (c) 2006 - 2019 SEGS Team (see AUTHORS.md) * This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details. */ #pragma once #include <algorithm> #include "CoXHash.h" #include "DataStorage.h" struct TreeStore { virtual size_t num_children() const { return 0; } virtual TreeStore *nth_child(size_t ) { return 0; } virtual size_t idx_of_child(TreeStore *) const { return ~0UL; } virtual std::string to_string() const { return ""; } }; namespace MapStructs { struct Lod; struct Fog; struct Beacon; struct Sound; struct TexReplace; struct Omni; struct Ambient; struct TintColor; struct Property; struct Group; struct Def : public TreeStore { std::vector<Lod *> m_lods; std::vector<Fog *> m_fogs; std::vector<Beacon *> m_beacons; std::vector<Sound *> m_sounds; std::vector<TexReplace *> m_texture_replacements; std::vector<Omni *> m_omni; std::vector<Ambient *> m_ambients; std::vector<TintColor *> m_tint_colors; std::vector<Property *> m_properties; std::vector<Group *> m_groups; std::string m_src_name; std::string m_obj_name; std::string m_type_name; uint32_t m_flags; static void build_schema(); virtual std::string to_string() const { return "Def["+m_src_name+"]"; } virtual size_t num_children() const { return m_groups.size(); } virtual TreeStore *nth_child(size_t idx) { return (TreeStore *)m_groups[idx]; } }; struct Ref : public TreeStore { std::string m_src_name; Vec3 m_pos; Vec3 m_rot; static void build_schema(); virtual std::string to_string() const { return "Ref["+m_src_name+"]"; } }; struct TexReplace : public TreeStore { uint32_t m_src; std::string m_name_tgt; static void build_schema(); }; struct Ambient : public TreeStore { Color3ub m_color; static void build_schema(); }; struct Omni : public TreeStore { float m_val; uint32_t m_flags; Color3ub m_color; static void build_schema(); }; struct Beacon : public TreeStore { DECL_READABLE(Beacon) std::string m_name; float m_val; //radius? static void build_schema(); }; struct Sound : public TreeStore { DECL_READABLE(Sound) std::string m_name; float m_a; float m_b; float m_c; uint32_t m_flags; static void build_schema(); }; struct Fog : public TreeStore { float m_a; float m_b; float m_c; Color3ub m_col1; Color3ub m_col2; static void build_schema(); }; struct TintColor : public TreeStore { Color3ub m_col1; Color3ub m_col2; static void build_schema(); }; struct Lod : public TreeStore { float m_far; float m_far_fade; float m_near; float m_near_fade; float m_scale; static void build_schema(); }; struct Property : public TreeStore { std::string m_txt1; std::string m_txt2; uint32_t m_val3; static void build_schema(); }; struct Group : public TreeStore { std::string m_name; // this is reference to a model name or def name Vec3 m_pos; Vec3 m_rot; static void build_schema(); }; } struct SceneStorage : public TreeStore { typedef std::vector<MapStructs::Def *> vDef; typedef std::vector<MapStructs::Ref *> vRef; vDef m_defs; vRef m_refs; vDef m_root; std::string m_scene_file; uint32_t m_version; static void build_schema(); size_t num_children() const { return m_defs.size()+m_refs.size()+m_root.size(); } virtual TreeStore *nth_child(size_t idx) { if(idx<m_defs.size()) return m_defs[idx]; idx-=m_defs.size(); if(idx<m_refs.size()) return m_refs[idx]; idx-=m_refs.size(); if(idx<m_root.size()) return m_root[idx]; return 0; } virtual size_t idx_of_child(TreeStore *child) const { vDef::const_iterator itr=std::find(m_defs.begin(),m_defs.end(),child); if(itr!=m_defs.end()) return itr-m_defs.begin(); return ~0UL; } virtual std::string to_string() const { return m_scene_file; } };
broxen/Segs
Projects/CoX/Common/GameData/MapStructure.h
C
bsd-3-clause
4,798
/* $NetBSD: regex.h,v 1.1.1.2 2008/05/18 14:31:38 aymeric Exp $ */ /*- * Copyright (c) 1992 Henry Spencer. * Copyright (c) 1992, 1993 * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Henry Spencer of the University of Toronto. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)regex.h 8.1 (Berkeley) 6/2/93 */ #ifndef _REGEX_H_ #define _REGEX_H_ #ifdef __REGEX_PRIVATE #include "config.h" #include "../common/multibyte.h" #endif /* types */ typedef off_t regoff_t; typedef struct { int re_magic; size_t re_nsub; /* number of parenthesized subexpressions */ const RCHAR_T *re_endp; /* end pointer for REG_PEND */ struct re_guts *re_g; /* none of your business :-) */ } regex_t; typedef struct { regoff_t rm_so; /* start of match */ regoff_t rm_eo; /* end of match */ } regmatch_t; /* regcomp() flags */ #define REG_BASIC 0000 #define REG_EXTENDED 0001 #define REG_ICASE 0002 #define REG_NOSUB 0004 #define REG_NEWLINE 0010 #define REG_NOSPEC 0020 #define REG_PEND 0040 #define REG_DUMP 0200 /* regerror() flags */ #define REG_NOMATCH 1 #define REG_BADPAT 2 #define REG_ECOLLATE 3 #define REG_ECTYPE 4 #define REG_EESCAPE 5 #define REG_ESUBREG 6 #define REG_EBRACK 7 #define REG_EPAREN 8 #define REG_EBRACE 9 #define REG_BADBR 10 #define REG_ERANGE 11 #define REG_ESPACE 12 #define REG_BADRPT 13 #define REG_EMPTY 14 #define REG_ASSERT 15 #define REG_INVARG 16 #define REG_ATOI 255 /* convert name to number (!) */ #define REG_ITOA 0400 /* convert number to name (!) */ /* regexec() flags */ #define REG_NOTBOL 00001 #define REG_NOTEOL 00002 #define REG_STARTEND 00004 #define REG_TRACE 00400 /* tracing of execution */ #define REG_LARGE 01000 /* force large representation */ #define REG_BACKR 02000 /* force use of backref code */ int regcomp(regex_t *, const RCHAR_T *, int); size_t regerror(int, const regex_t *, char *, size_t); int regexec(const regex_t *, const RCHAR_T *, size_t, regmatch_t [], int); void regfree(regex_t *); #endif /* !_REGEX_H_ */
TigerBSD/TigerBSD
FreeBSD/contrib/nvi/regex/regex.h
C
isc
3,534
-- counted strings local io = require "vstruct.io" local c = {} function c.width(n) return nil end function c.unpack(fd, _, width) assert(width) local buf = fd:read(width) local len = io("u", "unpack", nil, buf, width) if len == 0 then return "" end return fd:read(len) end function c.pack(fd, data, width) return io("u", "pack", nil, #data, width) .. io("s", "pack", nil, data) end return c
ukoloff/rufus-lua-win
vendor/lua/lib/lua/vstruct/io/c.lua
Lua
mit
445
$(document).ready(function(){ // table sort example // ================== $(".sortTableExample").tablesorter( { sortList: [[ 1, 0 ]] } ) // add on logic // ============ $('.add-on :checkbox').click(function () { if ($(this).attr('checked')) { $(this).parents('.add-on').addClass('active') } else { $(this).parents('.add-on').removeClass('active') } }) // Copy code blocks in docs $(".copy-code").focus(function () { var el = this; // push select to event loop for chrome :{o setTimeout(function () { $(el).select(); }, 0); }); // POSITION STATIC TWIPSIES // ======================== $(window).bind( 'load resize', function () { $(".twipsies a").each(function () { $(this) .twipsy({ live: false , placement: $(this).attr('title') , trigger: 'manual' , offset: 2 }) .twipsy('show') }) }) });
aqfaridi/Code-Online-Judge
web/assets/js/application_2.js
JavaScript
mit
940
/* AUTO-GENERATED FILE. DO NOT MODIFY. * * This class was automatically generated by the * aapt tool from the resource data it found. It * should not be modified by hand. */ package com.eland.basepay; public final class R { public static final class anim { public static final int abc_fade_in=0x7f040000; public static final int abc_fade_out=0x7f040001; public static final int abc_slide_in_bottom=0x7f040002; public static final int abc_slide_in_top=0x7f040003; public static final int abc_slide_out_bottom=0x7f040004; public static final int abc_slide_out_top=0x7f040005; } public static final class attr { /** Custom divider drawable to use for elements in the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarDivider=0x7f01000f; /** Custom item state list drawable background for action bar items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarItemBackground=0x7f010010; /** Size of the Action Bar, including the contextual bar used to present Action Modes. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int actionBarSize=0x7f01000e; /** Reference to a theme that should be used to inflate widgets and layouts destined for the action bar. Most of the time this will be a reference to the current theme, but when the action bar has a significantly different contrast profile than the rest of the activity the difference can become important. If this is set to @null the current theme will be used. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarSplitStyle=0x7f01000c; /** Reference to a style for the Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarStyle=0x7f01000b; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarTabBarStyle=0x7f010008; /** Default style for tabs within an action bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarTabStyle=0x7f010007; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarTabTextStyle=0x7f010009; /** Reference to a theme that should be used to inflate widgets and layouts destined for the action bar. Most of the time this will be a reference to the current theme, but when the action bar has a significantly different contrast profile than the rest of the activity the difference can become important. If this is set to @null the current theme will be used. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionBarWidgetTheme=0x7f01000d; /** Default action button style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionButtonStyle=0x7f010016; /** Default ActionBar dropdown style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionDropDownStyle=0x7f010047; /** An optional layout to be used as an action view. See {@link android.view.MenuItem#setActionView(android.view.View)} for more info. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionLayout=0x7f01004e; /** TextAppearance style that will be applied to text that appears within action menu items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionMenuTextAppearance=0x7f010011; /** Color for text that appears within action menu items. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int actionMenuTextColor=0x7f010012; /** Background drawable to use for action mode UI <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeBackground=0x7f01003c; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeCloseButtonStyle=0x7f01003b; /** Drawable to use for the close action mode button <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeCloseDrawable=0x7f01003e; /** Drawable to use for the Copy action button in Contextual Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeCopyDrawable=0x7f010040; /** Drawable to use for the Cut action button in Contextual Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeCutDrawable=0x7f01003f; /** Drawable to use for the Find action button in WebView selection action modes <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeFindDrawable=0x7f010044; /** Drawable to use for the Paste action button in Contextual Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModePasteDrawable=0x7f010041; /** PopupWindow style to use for action modes when showing as a window overlay. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModePopupWindowStyle=0x7f010046; /** Drawable to use for the Select all action button in Contextual Action Bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeSelectAllDrawable=0x7f010042; /** Drawable to use for the Share action button in WebView selection action modes <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeShareDrawable=0x7f010043; /** Background drawable to use for action mode UI in the lower split bar <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeSplitBackground=0x7f01003d; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeStyle=0x7f01003a; /** Drawable to use for the Web Search action button in WebView selection action modes <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionModeWebSearchDrawable=0x7f010045; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int actionOverflowButtonStyle=0x7f01000a; /** The name of an optional ActionProvider class to instantiate an action view and perform operations such as default action for that menu item. See {@link android.view.MenuItem#setActionProvider(android.view.ActionProvider)} for more info. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int actionProviderClass=0x7f010050; /** The name of an optional View class to instantiate and use as an action view. See {@link android.view.MenuItem#setActionView(android.view.View)} for more info. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int actionViewClass=0x7f01004f; /** Default ActivityChooserView style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int activityChooserViewStyle=0x7f01006c; /** Specifies a background drawable for the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int background=0x7f01002f; /** Specifies a background drawable for the bottom component of a split action bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int backgroundSplit=0x7f010031; /** Specifies a background drawable for a second stacked row of the action bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int backgroundStacked=0x7f010030; /** A style that may be applied to Buttons placed within a LinearLayout with the style buttonBarStyle to form a button bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int buttonBarButtonStyle=0x7f010018; /** A style that may be applied to horizontal LinearLayouts to form a button bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int buttonBarStyle=0x7f010017; /** Specifies a layout for custom navigation. Overrides navigationMode. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int customNavigationLayout=0x7f010032; /** Whether this spinner should mark child views as enabled/disabled when the spinner itself is enabled/disabled. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int disableChildrenWhenDisabled=0x7f010054; /** Options affecting how the action bar is displayed. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr> <tr><td><code>showHome</code></td><td>0x2</td><td></td></tr> <tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr> <tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr> <tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr> <tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr> </table> */ public static final int displayOptions=0x7f010028; /** Specifies the drawable used for item dividers. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int divider=0x7f01002e; /** A drawable that may be used as a horizontal divider between visual elements. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int dividerHorizontal=0x7f01001b; /** Size of padding on either end of a divider. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int dividerPadding=0x7f010056; /** A drawable that may be used as a vertical divider between visual elements. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int dividerVertical=0x7f01001a; /** ListPopupWindow comaptibility <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int dropDownListViewStyle=0x7f010021; /** The preferred item height for dropdown lists. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int dropdownListPreferredItemHeight=0x7f010048; /** The drawable to show in the button for expanding the activities overflow popup. <strong>Note:</strong> Clients would like to set this drawable as a clue about the action the chosen activity will perform. For example, if share activity is to be chosen the drawable should give a clue that sharing is to be performed. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int expandActivityOverflowButtonDrawable=0x7f01006b; /** <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int height=0x7f010026; /** Specifies a drawable to use for the 'home as up' indicator. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int homeAsUpIndicator=0x7f010013; /** Specifies a layout to use for the "home" section of the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int homeLayout=0x7f010033; /** Specifies the drawable used for the application icon. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int icon=0x7f01002c; /** The default state of the SearchView. If true, it will be iconified when not in use and expanded when clicked. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int iconifiedByDefault=0x7f01005a; /** Specifies a style resource to use for an indeterminate progress spinner. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int indeterminateProgressStyle=0x7f010035; /** The maximal number of items initially shown in the activity list. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int initialActivityCount=0x7f01006a; /** Specifies whether the theme is light, otherwise it is dark. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int isLightTheme=0x7f010059; /** Specifies padding that should be applied to the left and right sides of system-provided items in the bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int itemPadding=0x7f010037; /** Drawable used as a background for selected list items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int listChoiceBackgroundIndicator=0x7f01004c; /** <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int listPopupWindowStyle=0x7f010022; /** The preferred list item height. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemHeight=0x7f01001c; /** A larger, more robust list item height. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemHeightLarge=0x7f01001e; /** A smaller, sleeker list item height. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemHeightSmall=0x7f01001d; /** The preferred padding along the left edge of list items. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemPaddingLeft=0x7f01001f; /** The preferred padding along the right edge of list items. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int listPreferredItemPaddingRight=0x7f010020; /** Specifies the drawable used for the application logo. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int logo=0x7f01002d; /** The type of navigation to use. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>normal</code></td><td>0</td><td> Normal static title text </td></tr> <tr><td><code>listMode</code></td><td>1</td><td> The action bar will use a selection list for navigation. </td></tr> <tr><td><code>tabMode</code></td><td>2</td><td> The action bar will use a series of horizontal tabs for navigation. </td></tr> </table> */ public static final int navigationMode=0x7f010027; /** Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int paddingEnd=0x7f010039; /** Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int paddingStart=0x7f010038; /** Default Panel Menu style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int panelMenuListTheme=0x7f01004b; /** Default Panel Menu width. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int panelMenuListWidth=0x7f01004a; /** Default PopupMenu style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int popupMenuStyle=0x7f010049; /** Reference to a layout to use for displaying a prompt in the dropdown for spinnerMode="dropdown". This layout must contain a TextView with the id {@code @android:id/text1} to be populated with the prompt text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int popupPromptView=0x7f010053; /** Specifies the horizontal padding on either end for an embedded progress bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int progressBarPadding=0x7f010036; /** Specifies a style resource to use for an embedded progress bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int progressBarStyle=0x7f010034; /** The prompt to display when the spinner's dialog is shown. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int prompt=0x7f010051; /** An optional query hint string to be displayed in the empty query field. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int queryHint=0x7f01005b; /** SearchView dropdown background <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchDropdownBackground=0x7f01005c; /** The list item height for search results. @hide <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int searchResultListItemHeight=0x7f010065; /** SearchView AutoCompleteTextView style <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewAutoCompleteTextView=0x7f010069; /** SearchView close button icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewCloseIcon=0x7f01005d; /** SearchView query refinement icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewEditQuery=0x7f010061; /** SearchView query refinement icon background <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewEditQueryBackground=0x7f010062; /** SearchView Go button icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewGoIcon=0x7f01005e; /** SearchView Search icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewSearchIcon=0x7f01005f; /** SearchView text field background for the left section <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewTextField=0x7f010063; /** SearchView text field background for the right section <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewTextFieldRight=0x7f010064; /** SearchView Voice button icon <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int searchViewVoiceIcon=0x7f010060; /** A style that may be applied to buttons or other selectable items that should react to pressed and focus states, but that do not have a clear visual border along the edges. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int selectableItemBackground=0x7f010019; /** How this item should display in the Action Bar, if present. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>never</code></td><td>0</td><td> Never show this item in an action bar, show it in the overflow menu instead. Mutually exclusive with "ifRoom" and "always". </td></tr> <tr><td><code>ifRoom</code></td><td>1</td><td> Show this item in an action bar if there is room for it as determined by the system. Favor this option over "always" where possible. Mutually exclusive with "never" and "always". </td></tr> <tr><td><code>always</code></td><td>2</td><td> Always show this item in an actionbar, even if it would override the system's limits of how much stuff to put there. This may make your action bar look bad on some screens. In most cases you should use "ifRoom" instead. Mutually exclusive with "ifRoom" and "never". </td></tr> <tr><td><code>withText</code></td><td>4</td><td> When this item is shown as an action in the action bar, show a text label with it even if it has an icon representation. </td></tr> <tr><td><code>collapseActionView</code></td><td>8</td><td> This item's action view collapses to a normal menu item. When expanded, the action view takes over a larger segment of its container. </td></tr> </table> */ public static final int showAsAction=0x7f01004d; /** Setting for which dividers to show. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>none</code></td><td>0</td><td></td></tr> <tr><td><code>beginning</code></td><td>1</td><td></td></tr> <tr><td><code>middle</code></td><td>2</td><td></td></tr> <tr><td><code>end</code></td><td>4</td><td></td></tr> </table> */ public static final int showDividers=0x7f010055; /** Default Spinner style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int spinnerDropDownItemStyle=0x7f010058; /** Display mode for spinner options. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>dialog</code></td><td>0</td><td> Spinner options will be presented to the user as a dialog window. </td></tr> <tr><td><code>dropdown</code></td><td>1</td><td> Spinner options will be presented to the user as an inline dropdown anchored to the spinner widget itself. </td></tr> </table> */ public static final int spinnerMode=0x7f010052; /** Default Spinner style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int spinnerStyle=0x7f010057; /** Specifies subtitle text used for navigationMode="normal" <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int subtitle=0x7f010029; /** Specifies a style to use for subtitle text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int subtitleTextStyle=0x7f01002b; /** Present the text in ALL CAPS. This may use a small-caps form when available. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". */ public static final int textAllCaps=0x7f01006d; /** Text color, typeface, size, and style for the text inside of a popup menu. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceLargePopupMenu=0x7f010014; /** The preferred TextAppearance for the primary text of list items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceListItem=0x7f010023; /** The preferred TextAppearance for the primary text of small list items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceListItemSmall=0x7f010024; /** Text color, typeface, size, and style for system search result subtitle. Defaults to primary inverse text color. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceSearchResultSubtitle=0x7f010067; /** Text color, typeface, size, and style for system search result title. Defaults to primary inverse text color. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceSearchResultTitle=0x7f010066; /** Text color, typeface, size, and style for small text inside of a popup menu. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int textAppearanceSmallPopupMenu=0x7f010015; /** Text color for urls in search suggestions, used by things like global search <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". */ public static final int textColorSearchUrl=0x7f010068; /** <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int title=0x7f010025; /** Specifies a style to use for title text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". */ public static final int titleTextStyle=0x7f01002a; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowActionBar=0x7f010000; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowActionBarOverlay=0x7f010001; /** A fixed height for the window along the major axis of the screen, that is, when in portrait. Can be either an absolute dimension or a fraction of the screen size in that dimension. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowFixedHeightMajor=0x7f010006; /** A fixed height for the window along the minor axis of the screen, that is, when in landscape. Can be either an absolute dimension or a fraction of the screen size in that dimension. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowFixedHeightMinor=0x7f010004; /** A fixed width for the window along the major axis of the screen, that is, when in landscape. Can be either an absolute dimension or a fraction of the screen size in that dimension. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowFixedWidthMajor=0x7f010003; /** A fixed width for the window along the minor axis of the screen, that is, when in portrait. Can be either an absolute dimension or a fraction of the screen size in that dimension. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowFixedWidthMinor=0x7f010005; /** <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. */ public static final int windowSplitActionBar=0x7f010002; } public static final class bool { public static final int abc_action_bar_embed_tabs_pre_jb=0x7f060000; public static final int abc_action_bar_expanded_action_views_exclusive=0x7f060001; /** Whether action menu items should be displayed in ALLCAPS or not. Defaults to true. If this is not appropriate for specific locales it should be disabled in that locale's resources. */ public static final int abc_config_actionMenuItemAllCaps=0x7f060005; /** Whether action menu items should obey the "withText" showAsAction flag. This may be set to false for situations where space is extremely limited. Whether action menu items should obey the "withText" showAsAction. This may be set to false for situations where space is extremely limited. */ public static final int abc_config_allowActionMenuItemTextWithIcon=0x7f060004; public static final int abc_config_showMenuShortcutsWhenKeyboardPresent=0x7f060003; public static final int abc_split_action_bar_is_narrow=0x7f060002; } public static final class color { public static final int abc_search_url_text_holo=0x7f070003; public static final int abc_search_url_text_normal=0x7f070000; public static final int abc_search_url_text_pressed=0x7f070002; public static final int abc_search_url_text_selected=0x7f070001; } public static final class dimen { /** Default height of an action bar. Default height of an action bar. Default height of an action bar. Default height of an action bar. Default height of an action bar. */ public static final int abc_action_bar_default_height=0x7f080002; /** Vertical padding around action bar icons. Vertical padding around action bar icons. Vertical padding around action bar icons. Vertical padding around action bar icons. Vertical padding around action bar icons. */ public static final int abc_action_bar_icon_vertical_padding=0x7f080003; /** Size of the indeterminate Progress Bar Size of the indeterminate Progress Bar */ public static final int abc_action_bar_progress_bar_size=0x7f08000a; /** Maximum height for a stacked tab bar as part of an action bar */ public static final int abc_action_bar_stacked_max_height=0x7f080009; /** Maximum width for a stacked action bar tab. This prevents action bar tabs from becoming too wide on a wide screen when only a few are present. */ public static final int abc_action_bar_stacked_tab_max_width=0x7f080001; /** Bottom margin for action bar subtitles Bottom margin for action bar subtitles Bottom margin for action bar subtitles Bottom margin for action bar subtitles Bottom margin for action bar subtitles */ public static final int abc_action_bar_subtitle_bottom_margin=0x7f080007; /** Text size for action bar subtitles Text size for action bar subtitles Text size for action bar subtitles Text size for action bar subtitles Text size for action bar subtitles */ public static final int abc_action_bar_subtitle_text_size=0x7f080005; /** Top margin for action bar subtitles Top margin for action bar subtitles Top margin for action bar subtitles Top margin for action bar subtitles Top margin for action bar subtitles */ public static final int abc_action_bar_subtitle_top_margin=0x7f080006; /** Text size for action bar titles Text size for action bar titles Text size for action bar titles Text size for action bar titles Text size for action bar titles */ public static final int abc_action_bar_title_text_size=0x7f080004; /** Minimum width for an action button in the menu area of an action bar Minimum width for an action button in the menu area of an action bar Minimum width for an action button in the menu area of an action bar */ public static final int abc_action_button_min_width=0x7f080008; /** The maximum width we would prefer dialogs to be. 0 if there is no maximum (let them grow as large as the screen). Actual values are specified for -large and -xlarge configurations. see comment in values/config.xml see comment in values/config.xml */ public static final int abc_config_prefDialogWidth=0x7f080000; /** Width of the icon in a dropdown list */ public static final int abc_dropdownitem_icon_width=0x7f080010; /** Text padding for dropdown items */ public static final int abc_dropdownitem_text_padding_left=0x7f08000e; public static final int abc_dropdownitem_text_padding_right=0x7f08000f; public static final int abc_panel_menu_list_width=0x7f08000b; /** Preferred width of the search view. */ public static final int abc_search_view_preferred_width=0x7f08000d; /** Minimum width of the search view text entry area. Minimum width of the search view text entry area. Minimum width of the search view text entry area. Minimum width of the search view text entry area. */ public static final int abc_search_view_text_min_width=0x7f08000c; /** The platform's desired fixed height for a dialog along the major axis (the screen is in portrait). This may be either a fraction or a dimension. The platform's desired fixed height for a dialog along the major axis (the screen is in portrait). This may be either a fraction or a dimension. The platform's desired fixed height for a dialog along the major axis (the screen is in portrait). This may be either a fraction or a dimension. */ public static final int dialog_fixed_height_major=0x7f080013; /** The platform's desired fixed height for a dialog along the minor axis (the screen is in landscape). This may be either a fraction or a dimension. The platform's desired fixed height for a dialog along the minor axis (the screen is in landscape). This may be either a fraction or a dimension. The platform's desired fixed height for a dialog along the minor axis (the screen is in landscape). This may be either a fraction or a dimension. */ public static final int dialog_fixed_height_minor=0x7f080014; /** The platform's desired fixed width for a dialog along the major axis (the screen is in landscape). This may be either a fraction or a dimension. The platform's desired fixed width for a dialog along the major axis (the screen is in landscape). This may be either a fraction or a dimension. The platform's desired fixed width for a dialog along the major axis (the screen is in landscape). This may be either a fraction or a dimension. */ public static final int dialog_fixed_width_major=0x7f080011; /** The platform's desired fixed width for a dialog along the minor axis (the screen is in portrait). This may be either a fraction or a dimension. The platform's desired fixed width for a dialog along the minor axis (the screen is in portrait). This may be either a fraction or a dimension. The platform's desired fixed width for a dialog along the minor axis (the screen is in portrait). This may be either a fraction or a dimension. */ public static final int dialog_fixed_width_minor=0x7f080012; } public static final class drawable { public static final int abc_ab_bottom_solid_dark_holo=0x7f020000; public static final int abc_ab_bottom_solid_light_holo=0x7f020001; public static final int abc_ab_bottom_transparent_dark_holo=0x7f020002; public static final int abc_ab_bottom_transparent_light_holo=0x7f020003; public static final int abc_ab_share_pack_holo_dark=0x7f020004; public static final int abc_ab_share_pack_holo_light=0x7f020005; public static final int abc_ab_solid_dark_holo=0x7f020006; public static final int abc_ab_solid_light_holo=0x7f020007; public static final int abc_ab_stacked_solid_dark_holo=0x7f020008; public static final int abc_ab_stacked_solid_light_holo=0x7f020009; public static final int abc_ab_stacked_transparent_dark_holo=0x7f02000a; public static final int abc_ab_stacked_transparent_light_holo=0x7f02000b; public static final int abc_ab_transparent_dark_holo=0x7f02000c; public static final int abc_ab_transparent_light_holo=0x7f02000d; public static final int abc_cab_background_bottom_holo_dark=0x7f02000e; public static final int abc_cab_background_bottom_holo_light=0x7f02000f; public static final int abc_cab_background_top_holo_dark=0x7f020010; public static final int abc_cab_background_top_holo_light=0x7f020011; public static final int abc_ic_ab_back_holo_dark=0x7f020012; public static final int abc_ic_ab_back_holo_light=0x7f020013; public static final int abc_ic_cab_done_holo_dark=0x7f020014; public static final int abc_ic_cab_done_holo_light=0x7f020015; public static final int abc_ic_clear=0x7f020016; public static final int abc_ic_clear_disabled=0x7f020017; public static final int abc_ic_clear_holo_light=0x7f020018; public static final int abc_ic_clear_normal=0x7f020019; public static final int abc_ic_clear_search_api_disabled_holo_light=0x7f02001a; public static final int abc_ic_clear_search_api_holo_light=0x7f02001b; public static final int abc_ic_commit_search_api_holo_dark=0x7f02001c; public static final int abc_ic_commit_search_api_holo_light=0x7f02001d; public static final int abc_ic_go=0x7f02001e; public static final int abc_ic_go_search_api_holo_light=0x7f02001f; public static final int abc_ic_menu_moreoverflow_normal_holo_dark=0x7f020020; public static final int abc_ic_menu_moreoverflow_normal_holo_light=0x7f020021; public static final int abc_ic_menu_share_holo_dark=0x7f020022; public static final int abc_ic_menu_share_holo_light=0x7f020023; public static final int abc_ic_search=0x7f020024; public static final int abc_ic_search_api_holo_light=0x7f020025; public static final int abc_ic_voice_search=0x7f020026; public static final int abc_ic_voice_search_api_holo_light=0x7f020027; public static final int abc_item_background_holo_dark=0x7f020028; public static final int abc_item_background_holo_light=0x7f020029; public static final int abc_list_divider_holo_dark=0x7f02002a; public static final int abc_list_divider_holo_light=0x7f02002b; public static final int abc_list_focused_holo=0x7f02002c; public static final int abc_list_longpressed_holo=0x7f02002d; public static final int abc_list_pressed_holo_dark=0x7f02002e; public static final int abc_list_pressed_holo_light=0x7f02002f; public static final int abc_list_selector_background_transition_holo_dark=0x7f020030; public static final int abc_list_selector_background_transition_holo_light=0x7f020031; public static final int abc_list_selector_disabled_holo_dark=0x7f020032; public static final int abc_list_selector_disabled_holo_light=0x7f020033; public static final int abc_list_selector_holo_dark=0x7f020034; public static final int abc_list_selector_holo_light=0x7f020035; public static final int abc_menu_dropdown_panel_holo_dark=0x7f020036; public static final int abc_menu_dropdown_panel_holo_light=0x7f020037; public static final int abc_menu_hardkey_panel_holo_dark=0x7f020038; public static final int abc_menu_hardkey_panel_holo_light=0x7f020039; public static final int abc_search_dropdown_dark=0x7f02003a; public static final int abc_search_dropdown_light=0x7f02003b; public static final int abc_spinner_ab_default_holo_dark=0x7f02003c; public static final int abc_spinner_ab_default_holo_light=0x7f02003d; public static final int abc_spinner_ab_disabled_holo_dark=0x7f02003e; public static final int abc_spinner_ab_disabled_holo_light=0x7f02003f; public static final int abc_spinner_ab_focused_holo_dark=0x7f020040; public static final int abc_spinner_ab_focused_holo_light=0x7f020041; public static final int abc_spinner_ab_holo_dark=0x7f020042; public static final int abc_spinner_ab_holo_light=0x7f020043; public static final int abc_spinner_ab_pressed_holo_dark=0x7f020044; public static final int abc_spinner_ab_pressed_holo_light=0x7f020045; public static final int abc_tab_indicator_ab_holo=0x7f020046; public static final int abc_tab_selected_focused_holo=0x7f020047; public static final int abc_tab_selected_holo=0x7f020048; public static final int abc_tab_selected_pressed_holo=0x7f020049; public static final int abc_tab_unselected_pressed_holo=0x7f02004a; public static final int abc_textfield_search_default_holo_dark=0x7f02004b; public static final int abc_textfield_search_default_holo_light=0x7f02004c; public static final int abc_textfield_search_right_default_holo_dark=0x7f02004d; public static final int abc_textfield_search_right_default_holo_light=0x7f02004e; public static final int abc_textfield_search_right_selected_holo_dark=0x7f02004f; public static final int abc_textfield_search_right_selected_holo_light=0x7f020050; public static final int abc_textfield_search_selected_holo_dark=0x7f020051; public static final int abc_textfield_search_selected_holo_light=0x7f020052; public static final int abc_textfield_searchview_holo_dark=0x7f020053; public static final int abc_textfield_searchview_holo_light=0x7f020054; public static final int abc_textfield_searchview_right_holo_dark=0x7f020055; public static final int abc_textfield_searchview_right_holo_light=0x7f020056; public static final int ali_pay_logo=0x7f020057; public static final int ic_launcher=0x7f020058; public static final int weixin_pay_logo=0x7f020059; } public static final class id { public static final int action_bar=0x7f05001c; public static final int action_bar_activity_content=0x7f050015; public static final int action_bar_container=0x7f05001b; public static final int action_bar_overlay_layout=0x7f05001f; public static final int action_bar_root=0x7f05001a; public static final int action_bar_subtitle=0x7f050023; public static final int action_bar_title=0x7f050022; public static final int action_context_bar=0x7f05001d; public static final int action_menu_divider=0x7f050016; public static final int action_menu_presenter=0x7f050017; public static final int action_mode_close_button=0x7f050024; public static final int activity_chooser_view_content=0x7f050025; public static final int always=0x7f05000b; public static final int beginning=0x7f050011; public static final int checkbox=0x7f05002d; public static final int collapseActionView=0x7f05000d; public static final int default_activity_button=0x7f050028; public static final int dialog=0x7f05000e; public static final int disableHome=0x7f050008; public static final int dropdown=0x7f05000f; public static final int edit_query=0x7f050030; public static final int end=0x7f050013; public static final int expand_activities_button=0x7f050026; public static final int expanded_menu=0x7f05002c; public static final int fragment=0x7f05003c; public static final int home=0x7f050014; public static final int homeAsUp=0x7f050005; public static final int icon=0x7f05002a; public static final int ifRoom=0x7f05000a; public static final int image=0x7f050027; public static final int imageAli=0x7f05003f; public static final int imageAli2=0x7f050044; public static final int imageWeixin=0x7f05003d; public static final int imageWeixin2=0x7f050042; public static final int listMode=0x7f050001; public static final int list_item=0x7f050029; public static final int middle=0x7f050012; public static final int never=0x7f050009; public static final int none=0x7f050010; public static final int normal=0x7f050000; public static final int pay=0x7f050041; public static final int pay2=0x7f050046; public static final int progress_circular=0x7f050018; public static final int progress_horizontal=0x7f050019; public static final int radio=0x7f05002f; public static final int radioAli=0x7f050040; public static final int radioAli2=0x7f050045; public static final int radioWeixin=0x7f05003e; public static final int radioWeixin2=0x7f050043; public static final int search_badge=0x7f050032; public static final int search_bar=0x7f050031; public static final int search_button=0x7f050033; public static final int search_close_btn=0x7f050038; public static final int search_edit_frame=0x7f050034; public static final int search_go_btn=0x7f05003a; public static final int search_mag_icon=0x7f050035; public static final int search_plate=0x7f050036; public static final int search_src_text=0x7f050037; public static final int search_voice_btn=0x7f05003b; public static final int shortcut=0x7f05002e; public static final int showCustom=0x7f050007; public static final int showHome=0x7f050004; public static final int showTitle=0x7f050006; public static final int split_action_bar=0x7f05001e; public static final int submit_area=0x7f050039; public static final int tabMode=0x7f050002; public static final int title=0x7f05002b; public static final int top_action_bar=0x7f050020; public static final int up=0x7f050021; public static final int useLogo=0x7f050003; public static final int withText=0x7f05000c; } public static final class integer { /** The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. The maximum number of action buttons that should be permitted within an action bar/action mode. This will be used to determine how many showAsAction="ifRoom" items can fit. "always" items can override this. */ public static final int abc_max_action_buttons=0x7f090000; } public static final class layout { public static final int abc_action_bar_decor=0x7f030000; public static final int abc_action_bar_decor_include=0x7f030001; public static final int abc_action_bar_decor_overlay=0x7f030002; public static final int abc_action_bar_home=0x7f030003; public static final int abc_action_bar_tab=0x7f030004; public static final int abc_action_bar_tabbar=0x7f030005; public static final int abc_action_bar_title_item=0x7f030006; public static final int abc_action_bar_view_list_nav_layout=0x7f030007; public static final int abc_action_menu_item_layout=0x7f030008; public static final int abc_action_menu_layout=0x7f030009; public static final int abc_action_mode_bar=0x7f03000a; public static final int abc_action_mode_close_item=0x7f03000b; public static final int abc_activity_chooser_view=0x7f03000c; public static final int abc_activity_chooser_view_include=0x7f03000d; public static final int abc_activity_chooser_view_list_item=0x7f03000e; public static final int abc_expanded_menu_layout=0x7f03000f; public static final int abc_list_menu_item_checkbox=0x7f030010; public static final int abc_list_menu_item_icon=0x7f030011; public static final int abc_list_menu_item_layout=0x7f030012; public static final int abc_list_menu_item_radio=0x7f030013; public static final int abc_popup_menu_item_layout=0x7f030014; public static final int abc_search_dropdown_item_icons_2line=0x7f030015; public static final int abc_search_view=0x7f030016; public static final int abc_simple_decor=0x7f030017; public static final int activity_base_pay=0x7f030018; public static final int pay_component=0x7f030019; public static final int pay_result=0x7f03001a; public static final int support_simple_spinner_dropdown_item=0x7f03001b; public static final int test=0x7f03001c; } public static final class string { /** Content description for the action bar "home" affordance. [CHAR LIMIT=NONE] */ public static final int abc_action_bar_home_description=0x7f0a0001; /** Content description for the action bar "up" affordance. [CHAR LIMIT=NONE] */ public static final int abc_action_bar_up_description=0x7f0a0002; /** Content description for the action menu overflow button. [CHAR LIMIT=NONE] */ public static final int abc_action_menu_overflow_description=0x7f0a0003; /** Label for the "Done" button on the far left of action mode toolbars. */ public static final int abc_action_mode_done=0x7f0a0000; /** Title for a button to expand the list of activities in ActivityChooserView [CHAR LIMIT=25] */ public static final int abc_activity_chooser_view_see_all=0x7f0a000a; /** ActivityChooserView - accessibility support Description of the shwoing of a popup window with activities to choose from. [CHAR LIMIT=NONE] */ public static final int abc_activitychooserview_choose_application=0x7f0a0009; /** SearchView accessibility description for clear button [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_clear=0x7f0a0006; /** SearchView accessibility description for search text field [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_query=0x7f0a0005; /** SearchView accessibility description for search button [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_search=0x7f0a0004; /** SearchView accessibility description for submit button [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_submit=0x7f0a0007; /** SearchView accessibility description for voice button [CHAR LIMIT=NONE] */ public static final int abc_searchview_description_voice=0x7f0a0008; /** Description of the choose target button in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] */ public static final int abc_shareactionprovider_share_with=0x7f0a000c; /** Description of a share target (both in the list of such or the default share button) in a ShareActionProvider (share UI). [CHAR LIMIT=NONE] */ public static final int abc_shareactionprovider_share_with_application=0x7f0a000b; public static final int app_name=0x7f0a000d; public static final int hello_world=0x7f0a000e; } public static final class style { /** Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to backward-compatibility can go here. Base application theme for API 11+. This theme completely replaces AppBaseTheme from res/values/styles.xml on API 11+ devices. API 11 theme customizations can go here. Base application theme for API 14+. This theme completely replaces AppBaseTheme from BOTH res/values/styles.xml and res/values-v11/styles.xml on API 14+ devices. API 14 theme customizations can go here. */ public static final int AppBaseTheme=0x7f0b008b; /** Application theme. All customizations that are NOT specific to a particular API-level can go here. */ public static final int AppTheme=0x7f0b008c; /** Mimic text appearance in select_dialog_item.xml */ public static final int TextAppearance_AppCompat_Base_CompactMenu_Dialog=0x7f0b0063; public static final int TextAppearance_AppCompat_Base_SearchResult=0x7f0b006d; public static final int TextAppearance_AppCompat_Base_SearchResult_Subtitle=0x7f0b006f; /** Search View result styles */ public static final int TextAppearance_AppCompat_Base_SearchResult_Title=0x7f0b006e; public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Large=0x7f0b0069; public static final int TextAppearance_AppCompat_Base_Widget_PopupMenu_Small=0x7f0b006a; public static final int TextAppearance_AppCompat_Light_Base_SearchResult=0x7f0b0070; public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Subtitle=0x7f0b0072; /** TextAppearance.Holo.Light.SearchResult.* are private so we extend from the default versions instead (which are exactly the same). */ public static final int TextAppearance_AppCompat_Light_Base_SearchResult_Title=0x7f0b0071; public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Large=0x7f0b006b; public static final int TextAppearance_AppCompat_Light_Base_Widget_PopupMenu_Small=0x7f0b006c; public static final int TextAppearance_AppCompat_Light_SearchResult_Subtitle=0x7f0b0035; public static final int TextAppearance_AppCompat_Light_SearchResult_Title=0x7f0b0034; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Large=0x7f0b0030; public static final int TextAppearance_AppCompat_Light_Widget_PopupMenu_Small=0x7f0b0031; public static final int TextAppearance_AppCompat_SearchResult_Subtitle=0x7f0b0033; public static final int TextAppearance_AppCompat_SearchResult_Title=0x7f0b0032; public static final int TextAppearance_AppCompat_Widget_ActionBar_Menu=0x7f0b001a; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle=0x7f0b0006; public static final int TextAppearance_AppCompat_Widget_ActionBar_Subtitle_Inverse=0x7f0b0008; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title=0x7f0b0005; public static final int TextAppearance_AppCompat_Widget_ActionBar_Title_Inverse=0x7f0b0007; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle=0x7f0b001e; public static final int TextAppearance_AppCompat_Widget_ActionMode_Subtitle_Inverse=0x7f0b0020; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title=0x7f0b001d; public static final int TextAppearance_AppCompat_Widget_ActionMode_Title_Inverse=0x7f0b001f; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Menu=0x7f0b0054; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle=0x7f0b0056; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Subtitle_Inverse=0x7f0b0058; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title=0x7f0b0055; public static final int TextAppearance_AppCompat_Widget_Base_ActionBar_Title_Inverse=0x7f0b0057; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle=0x7f0b0051; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Subtitle_Inverse=0x7f0b0053; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title=0x7f0b0050; public static final int TextAppearance_AppCompat_Widget_Base_ActionMode_Title_Inverse=0x7f0b0052; public static final int TextAppearance_AppCompat_Widget_Base_DropDownItem=0x7f0b0061; public static final int TextAppearance_AppCompat_Widget_DropDownItem=0x7f0b0021; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Large=0x7f0b002e; public static final int TextAppearance_AppCompat_Widget_PopupMenu_Small=0x7f0b002f; public static final int TextAppearance_Widget_AppCompat_Base_ExpandedMenu_Item=0x7f0b0062; public static final int TextAppearance_Widget_AppCompat_ExpandedMenu_Item=0x7f0b0028; /** Themes in the "Theme.AppCompat" family will contain an action bar by default. If Holo themes are available on the current platform version they will be used. A limited Holo-styled action bar will be provided on platform versions older than 3.0. (API 11) These theme declarations contain any version-independent specification. Items that need to vary based on platform version should be defined in the corresponding "Theme.Base" theme. Platform-independent theme providing an action bar in a dark-themed activity. */ public static final int Theme_AppCompat=0x7f0b0077; /** Menu/item attributes */ public static final int Theme_AppCompat_Base_CompactMenu=0x7f0b0083; public static final int Theme_AppCompat_Base_CompactMenu_Dialog=0x7f0b0084; /** Menu/item attributes */ public static final int Theme_AppCompat_CompactMenu=0x7f0b007c; public static final int Theme_AppCompat_CompactMenu_Dialog=0x7f0b007d; public static final int Theme_AppCompat_DialogWhenLarge=0x7f0b007a; /** Platform-independent theme providing an action bar in a light-themed activity. */ public static final int Theme_AppCompat_Light=0x7f0b0078; /** Platform-independent theme providing an action bar in a dark-themed activity. */ public static final int Theme_AppCompat_Light_DarkActionBar=0x7f0b0079; public static final int Theme_AppCompat_Light_DialogWhenLarge=0x7f0b007b; /** Base platform-dependent theme */ public static final int Theme_Base=0x7f0b007e; /** Base platform-dependent theme providing an action bar in a dark-themed activity. Base platform-dependent theme providing an action bar in a dark-themed activity. */ public static final int Theme_Base_AppCompat=0x7f0b0080; public static final int Theme_Base_AppCompat_Dialog_FixedSize=0x7f0b0087; public static final int Theme_Base_AppCompat_Dialog_Light_FixedSize=0x7f0b0088; public static final int Theme_Base_AppCompat_DialogWhenLarge=0x7f0b0085; /** As we have defined the theme in values-large (for compat) and values-large takes precedence over values-v14, we need to reset back to the Holo parent in values-large-v14. As the themes in values-v14 & values-large-v14 are exactly the same, these "double base" themes can be inherited from in both values-v14 and values-large-v14. */ public static final int Theme_Base_AppCompat_DialogWhenLarge_Base=0x7f0b0089; /** Base platform-dependent theme providing an action bar in a light-themed activity. Base platform-dependent theme providing an action bar in a light-themed activity. */ public static final int Theme_Base_AppCompat_Light=0x7f0b0081; /** Base platform-dependent theme providing a dark action bar in a light-themed activity. Base platform-dependent theme providing a dark action bar in a light-themed activity. */ public static final int Theme_Base_AppCompat_Light_DarkActionBar=0x7f0b0082; public static final int Theme_Base_AppCompat_Light_DialogWhenLarge=0x7f0b0086; public static final int Theme_Base_AppCompat_Light_DialogWhenLarge_Base=0x7f0b008a; /** Base platform-dependent theme providing a light-themed activity. */ public static final int Theme_Base_Light=0x7f0b007f; /** Styles in here can be extended for customisation in your application. Each utilises one of the Base styles. If Holo themes are available on the current platform version they will be used instead of the compat styles. */ public static final int Widget_AppCompat_ActionBar=0x7f0b0000; public static final int Widget_AppCompat_ActionBar_Solid=0x7f0b0002; public static final int Widget_AppCompat_ActionBar_TabBar=0x7f0b0011; public static final int Widget_AppCompat_ActionBar_TabText=0x7f0b0017; public static final int Widget_AppCompat_ActionBar_TabView=0x7f0b0014; public static final int Widget_AppCompat_ActionButton=0x7f0b000b; public static final int Widget_AppCompat_ActionButton_CloseMode=0x7f0b000d; public static final int Widget_AppCompat_ActionButton_Overflow=0x7f0b000f; public static final int Widget_AppCompat_ActionMode=0x7f0b001b; public static final int Widget_AppCompat_ActivityChooserView=0x7f0b0038; public static final int Widget_AppCompat_AutoCompleteTextView=0x7f0b0036; public static final int Widget_AppCompat_Base_ActionBar=0x7f0b003a; public static final int Widget_AppCompat_Base_ActionBar_Solid=0x7f0b003c; public static final int Widget_AppCompat_Base_ActionBar_TabBar=0x7f0b0045; public static final int Widget_AppCompat_Base_ActionBar_TabText=0x7f0b004b; public static final int Widget_AppCompat_Base_ActionBar_TabView=0x7f0b0048; /** Action Button Styles */ public static final int Widget_AppCompat_Base_ActionButton=0x7f0b003f; public static final int Widget_AppCompat_Base_ActionButton_CloseMode=0x7f0b0041; public static final int Widget_AppCompat_Base_ActionButton_Overflow=0x7f0b0043; public static final int Widget_AppCompat_Base_ActionMode=0x7f0b004e; public static final int Widget_AppCompat_Base_ActivityChooserView=0x7f0b0075; /** AutoCompleteTextView styles (for SearchView) */ public static final int Widget_AppCompat_Base_AutoCompleteTextView=0x7f0b0073; public static final int Widget_AppCompat_Base_DropDownItem_Spinner=0x7f0b005d; /** Popup Menu */ public static final int Widget_AppCompat_Base_ListPopupWindow=0x7f0b0065; /** Spinner Widgets */ public static final int Widget_AppCompat_Base_ListView_DropDown=0x7f0b005f; public static final int Widget_AppCompat_Base_ListView_Menu=0x7f0b0064; public static final int Widget_AppCompat_Base_PopupMenu=0x7f0b0067; public static final int Widget_AppCompat_Base_ProgressBar=0x7f0b005a; /** Progress Bar */ public static final int Widget_AppCompat_Base_ProgressBar_Horizontal=0x7f0b0059; /** Action Bar Spinner Widgets */ public static final int Widget_AppCompat_Base_Spinner=0x7f0b005b; public static final int Widget_AppCompat_DropDownItem_Spinner=0x7f0b0024; public static final int Widget_AppCompat_Light_ActionBar=0x7f0b0001; public static final int Widget_AppCompat_Light_ActionBar_Solid=0x7f0b0003; public static final int Widget_AppCompat_Light_ActionBar_Solid_Inverse=0x7f0b0004; public static final int Widget_AppCompat_Light_ActionBar_TabBar=0x7f0b0012; public static final int Widget_AppCompat_Light_ActionBar_TabBar_Inverse=0x7f0b0013; public static final int Widget_AppCompat_Light_ActionBar_TabText=0x7f0b0018; public static final int Widget_AppCompat_Light_ActionBar_TabText_Inverse=0x7f0b0019; public static final int Widget_AppCompat_Light_ActionBar_TabView=0x7f0b0015; public static final int Widget_AppCompat_Light_ActionBar_TabView_Inverse=0x7f0b0016; public static final int Widget_AppCompat_Light_ActionButton=0x7f0b000c; public static final int Widget_AppCompat_Light_ActionButton_CloseMode=0x7f0b000e; public static final int Widget_AppCompat_Light_ActionButton_Overflow=0x7f0b0010; public static final int Widget_AppCompat_Light_ActionMode_Inverse=0x7f0b001c; public static final int Widget_AppCompat_Light_ActivityChooserView=0x7f0b0039; public static final int Widget_AppCompat_Light_AutoCompleteTextView=0x7f0b0037; public static final int Widget_AppCompat_Light_Base_ActionBar=0x7f0b003b; public static final int Widget_AppCompat_Light_Base_ActionBar_Solid=0x7f0b003d; public static final int Widget_AppCompat_Light_Base_ActionBar_Solid_Inverse=0x7f0b003e; public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar=0x7f0b0046; public static final int Widget_AppCompat_Light_Base_ActionBar_TabBar_Inverse=0x7f0b0047; public static final int Widget_AppCompat_Light_Base_ActionBar_TabText=0x7f0b004c; public static final int Widget_AppCompat_Light_Base_ActionBar_TabText_Inverse=0x7f0b004d; public static final int Widget_AppCompat_Light_Base_ActionBar_TabView=0x7f0b0049; public static final int Widget_AppCompat_Light_Base_ActionBar_TabView_Inverse=0x7f0b004a; public static final int Widget_AppCompat_Light_Base_ActionButton=0x7f0b0040; public static final int Widget_AppCompat_Light_Base_ActionButton_CloseMode=0x7f0b0042; public static final int Widget_AppCompat_Light_Base_ActionButton_Overflow=0x7f0b0044; public static final int Widget_AppCompat_Light_Base_ActionMode_Inverse=0x7f0b004f; public static final int Widget_AppCompat_Light_Base_ActivityChooserView=0x7f0b0076; public static final int Widget_AppCompat_Light_Base_AutoCompleteTextView=0x7f0b0074; public static final int Widget_AppCompat_Light_Base_DropDownItem_Spinner=0x7f0b005e; public static final int Widget_AppCompat_Light_Base_ListPopupWindow=0x7f0b0066; public static final int Widget_AppCompat_Light_Base_ListView_DropDown=0x7f0b0060; public static final int Widget_AppCompat_Light_Base_PopupMenu=0x7f0b0068; public static final int Widget_AppCompat_Light_Base_Spinner=0x7f0b005c; public static final int Widget_AppCompat_Light_DropDownItem_Spinner=0x7f0b0025; public static final int Widget_AppCompat_Light_ListPopupWindow=0x7f0b002a; public static final int Widget_AppCompat_Light_ListView_DropDown=0x7f0b0027; public static final int Widget_AppCompat_Light_PopupMenu=0x7f0b002c; public static final int Widget_AppCompat_Light_Spinner_DropDown_ActionBar=0x7f0b0023; public static final int Widget_AppCompat_ListPopupWindow=0x7f0b0029; public static final int Widget_AppCompat_ListView_DropDown=0x7f0b0026; public static final int Widget_AppCompat_ListView_Menu=0x7f0b002d; public static final int Widget_AppCompat_PopupMenu=0x7f0b002b; public static final int Widget_AppCompat_ProgressBar=0x7f0b000a; public static final int Widget_AppCompat_ProgressBar_Horizontal=0x7f0b0009; public static final int Widget_AppCompat_Spinner_DropDown_ActionBar=0x7f0b0022; } public static final class styleable { /** ============================================ Attributes used to style the Action Bar. These should be set on your theme; the default actionBarStyle will propagate them to the correct elements as needed. Please Note: when overriding attributes for an ActionBar style you must specify each attribute twice: once with the "android:" namespace prefix and once without. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionBar_background com.eland.basepay:background}</code></td><td> Specifies a background drawable for the action bar.</td></tr> <tr><td><code>{@link #ActionBar_backgroundSplit com.eland.basepay:backgroundSplit}</code></td><td> Specifies a background drawable for the bottom component of a split action bar.</td></tr> <tr><td><code>{@link #ActionBar_backgroundStacked com.eland.basepay:backgroundStacked}</code></td><td> Specifies a background drawable for a second stacked row of the action bar.</td></tr> <tr><td><code>{@link #ActionBar_customNavigationLayout com.eland.basepay:customNavigationLayout}</code></td><td> Specifies a layout for custom navigation.</td></tr> <tr><td><code>{@link #ActionBar_displayOptions com.eland.basepay:displayOptions}</code></td><td> Options affecting how the action bar is displayed.</td></tr> <tr><td><code>{@link #ActionBar_divider com.eland.basepay:divider}</code></td><td> Specifies the drawable used for item dividers.</td></tr> <tr><td><code>{@link #ActionBar_height com.eland.basepay:height}</code></td><td> Specifies a fixed height.</td></tr> <tr><td><code>{@link #ActionBar_homeLayout com.eland.basepay:homeLayout}</code></td><td> Specifies a layout to use for the "home" section of the action bar.</td></tr> <tr><td><code>{@link #ActionBar_icon com.eland.basepay:icon}</code></td><td> Specifies the drawable used for the application icon.</td></tr> <tr><td><code>{@link #ActionBar_indeterminateProgressStyle com.eland.basepay:indeterminateProgressStyle}</code></td><td> Specifies a style resource to use for an indeterminate progress spinner.</td></tr> <tr><td><code>{@link #ActionBar_itemPadding com.eland.basepay:itemPadding}</code></td><td> Specifies padding that should be applied to the left and right sides of system-provided items in the bar.</td></tr> <tr><td><code>{@link #ActionBar_logo com.eland.basepay:logo}</code></td><td> Specifies the drawable used for the application logo.</td></tr> <tr><td><code>{@link #ActionBar_navigationMode com.eland.basepay:navigationMode}</code></td><td> The type of navigation to use.</td></tr> <tr><td><code>{@link #ActionBar_progressBarPadding com.eland.basepay:progressBarPadding}</code></td><td> Specifies the horizontal padding on either end for an embedded progress bar.</td></tr> <tr><td><code>{@link #ActionBar_progressBarStyle com.eland.basepay:progressBarStyle}</code></td><td> Specifies a style resource to use for an embedded progress bar.</td></tr> <tr><td><code>{@link #ActionBar_subtitle com.eland.basepay:subtitle}</code></td><td> Specifies subtitle text used for navigationMode="normal" </td></tr> <tr><td><code>{@link #ActionBar_subtitleTextStyle com.eland.basepay:subtitleTextStyle}</code></td><td> Specifies a style to use for subtitle text.</td></tr> <tr><td><code>{@link #ActionBar_title com.eland.basepay:title}</code></td><td> Specifies title text used for navigationMode="normal" </td></tr> <tr><td><code>{@link #ActionBar_titleTextStyle com.eland.basepay:titleTextStyle}</code></td><td> Specifies a style to use for title text.</td></tr> </table> @see #ActionBar_background @see #ActionBar_backgroundSplit @see #ActionBar_backgroundStacked @see #ActionBar_customNavigationLayout @see #ActionBar_displayOptions @see #ActionBar_divider @see #ActionBar_height @see #ActionBar_homeLayout @see #ActionBar_icon @see #ActionBar_indeterminateProgressStyle @see #ActionBar_itemPadding @see #ActionBar_logo @see #ActionBar_navigationMode @see #ActionBar_progressBarPadding @see #ActionBar_progressBarStyle @see #ActionBar_subtitle @see #ActionBar_subtitleTextStyle @see #ActionBar_title @see #ActionBar_titleTextStyle */ public static final int[] ActionBar = { 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036, 0x7f010037 }; /** <p> @attr description Specifies a background drawable for the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:background */ public static final int ActionBar_background = 10; /** <p> @attr description Specifies a background drawable for the bottom component of a split action bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:backgroundSplit */ public static final int ActionBar_backgroundSplit = 12; /** <p> @attr description Specifies a background drawable for a second stacked row of the action bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:backgroundStacked */ public static final int ActionBar_backgroundStacked = 11; /** <p> @attr description Specifies a layout for custom navigation. Overrides navigationMode. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:customNavigationLayout */ public static final int ActionBar_customNavigationLayout = 13; /** <p> @attr description Options affecting how the action bar is displayed. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>useLogo</code></td><td>0x1</td><td></td></tr> <tr><td><code>showHome</code></td><td>0x2</td><td></td></tr> <tr><td><code>homeAsUp</code></td><td>0x4</td><td></td></tr> <tr><td><code>showTitle</code></td><td>0x8</td><td></td></tr> <tr><td><code>showCustom</code></td><td>0x10</td><td></td></tr> <tr><td><code>disableHome</code></td><td>0x20</td><td></td></tr> </table> <p>This is a private symbol. @attr name com.eland.basepay:displayOptions */ public static final int ActionBar_displayOptions = 3; /** <p> @attr description Specifies the drawable used for item dividers. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:divider */ public static final int ActionBar_divider = 9; /** <p> @attr description Specifies a fixed height. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:height */ public static final int ActionBar_height = 1; /** <p> @attr description Specifies a layout to use for the "home" section of the action bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:homeLayout */ public static final int ActionBar_homeLayout = 14; /** <p> @attr description Specifies the drawable used for the application icon. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:icon */ public static final int ActionBar_icon = 7; /** <p> @attr description Specifies a style resource to use for an indeterminate progress spinner. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:indeterminateProgressStyle */ public static final int ActionBar_indeterminateProgressStyle = 16; /** <p> @attr description Specifies padding that should be applied to the left and right sides of system-provided items in the bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:itemPadding */ public static final int ActionBar_itemPadding = 18; /** <p> @attr description Specifies the drawable used for the application logo. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:logo */ public static final int ActionBar_logo = 8; /** <p> @attr description The type of navigation to use. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>normal</code></td><td>0</td><td> Normal static title text </td></tr> <tr><td><code>listMode</code></td><td>1</td><td> The action bar will use a selection list for navigation. </td></tr> <tr><td><code>tabMode</code></td><td>2</td><td> The action bar will use a series of horizontal tabs for navigation. </td></tr> </table> <p>This is a private symbol. @attr name com.eland.basepay:navigationMode */ public static final int ActionBar_navigationMode = 2; /** <p> @attr description Specifies the horizontal padding on either end for an embedded progress bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:progressBarPadding */ public static final int ActionBar_progressBarPadding = 17; /** <p> @attr description Specifies a style resource to use for an embedded progress bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:progressBarStyle */ public static final int ActionBar_progressBarStyle = 15; /** <p> @attr description Specifies subtitle text used for navigationMode="normal" <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:subtitle */ public static final int ActionBar_subtitle = 4; /** <p> @attr description Specifies a style to use for subtitle text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:subtitleTextStyle */ public static final int ActionBar_subtitleTextStyle = 6; /** <p> @attr description Specifies title text used for navigationMode="normal" <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:title */ public static final int ActionBar_title = 0; /** <p> @attr description Specifies a style to use for title text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:titleTextStyle */ public static final int ActionBar_titleTextStyle = 5; /** Valid LayoutParams for views placed in the action bar as custom views. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionBarLayout_android_layout_gravity android:layout_gravity}</code></td><td></td></tr> </table> @see #ActionBarLayout_android_layout_gravity */ public static final int[] ActionBarLayout = { 0x010100b3 }; /** <p>This symbol is the offset where the {@link android.R.attr#layout_gravity} attribute's value can be found in the {@link #ActionBarLayout} array. @attr name android:layout_gravity */ public static final int ActionBarLayout_android_layout_gravity = 0; /** These attributes are meant to be specified and customized by the app. The system will read and apply them as needed. These attributes control properties of the activity window, such as whether an action bar should be present and whether it should overlay content. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionBarWindow_windowActionBar com.eland.basepay:windowActionBar}</code></td><td></td></tr> <tr><td><code>{@link #ActionBarWindow_windowActionBarOverlay com.eland.basepay:windowActionBarOverlay}</code></td><td></td></tr> <tr><td><code>{@link #ActionBarWindow_windowFixedHeightMajor com.eland.basepay:windowFixedHeightMajor}</code></td><td> A fixed height for the window along the major axis of the screen, that is, when in portrait.</td></tr> <tr><td><code>{@link #ActionBarWindow_windowFixedHeightMinor com.eland.basepay:windowFixedHeightMinor}</code></td><td> A fixed height for the window along the minor axis of the screen, that is, when in landscape.</td></tr> <tr><td><code>{@link #ActionBarWindow_windowFixedWidthMajor com.eland.basepay:windowFixedWidthMajor}</code></td><td> A fixed width for the window along the major axis of the screen, that is, when in landscape.</td></tr> <tr><td><code>{@link #ActionBarWindow_windowFixedWidthMinor com.eland.basepay:windowFixedWidthMinor}</code></td><td> A fixed width for the window along the minor axis of the screen, that is, when in portrait.</td></tr> <tr><td><code>{@link #ActionBarWindow_windowSplitActionBar com.eland.basepay:windowSplitActionBar}</code></td><td></td></tr> </table> @see #ActionBarWindow_windowActionBar @see #ActionBarWindow_windowActionBarOverlay @see #ActionBarWindow_windowFixedHeightMajor @see #ActionBarWindow_windowFixedHeightMinor @see #ActionBarWindow_windowFixedWidthMajor @see #ActionBarWindow_windowFixedWidthMinor @see #ActionBarWindow_windowSplitActionBar */ public static final int[] ActionBarWindow = { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010006 }; /** <p>This symbol is the offset where the {@link com.eland.basepay.R.attr#windowActionBar} attribute's value can be found in the {@link #ActionBarWindow} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.eland.basepay:windowActionBar */ public static final int ActionBarWindow_windowActionBar = 0; /** <p>This symbol is the offset where the {@link com.eland.basepay.R.attr#windowActionBarOverlay} attribute's value can be found in the {@link #ActionBarWindow} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.eland.basepay:windowActionBarOverlay */ public static final int ActionBarWindow_windowActionBarOverlay = 1; /** <p> @attr description A fixed height for the window along the major axis of the screen, that is, when in portrait. Can be either an absolute dimension or a fraction of the screen size in that dimension. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:windowFixedHeightMajor */ public static final int ActionBarWindow_windowFixedHeightMajor = 6; /** <p> @attr description A fixed height for the window along the minor axis of the screen, that is, when in landscape. Can be either an absolute dimension or a fraction of the screen size in that dimension. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:windowFixedHeightMinor */ public static final int ActionBarWindow_windowFixedHeightMinor = 4; /** <p> @attr description A fixed width for the window along the major axis of the screen, that is, when in landscape. Can be either an absolute dimension or a fraction of the screen size in that dimension. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:windowFixedWidthMajor */ public static final int ActionBarWindow_windowFixedWidthMajor = 3; /** <p> @attr description A fixed width for the window along the minor axis of the screen, that is, when in portrait. Can be either an absolute dimension or a fraction of the screen size in that dimension. <p>May be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>May be a fractional value, which is a floating point number appended with either % or %p, such as "<code>14.5%</code>". The % suffix always means a percentage of the base size; the optional %p suffix provides a size relative to some parent container. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:windowFixedWidthMinor */ public static final int ActionBarWindow_windowFixedWidthMinor = 5; /** <p>This symbol is the offset where the {@link com.eland.basepay.R.attr#windowSplitActionBar} attribute's value can be found in the {@link #ActionBarWindow} array. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. @attr name com.eland.basepay:windowSplitActionBar */ public static final int ActionBarWindow_windowSplitActionBar = 2; /** Attributes that can be used with a ActionMenuItemView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionMenuItemView_android_minWidth android:minWidth}</code></td><td></td></tr> </table> @see #ActionMenuItemView_android_minWidth */ public static final int[] ActionMenuItemView = { 0x0101013f }; /** <p>This symbol is the offset where the {@link android.R.attr#minWidth} attribute's value can be found in the {@link #ActionMenuItemView} array. @attr name android:minWidth */ public static final int ActionMenuItemView_android_minWidth = 0; /** Size of padding on either end of a divider. */ public static final int[] ActionMenuView = { }; /** Attributes that can be used with a ActionMode. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActionMode_background com.eland.basepay:background}</code></td><td> Specifies a background for the action mode bar.</td></tr> <tr><td><code>{@link #ActionMode_backgroundSplit com.eland.basepay:backgroundSplit}</code></td><td> Specifies a background for the split action mode bar.</td></tr> <tr><td><code>{@link #ActionMode_height com.eland.basepay:height}</code></td><td> Specifies a fixed height for the action mode bar.</td></tr> <tr><td><code>{@link #ActionMode_subtitleTextStyle com.eland.basepay:subtitleTextStyle}</code></td><td> Specifies a style to use for subtitle text.</td></tr> <tr><td><code>{@link #ActionMode_titleTextStyle com.eland.basepay:titleTextStyle}</code></td><td> Specifies a style to use for title text.</td></tr> </table> @see #ActionMode_background @see #ActionMode_backgroundSplit @see #ActionMode_height @see #ActionMode_subtitleTextStyle @see #ActionMode_titleTextStyle */ public static final int[] ActionMode = { 0x7f010026, 0x7f01002a, 0x7f01002b, 0x7f01002f, 0x7f010031 }; /** <p> @attr description Specifies a background for the action mode bar. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:background */ public static final int ActionMode_background = 3; /** <p> @attr description Specifies a background for the split action mode bar. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a color value, in the form of "<code>#<i>rgb</i></code>", "<code>#<i>argb</i></code>", "<code>#<i>rrggbb</i></code>", or "<code>#<i>aarrggbb</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:backgroundSplit */ public static final int ActionMode_backgroundSplit = 4; /** <p> @attr description Specifies a fixed height for the action mode bar. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:height */ public static final int ActionMode_height = 0; /** <p> @attr description Specifies a style to use for subtitle text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:subtitleTextStyle */ public static final int ActionMode_subtitleTextStyle = 2; /** <p> @attr description Specifies a style to use for title text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:titleTextStyle */ public static final int ActionMode_titleTextStyle = 1; /** Attrbitutes for a ActivityChooserView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #ActivityChooserView_expandActivityOverflowButtonDrawable com.eland.basepay:expandActivityOverflowButtonDrawable}</code></td><td> The drawable to show in the button for expanding the activities overflow popup.</td></tr> <tr><td><code>{@link #ActivityChooserView_initialActivityCount com.eland.basepay:initialActivityCount}</code></td><td> The maximal number of items initially shown in the activity list.</td></tr> </table> @see #ActivityChooserView_expandActivityOverflowButtonDrawable @see #ActivityChooserView_initialActivityCount */ public static final int[] ActivityChooserView = { 0x7f01006a, 0x7f01006b }; /** <p> @attr description The drawable to show in the button for expanding the activities overflow popup. <strong>Note:</strong> Clients would like to set this drawable as a clue about the action the chosen activity will perform. For example, if share activity is to be chosen the drawable should give a clue that sharing is to be performed. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:expandActivityOverflowButtonDrawable */ public static final int ActivityChooserView_expandActivityOverflowButtonDrawable = 1; /** <p> @attr description The maximal number of items initially shown in the activity list. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:initialActivityCount */ public static final int ActivityChooserView_initialActivityCount = 0; /** Attributes that can be used with a CompatTextView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #CompatTextView_textAllCaps com.eland.basepay:textAllCaps}</code></td><td> Present the text in ALL CAPS.</td></tr> </table> @see #CompatTextView_textAllCaps */ public static final int[] CompatTextView = { 0x7f01006d }; /** <p> @attr description Present the text in ALL CAPS. This may use a small-caps form when available. <p>May be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>May be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This is a private symbol. @attr name com.eland.basepay:textAllCaps */ public static final int CompatTextView_textAllCaps = 0; /** Attributes that can be used with a LinearLayoutICS. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #LinearLayoutICS_divider com.eland.basepay:divider}</code></td><td> Drawable to use as a vertical divider between buttons.</td></tr> <tr><td><code>{@link #LinearLayoutICS_dividerPadding com.eland.basepay:dividerPadding}</code></td><td> Size of padding on either end of a divider.</td></tr> <tr><td><code>{@link #LinearLayoutICS_showDividers com.eland.basepay:showDividers}</code></td><td> Setting for which dividers to show.</td></tr> </table> @see #LinearLayoutICS_divider @see #LinearLayoutICS_dividerPadding @see #LinearLayoutICS_showDividers */ public static final int[] LinearLayoutICS = { 0x7f01002e, 0x7f010055, 0x7f010056 }; /** <p> @attr description Drawable to use as a vertical divider between buttons. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:divider */ public static final int LinearLayoutICS_divider = 0; /** <p> @attr description Size of padding on either end of a divider. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:dividerPadding */ public static final int LinearLayoutICS_dividerPadding = 2; /** <p> @attr description Setting for which dividers to show. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>none</code></td><td>0</td><td></td></tr> <tr><td><code>beginning</code></td><td>1</td><td></td></tr> <tr><td><code>middle</code></td><td>2</td><td></td></tr> <tr><td><code>end</code></td><td>4</td><td></td></tr> </table> <p>This is a private symbol. @attr name com.eland.basepay:showDividers */ public static final int LinearLayoutICS_showDividers = 1; /** Base attributes that are available to all groups. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #MenuGroup_android_checkableBehavior android:checkableBehavior}</code></td><td> Whether the items are capable of displaying a check mark.</td></tr> <tr><td><code>{@link #MenuGroup_android_enabled android:enabled}</code></td><td> Whether the items are enabled.</td></tr> <tr><td><code>{@link #MenuGroup_android_id android:id}</code></td><td> The ID of the group.</td></tr> <tr><td><code>{@link #MenuGroup_android_menuCategory android:menuCategory}</code></td><td> The category applied to all items within this group.</td></tr> <tr><td><code>{@link #MenuGroup_android_orderInCategory android:orderInCategory}</code></td><td> The order within the category applied to all items within this group.</td></tr> <tr><td><code>{@link #MenuGroup_android_visible android:visible}</code></td><td> Whether the items are shown/visible.</td></tr> </table> @see #MenuGroup_android_checkableBehavior @see #MenuGroup_android_enabled @see #MenuGroup_android_id @see #MenuGroup_android_menuCategory @see #MenuGroup_android_orderInCategory @see #MenuGroup_android_visible */ public static final int[] MenuGroup = { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 }; /** <p> @attr description Whether the items are capable of displaying a check mark. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#checkableBehavior}. @attr name android:checkableBehavior */ public static final int MenuGroup_android_checkableBehavior = 5; /** <p> @attr description Whether the items are enabled. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#enabled}. @attr name android:enabled */ public static final int MenuGroup_android_enabled = 0; /** <p> @attr description The ID of the group. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#id}. @attr name android:id */ public static final int MenuGroup_android_id = 1; /** <p> @attr description The category applied to all items within this group. (This will be or'ed with the orderInCategory attribute.) <p>This corresponds to the global attribute resource symbol {@link android.R.attr#menuCategory}. @attr name android:menuCategory */ public static final int MenuGroup_android_menuCategory = 3; /** <p> @attr description The order within the category applied to all items within this group. (This will be or'ed with the category attribute.) <p>This corresponds to the global attribute resource symbol {@link android.R.attr#orderInCategory}. @attr name android:orderInCategory */ public static final int MenuGroup_android_orderInCategory = 4; /** <p> @attr description Whether the items are shown/visible. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#visible}. @attr name android:visible */ public static final int MenuGroup_android_visible = 2; /** Base attributes that are available to all Item objects. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #MenuItem_actionLayout com.eland.basepay:actionLayout}</code></td><td> An optional layout to be used as an action view.</td></tr> <tr><td><code>{@link #MenuItem_actionProviderClass com.eland.basepay:actionProviderClass}</code></td><td> The name of an optional ActionProvider class to instantiate an action view and perform operations such as default action for that menu item.</td></tr> <tr><td><code>{@link #MenuItem_actionViewClass com.eland.basepay:actionViewClass}</code></td><td> The name of an optional View class to instantiate and use as an action view.</td></tr> <tr><td><code>{@link #MenuItem_android_alphabeticShortcut android:alphabeticShortcut}</code></td><td> The alphabetic shortcut key.</td></tr> <tr><td><code>{@link #MenuItem_android_checkable android:checkable}</code></td><td> Whether the item is capable of displaying a check mark.</td></tr> <tr><td><code>{@link #MenuItem_android_checked android:checked}</code></td><td> Whether the item is checked.</td></tr> <tr><td><code>{@link #MenuItem_android_enabled android:enabled}</code></td><td> Whether the item is enabled.</td></tr> <tr><td><code>{@link #MenuItem_android_icon android:icon}</code></td><td> The icon associated with this item.</td></tr> <tr><td><code>{@link #MenuItem_android_id android:id}</code></td><td> The ID of the item.</td></tr> <tr><td><code>{@link #MenuItem_android_menuCategory android:menuCategory}</code></td><td> The category applied to the item.</td></tr> <tr><td><code>{@link #MenuItem_android_numericShortcut android:numericShortcut}</code></td><td> The numeric shortcut key.</td></tr> <tr><td><code>{@link #MenuItem_android_onClick android:onClick}</code></td><td> Name of a method on the Context used to inflate the menu that will be called when the item is clicked.</td></tr> <tr><td><code>{@link #MenuItem_android_orderInCategory android:orderInCategory}</code></td><td> The order within the category applied to the item.</td></tr> <tr><td><code>{@link #MenuItem_android_title android:title}</code></td><td> The title associated with the item.</td></tr> <tr><td><code>{@link #MenuItem_android_titleCondensed android:titleCondensed}</code></td><td> The condensed title associated with the item.</td></tr> <tr><td><code>{@link #MenuItem_android_visible android:visible}</code></td><td> Whether the item is shown/visible.</td></tr> <tr><td><code>{@link #MenuItem_showAsAction com.eland.basepay:showAsAction}</code></td><td> How this item should display in the Action Bar, if present.</td></tr> </table> @see #MenuItem_actionLayout @see #MenuItem_actionProviderClass @see #MenuItem_actionViewClass @see #MenuItem_android_alphabeticShortcut @see #MenuItem_android_checkable @see #MenuItem_android_checked @see #MenuItem_android_enabled @see #MenuItem_android_icon @see #MenuItem_android_id @see #MenuItem_android_menuCategory @see #MenuItem_android_numericShortcut @see #MenuItem_android_onClick @see #MenuItem_android_orderInCategory @see #MenuItem_android_title @see #MenuItem_android_titleCondensed @see #MenuItem_android_visible @see #MenuItem_showAsAction */ public static final int[] MenuItem = { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050 }; /** <p> @attr description An optional layout to be used as an action view. See {@link android.view.MenuItem#setActionView(android.view.View)} for more info. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:actionLayout */ public static final int MenuItem_actionLayout = 14; /** <p> @attr description The name of an optional ActionProvider class to instantiate an action view and perform operations such as default action for that menu item. See {@link android.view.MenuItem#setActionProvider(android.view.ActionProvider)} for more info. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:actionProviderClass */ public static final int MenuItem_actionProviderClass = 16; /** <p> @attr description The name of an optional View class to instantiate and use as an action view. See {@link android.view.MenuItem#setActionView(android.view.View)} for more info. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:actionViewClass */ public static final int MenuItem_actionViewClass = 15; /** <p> @attr description The alphabetic shortcut key. This is the shortcut when using a keyboard with alphabetic keys. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#alphabeticShortcut}. @attr name android:alphabeticShortcut */ public static final int MenuItem_android_alphabeticShortcut = 9; /** <p> @attr description Whether the item is capable of displaying a check mark. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#checkable}. @attr name android:checkable */ public static final int MenuItem_android_checkable = 11; /** <p> @attr description Whether the item is checked. Note that you must first have enabled checking with the checkable attribute or else the check mark will not appear. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#checked}. @attr name android:checked */ public static final int MenuItem_android_checked = 3; /** <p> @attr description Whether the item is enabled. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#enabled}. @attr name android:enabled */ public static final int MenuItem_android_enabled = 1; /** <p> @attr description The icon associated with this item. This icon will not always be shown, so the title should be sufficient in describing this item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#icon}. @attr name android:icon */ public static final int MenuItem_android_icon = 0; /** <p> @attr description The ID of the item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#id}. @attr name android:id */ public static final int MenuItem_android_id = 2; /** <p> @attr description The category applied to the item. (This will be or'ed with the orderInCategory attribute.) <p>This corresponds to the global attribute resource symbol {@link android.R.attr#menuCategory}. @attr name android:menuCategory */ public static final int MenuItem_android_menuCategory = 5; /** <p> @attr description The numeric shortcut key. This is the shortcut when using a numeric (e.g., 12-key) keyboard. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#numericShortcut}. @attr name android:numericShortcut */ public static final int MenuItem_android_numericShortcut = 10; /** <p> @attr description Name of a method on the Context used to inflate the menu that will be called when the item is clicked. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#onClick}. @attr name android:onClick */ public static final int MenuItem_android_onClick = 12; /** <p> @attr description The order within the category applied to the item. (This will be or'ed with the category attribute.) <p>This corresponds to the global attribute resource symbol {@link android.R.attr#orderInCategory}. @attr name android:orderInCategory */ public static final int MenuItem_android_orderInCategory = 6; /** <p> @attr description The title associated with the item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#title}. @attr name android:title */ public static final int MenuItem_android_title = 7; /** <p> @attr description The condensed title associated with the item. This is used in situations where the normal title may be too long to be displayed. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#titleCondensed}. @attr name android:titleCondensed */ public static final int MenuItem_android_titleCondensed = 8; /** <p> @attr description Whether the item is shown/visible. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#visible}. @attr name android:visible */ public static final int MenuItem_android_visible = 4; /** <p> @attr description How this item should display in the Action Bar, if present. <p>Must be one or more (separated by '|') of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>never</code></td><td>0</td><td> Never show this item in an action bar, show it in the overflow menu instead. Mutually exclusive with "ifRoom" and "always". </td></tr> <tr><td><code>ifRoom</code></td><td>1</td><td> Show this item in an action bar if there is room for it as determined by the system. Favor this option over "always" where possible. Mutually exclusive with "never" and "always". </td></tr> <tr><td><code>always</code></td><td>2</td><td> Always show this item in an actionbar, even if it would override the system's limits of how much stuff to put there. This may make your action bar look bad on some screens. In most cases you should use "ifRoom" instead. Mutually exclusive with "ifRoom" and "never". </td></tr> <tr><td><code>withText</code></td><td>4</td><td> When this item is shown as an action in the action bar, show a text label with it even if it has an icon representation. </td></tr> <tr><td><code>collapseActionView</code></td><td>8</td><td> This item's action view collapses to a normal menu item. When expanded, the action view takes over a larger segment of its container. </td></tr> </table> <p>This is a private symbol. @attr name com.eland.basepay:showAsAction */ public static final int MenuItem_showAsAction = 13; /** Attributes that can be used with a MenuView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #MenuView_android_headerBackground android:headerBackground}</code></td><td> Default background for the menu header.</td></tr> <tr><td><code>{@link #MenuView_android_horizontalDivider android:horizontalDivider}</code></td><td> Default horizontal divider between rows of menu items.</td></tr> <tr><td><code>{@link #MenuView_android_itemBackground android:itemBackground}</code></td><td> Default background for each menu item.</td></tr> <tr><td><code>{@link #MenuView_android_itemIconDisabledAlpha android:itemIconDisabledAlpha}</code></td><td> Default disabled icon alpha for each menu item that shows an icon.</td></tr> <tr><td><code>{@link #MenuView_android_itemTextAppearance android:itemTextAppearance}</code></td><td> Default appearance of menu item text.</td></tr> <tr><td><code>{@link #MenuView_android_preserveIconSpacing android:preserveIconSpacing}</code></td><td> Whether space should be reserved in layout when an icon is missing.</td></tr> <tr><td><code>{@link #MenuView_android_verticalDivider android:verticalDivider}</code></td><td> Default vertical divider between menu items.</td></tr> <tr><td><code>{@link #MenuView_android_windowAnimationStyle android:windowAnimationStyle}</code></td><td> Default animations for the menu.</td></tr> </table> @see #MenuView_android_headerBackground @see #MenuView_android_horizontalDivider @see #MenuView_android_itemBackground @see #MenuView_android_itemIconDisabledAlpha @see #MenuView_android_itemTextAppearance @see #MenuView_android_preserveIconSpacing @see #MenuView_android_verticalDivider @see #MenuView_android_windowAnimationStyle */ public static final int[] MenuView = { 0x010100ae, 0x0101012c, 0x0101012d, 0x0101012e, 0x0101012f, 0x01010130, 0x01010131, 0x01010435 }; /** <p> @attr description Default background for the menu header. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#headerBackground}. @attr name android:headerBackground */ public static final int MenuView_android_headerBackground = 4; /** <p> @attr description Default horizontal divider between rows of menu items. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#horizontalDivider}. @attr name android:horizontalDivider */ public static final int MenuView_android_horizontalDivider = 2; /** <p> @attr description Default background for each menu item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#itemBackground}. @attr name android:itemBackground */ public static final int MenuView_android_itemBackground = 5; /** <p> @attr description Default disabled icon alpha for each menu item that shows an icon. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#itemIconDisabledAlpha}. @attr name android:itemIconDisabledAlpha */ public static final int MenuView_android_itemIconDisabledAlpha = 6; /** <p> @attr description Default appearance of menu item text. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#itemTextAppearance}. @attr name android:itemTextAppearance */ public static final int MenuView_android_itemTextAppearance = 1; /** <p> @attr description Whether space should be reserved in layout when an icon is missing. <p>This is a private symbol. @attr name android:preserveIconSpacing */ public static final int MenuView_android_preserveIconSpacing = 7; /** <p> @attr description Default vertical divider between menu items. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#verticalDivider}. @attr name android:verticalDivider */ public static final int MenuView_android_verticalDivider = 3; /** <p> @attr description Default animations for the menu. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#windowAnimationStyle}. @attr name android:windowAnimationStyle */ public static final int MenuView_android_windowAnimationStyle = 0; /** Attributes that can be used with a SearchView. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #SearchView_android_imeOptions android:imeOptions}</code></td><td> The IME options to set on the query text field.</td></tr> <tr><td><code>{@link #SearchView_android_inputType android:inputType}</code></td><td> The input type to set on the query text field.</td></tr> <tr><td><code>{@link #SearchView_android_maxWidth android:maxWidth}</code></td><td> An optional maximum width of the SearchView.</td></tr> <tr><td><code>{@link #SearchView_iconifiedByDefault com.eland.basepay:iconifiedByDefault}</code></td><td> The default state of the SearchView.</td></tr> <tr><td><code>{@link #SearchView_queryHint com.eland.basepay:queryHint}</code></td><td> An optional query hint string to be displayed in the empty query field.</td></tr> </table> @see #SearchView_android_imeOptions @see #SearchView_android_inputType @see #SearchView_android_maxWidth @see #SearchView_iconifiedByDefault @see #SearchView_queryHint */ public static final int[] SearchView = { 0x0101011f, 0x01010220, 0x01010264, 0x7f01005a, 0x7f01005b }; /** <p> @attr description The IME options to set on the query text field. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#imeOptions}. @attr name android:imeOptions */ public static final int SearchView_android_imeOptions = 2; /** <p> @attr description The input type to set on the query text field. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#inputType}. @attr name android:inputType */ public static final int SearchView_android_inputType = 1; /** <p> @attr description An optional maximum width of the SearchView. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#maxWidth}. @attr name android:maxWidth */ public static final int SearchView_android_maxWidth = 0; /** <p> @attr description The default state of the SearchView. If true, it will be iconified when not in use and expanded when clicked. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:iconifiedByDefault */ public static final int SearchView_iconifiedByDefault = 3; /** <p> @attr description An optional query hint string to be displayed in the empty query field. <p>Must be a string value, using '\\;' to escape characters such as '\\n' or '\\uxxxx' for a unicode character. <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:queryHint */ public static final int SearchView_queryHint = 4; /** Attributes that can be used with a Spinner. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #Spinner_android_dropDownHorizontalOffset android:dropDownHorizontalOffset}</code></td><td> Horizontal offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_android_dropDownSelector android:dropDownSelector}</code></td><td> List selector to use for spinnerMode="dropdown" display.</td></tr> <tr><td><code>{@link #Spinner_android_dropDownVerticalOffset android:dropDownVerticalOffset}</code></td><td> Vertical offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_android_dropDownWidth android:dropDownWidth}</code></td><td> Width of the dropdown in spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_android_gravity android:gravity}</code></td><td> Gravity setting for positioning the currently selected item.</td></tr> <tr><td><code>{@link #Spinner_android_popupBackground android:popupBackground}</code></td><td> Background drawable to use for the dropdown in spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_disableChildrenWhenDisabled com.eland.basepay:disableChildrenWhenDisabled}</code></td><td> Whether this spinner should mark child views as enabled/disabled when the spinner itself is enabled/disabled.</td></tr> <tr><td><code>{@link #Spinner_popupPromptView com.eland.basepay:popupPromptView}</code></td><td> Reference to a layout to use for displaying a prompt in the dropdown for spinnerMode="dropdown".</td></tr> <tr><td><code>{@link #Spinner_prompt com.eland.basepay:prompt}</code></td><td> The prompt to display when the spinner's dialog is shown.</td></tr> <tr><td><code>{@link #Spinner_spinnerMode com.eland.basepay:spinnerMode}</code></td><td> Display mode for spinner options.</td></tr> </table> @see #Spinner_android_dropDownHorizontalOffset @see #Spinner_android_dropDownSelector @see #Spinner_android_dropDownVerticalOffset @see #Spinner_android_dropDownWidth @see #Spinner_android_gravity @see #Spinner_android_popupBackground @see #Spinner_disableChildrenWhenDisabled @see #Spinner_popupPromptView @see #Spinner_prompt @see #Spinner_spinnerMode */ public static final int[] Spinner = { 0x010100af, 0x01010175, 0x01010176, 0x01010262, 0x010102ac, 0x010102ad, 0x7f010051, 0x7f010052, 0x7f010053, 0x7f010054 }; /** <p> @attr description Horizontal offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown". <p>This corresponds to the global attribute resource symbol {@link android.R.attr#dropDownHorizontalOffset}. @attr name android:dropDownHorizontalOffset */ public static final int Spinner_android_dropDownHorizontalOffset = 4; /** <p> @attr description List selector to use for spinnerMode="dropdown" display. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#dropDownSelector}. @attr name android:dropDownSelector */ public static final int Spinner_android_dropDownSelector = 1; /** <p> @attr description Vertical offset from the spinner widget for positioning the dropdown in spinnerMode="dropdown". <p>This corresponds to the global attribute resource symbol {@link android.R.attr#dropDownVerticalOffset}. @attr name android:dropDownVerticalOffset */ public static final int Spinner_android_dropDownVerticalOffset = 5; /** <p> @attr description Width of the dropdown in spinnerMode="dropdown". <p>This corresponds to the global attribute resource symbol {@link android.R.attr#dropDownWidth}. @attr name android:dropDownWidth */ public static final int Spinner_android_dropDownWidth = 3; /** <p> @attr description Gravity setting for positioning the currently selected item. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#gravity}. @attr name android:gravity */ public static final int Spinner_android_gravity = 0; /** <p> @attr description Background drawable to use for the dropdown in spinnerMode="dropdown". <p>This corresponds to the global attribute resource symbol {@link android.R.attr#popupBackground}. @attr name android:popupBackground */ public static final int Spinner_android_popupBackground = 2; /** <p> @attr description Whether this spinner should mark child views as enabled/disabled when the spinner itself is enabled/disabled. <p>Must be a boolean value, either "<code>true</code>" or "<code>false</code>". <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:disableChildrenWhenDisabled */ public static final int Spinner_disableChildrenWhenDisabled = 9; /** <p> @attr description Reference to a layout to use for displaying a prompt in the dropdown for spinnerMode="dropdown". This layout must contain a TextView with the id {@code @android:id/text1} to be populated with the prompt text. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:popupPromptView */ public static final int Spinner_popupPromptView = 8; /** <p> @attr description The prompt to display when the spinner's dialog is shown. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:prompt */ public static final int Spinner_prompt = 6; /** <p> @attr description Display mode for spinner options. <p>Must be one of the following constant values.</p> <table> <colgroup align="left" /> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Constant</th><th>Value</th><th>Description</th></tr> <tr><td><code>dialog</code></td><td>0</td><td> Spinner options will be presented to the user as a dialog window. </td></tr> <tr><td><code>dropdown</code></td><td>1</td><td> Spinner options will be presented to the user as an inline dropdown anchored to the spinner widget itself. </td></tr> </table> <p>This is a private symbol. @attr name com.eland.basepay:spinnerMode */ public static final int Spinner_spinnerMode = 7; /** These are the standard attributes that make up a complete theme. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #Theme_actionDropDownStyle com.eland.basepay:actionDropDownStyle}</code></td><td> Default ActionBar dropdown style.</td></tr> <tr><td><code>{@link #Theme_dropdownListPreferredItemHeight com.eland.basepay:dropdownListPreferredItemHeight}</code></td><td> The preferred item height for dropdown lists.</td></tr> <tr><td><code>{@link #Theme_listChoiceBackgroundIndicator com.eland.basepay:listChoiceBackgroundIndicator}</code></td><td> Drawable used as a background for selected list items.</td></tr> <tr><td><code>{@link #Theme_panelMenuListTheme com.eland.basepay:panelMenuListTheme}</code></td><td> Default Panel Menu style.</td></tr> <tr><td><code>{@link #Theme_panelMenuListWidth com.eland.basepay:panelMenuListWidth}</code></td><td> Default Panel Menu width.</td></tr> <tr><td><code>{@link #Theme_popupMenuStyle com.eland.basepay:popupMenuStyle}</code></td><td> Default PopupMenu style.</td></tr> </table> @see #Theme_actionDropDownStyle @see #Theme_dropdownListPreferredItemHeight @see #Theme_listChoiceBackgroundIndicator @see #Theme_panelMenuListTheme @see #Theme_panelMenuListWidth @see #Theme_popupMenuStyle */ public static final int[] Theme = { 0x7f010047, 0x7f010048, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c }; /** <p> @attr description Default ActionBar dropdown style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:actionDropDownStyle */ public static final int Theme_actionDropDownStyle = 0; /** <p> @attr description The preferred item height for dropdown lists. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:dropdownListPreferredItemHeight */ public static final int Theme_dropdownListPreferredItemHeight = 1; /** <p> @attr description Drawable used as a background for selected list items. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:listChoiceBackgroundIndicator */ public static final int Theme_listChoiceBackgroundIndicator = 5; /** <p> @attr description Default Panel Menu style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:panelMenuListTheme */ public static final int Theme_panelMenuListTheme = 4; /** <p> @attr description Default Panel Menu width. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:panelMenuListWidth */ public static final int Theme_panelMenuListWidth = 3; /** <p> @attr description Default PopupMenu style. <p>Must be a reference to another resource, in the form "<code>@[+][<i>package</i>:]<i>type</i>:<i>name</i></code>" or to a theme attribute in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>". <p>This is a private symbol. @attr name com.eland.basepay:popupMenuStyle */ public static final int Theme_popupMenuStyle = 2; /** Attributes that can be used with a View. <p>Includes the following attributes:</p> <table> <colgroup align="left" /> <colgroup align="left" /> <tr><th>Attribute</th><th>Description</th></tr> <tr><td><code>{@link #View_android_focusable android:focusable}</code></td><td> Boolean that controls whether a view can take focus.</td></tr> <tr><td><code>{@link #View_paddingEnd com.eland.basepay:paddingEnd}</code></td><td> Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}.</td></tr> <tr><td><code>{@link #View_paddingStart com.eland.basepay:paddingStart}</code></td><td> Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}.</td></tr> </table> @see #View_android_focusable @see #View_paddingEnd @see #View_paddingStart */ public static final int[] View = { 0x010100da, 0x7f010038, 0x7f010039 }; /** <p> @attr description Boolean that controls whether a view can take focus. By default the user can not move focus to a view; by setting this attribute to true the view is allowed to take focus. This value does not impact the behavior of directly calling {@link android.view.View#requestFocus}, which will always request focus regardless of this view. It only impacts where focus navigation will try to move focus. <p>This corresponds to the global attribute resource symbol {@link android.R.attr#focusable}. @attr name android:focusable */ public static final int View_android_focusable = 0; /** <p> @attr description Sets the padding, in pixels, of the end edge; see {@link android.R.attr#padding}. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:paddingEnd */ public static final int View_paddingEnd = 2; /** <p> @attr description Sets the padding, in pixels, of the start edge; see {@link android.R.attr#padding}. <p>Must be a dimension value, which is a floating point number appended with a unit such as "<code>14.5sp</code>". Available units are: px (pixels), dp (density-independent pixels), sp (scaled pixels based on preferred font size), in (inches), mm (millimeters). <p>This may also be a reference to a resource (in the form "<code>@[<i>package</i>:]<i>type</i>:<i>name</i></code>") or theme attribute (in the form "<code>?[<i>package</i>:][<i>type</i>:]<i>name</i></code>") containing a value of this type. <p>This is a private symbol. @attr name com.eland.basepay:paddingStart */ public static final int View_paddingStart = 1; }; }
dreamofei/basePay
gen/com/eland/basepay/R.java
Java
mit
177,792
version https://git-lfs.github.com/spec/v1 oid sha256:5dd6b8442f990239dd6282d022940b377517b9a0e85ee481f7f82e3f25e516dc size 1302
yogeshsaroya/new-cdnjs
ajax/libs/mathjax/2.1/jax/output/HTML-CSS/fonts/STIX/IntegralsSm/Bold/All.js
JavaScript
mit
129
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> <title>Acknowledgements</title> <link rel="stylesheet" href="../../../../../doc/src/boostbook.css" type="text/css"> <meta name="generator" content="DocBook XSL Stylesheets V1.76.1"> <link rel="home" href="../index.html" title="Boost.Circular Buffer"> <link rel="up" href="../index.html" title="Boost.Circular Buffer"> <link rel="prev" href="release.html" title="Release Notes"> <link rel="next" href="version_id.html" title="Documentation Version Info"> </head> <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> <table cellpadding="2" width="100%"><tr> <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> <td align="center"><a href="../../../../../index.html">Home</a></td> <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> <td align="center"><a href="../../../../../more/index.htm">More</a></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="release.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="version_id.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> <div class="section"> <div class="titlepage"><div><div><h2 class="title" style="clear: both"> <a name="circular_buffer.acknowledgements"></a><a class="link" href="acknowledgements.html" title="Acknowledgements">Acknowledgements</a> </h2></div></div></div> <p> Thomas Witt in 2002 produced a prototype called cyclic buffer. </p> <p> The circular_buffer has a short history. Its first version was a std::deque adaptor. This container was not very effective because of many reallocations when inserting/removing an element. Thomas Wenish did a review of this version and motivated me to create a circular buffer which allocates memory at once when created. </p> <p> The second version adapted <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code> but it has been abandoned soon because of limited control over iterator invalidation. The current version is a full-fledged STL compliant container. </p> <p> Pavel Vozenilek did a thorough review of this version and came with many good ideas and improvements. </p> <p> The idea of the space optimized circular buffer has been introduced by Pavel Vozenilek. </p> <p> Also, I would like to thank Howard Hinnant, Nigel Stewart and everyone who participated at the formal review for valuable comments and ideas. </p> <p> Paul A. Bristow refactored the documentation in 2013 to use the full power of Quickbook, Doxygen and Autoindexing. </p> </div> <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> <td align="left"></td> <td align="right"><div class="copyright-footer">Copyright &#169; 2003-2013 Jan Gaspar<p> Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>) </p> </div></td> </tr></table> <hr> <div class="spirit-nav"> <a accesskey="p" href="release.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="version_id.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a> </div> </body> </html>
yinchunlong/abelkhan-1
ext/c++/thirdpart/c++/boost/libs/circular_buffer/doc/html/circular_buffer/acknowledgements.html
HTML
mit
4,164
class UxDialogBody { } UxDialogBody.$view = `<template><slot></slot></template>`; UxDialogBody.$resource = 'ux-dialog-body'; export { UxDialogBody }; //# sourceMappingURL=ux-dialog-body.js.map
StrahilKazlachev/dialog
dist/es2017/ux-dialog-body.js
JavaScript
mit
197
// Copyright Joyent, Inc. and other Node contributors. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to permit // persons to whom the Software is furnished to do so, subject to the // following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; // Flags: --expose-internals require('../common'); const assert = require('assert'); const util = require('util'); const errors = require('internal/errors'); const context = require('vm').runInNewContext; // isArray assert.strictEqual(util.isArray([]), true); assert.strictEqual(util.isArray(Array()), true); assert.strictEqual(util.isArray(new Array()), true); assert.strictEqual(util.isArray(new Array(5)), true); assert.strictEqual(util.isArray(new Array('with', 'some', 'entries')), true); assert.strictEqual(util.isArray(context('Array')()), true); assert.strictEqual(util.isArray({}), false); assert.strictEqual(util.isArray({ push: function() {} }), false); assert.strictEqual(util.isArray(/regexp/), false); assert.strictEqual(util.isArray(new Error()), false); assert.strictEqual(util.isArray(Object.create(Array.prototype)), false); // isRegExp assert.strictEqual(util.isRegExp(/regexp/), true); assert.strictEqual(util.isRegExp(RegExp(), 'foo'), true); assert.strictEqual(util.isRegExp(new RegExp()), true); assert.strictEqual(util.isRegExp(context('RegExp')()), true); assert.strictEqual(util.isRegExp({}), false); assert.strictEqual(util.isRegExp([]), false); assert.strictEqual(util.isRegExp(new Date()), false); assert.strictEqual(util.isRegExp(Object.create(RegExp.prototype)), false); // isDate assert.strictEqual(util.isDate(new Date()), true); assert.strictEqual(util.isDate(new Date(0), 'foo'), true); assert.strictEqual(util.isDate(new (context('Date'))()), true); assert.strictEqual(util.isDate(Date()), false); assert.strictEqual(util.isDate({}), false); assert.strictEqual(util.isDate([]), false); assert.strictEqual(util.isDate(new Error()), false); assert.strictEqual(util.isDate(Object.create(Date.prototype)), false); // isError assert.strictEqual(util.isError(new Error()), true); assert.strictEqual(util.isError(new TypeError()), true); assert.strictEqual(util.isError(new SyntaxError()), true); assert.strictEqual(util.isError(new (context('Error'))()), true); assert.strictEqual(util.isError(new (context('TypeError'))()), true); assert.strictEqual(util.isError(new (context('SyntaxError'))()), true); assert.strictEqual(util.isError({}), false); assert.strictEqual(util.isError({ name: 'Error', message: '' }), false); assert.strictEqual(util.isError([]), false); assert.strictEqual(util.isError(Object.create(Error.prototype)), true); // isObject assert.strictEqual(util.isObject({}), true); assert.strictEqual(util.isObject([]), true); assert.strictEqual(util.isObject(new Number(3)), true); assert.strictEqual(util.isObject(Number(4)), false); assert.strictEqual(util.isObject(1), false); // isPrimitive assert.strictEqual(util.isPrimitive({}), false); assert.strictEqual(util.isPrimitive(new Error()), false); assert.strictEqual(util.isPrimitive(new Date()), false); assert.strictEqual(util.isPrimitive([]), false); assert.strictEqual(util.isPrimitive(/regexp/), false); assert.strictEqual(util.isPrimitive(function() {}), false); assert.strictEqual(util.isPrimitive(new Number(1)), false); assert.strictEqual(util.isPrimitive(new String('bla')), false); assert.strictEqual(util.isPrimitive(new Boolean(true)), false); assert.strictEqual(util.isPrimitive(1), true); assert.strictEqual(util.isPrimitive('bla'), true); assert.strictEqual(util.isPrimitive(true), true); assert.strictEqual(util.isPrimitive(undefined), true); assert.strictEqual(util.isPrimitive(null), true); assert.strictEqual(util.isPrimitive(Infinity), true); assert.strictEqual(util.isPrimitive(NaN), true); assert.strictEqual(util.isPrimitive(Symbol('symbol')), true); // isBuffer assert.strictEqual(util.isBuffer('foo'), false); assert.strictEqual(util.isBuffer(Buffer.from('foo')), true); // _extend assert.deepStrictEqual(util._extend({ a: 1 }), { a: 1 }); assert.deepStrictEqual(util._extend({ a: 1 }, []), { a: 1 }); assert.deepStrictEqual(util._extend({ a: 1 }, null), { a: 1 }); assert.deepStrictEqual(util._extend({ a: 1 }, true), { a: 1 }); assert.deepStrictEqual(util._extend({ a: 1 }, false), { a: 1 }); assert.deepStrictEqual(util._extend({ a: 1 }, { b: 2 }), { a: 1, b: 2 }); assert.deepStrictEqual(util._extend({ a: 1, b: 2 }, { b: 3 }), { a: 1, b: 3 }); // deprecated assert.strictEqual(util.isBoolean(true), true); assert.strictEqual(util.isBoolean(false), true); assert.strictEqual(util.isBoolean('string'), false); assert.strictEqual(util.isNull(null), true); assert.strictEqual(util.isNull(undefined), false); assert.strictEqual(util.isNull(), false); assert.strictEqual(util.isNull('string'), false); assert.strictEqual(util.isUndefined(undefined), true); assert.strictEqual(util.isUndefined(), true); assert.strictEqual(util.isUndefined(null), false); assert.strictEqual(util.isUndefined('string'), false); assert.strictEqual(util.isNullOrUndefined(null), true); assert.strictEqual(util.isNullOrUndefined(undefined), true); assert.strictEqual(util.isNullOrUndefined(), true); assert.strictEqual(util.isNullOrUndefined('string'), false); assert.strictEqual(util.isNumber(42), true); assert.strictEqual(util.isNumber(), false); assert.strictEqual(util.isNumber('string'), false); assert.strictEqual(util.isString('string'), true); assert.strictEqual(util.isString(), false); assert.strictEqual(util.isString(42), false); assert.strictEqual(util.isSymbol(Symbol()), true); assert.strictEqual(util.isSymbol(), false); assert.strictEqual(util.isSymbol('string'), false); assert.strictEqual(util.isFunction(() => {}), true); assert.strictEqual(util.isFunction(function() {}), true); assert.strictEqual(util.isFunction(), false); assert.strictEqual(util.isFunction('string'), false); { assert.strictEqual(util.types.isNativeError(new Error()), true); assert.strictEqual(util.types.isNativeError(new TypeError()), true); assert.strictEqual(util.types.isNativeError(new SyntaxError()), true); assert.strictEqual(util.types.isNativeError(new (context('Error'))()), true); assert.strictEqual( util.types.isNativeError(new (context('TypeError'))()), true ); assert.strictEqual( util.types.isNativeError(new (context('SyntaxError'))()), true ); assert.strictEqual(util.types.isNativeError({}), false); assert.strictEqual( util.types.isNativeError({ name: 'Error', message: '' }), false ); assert.strictEqual(util.types.isNativeError([]), false); assert.strictEqual( util.types.isNativeError(Object.create(Error.prototype)), false ); assert.strictEqual( util.types.isNativeError(new errors.codes.ERR_IPC_CHANNEL_CLOSED()), true ); }
enclose-io/compiler
lts/test/parallel/test-util.js
JavaScript
mit
7,682
Ti={_Confidentiality_Engagement} sec="{_Confidentiality_Engagement}" means any of the engagements of a {_Receiving_Party} under {Relate.Conf.Engage.Xref}. =[G/Z/ol/Base]
CommonAccord/Cmacc-Paris2
Doc/G/Agt-NDA-CmA/Sec/Def/Confidentiality_Engagement/0.md
Markdown
mit
172
# # Cookbook Name:: kerl # Recipe:: binary # # Copyright 2011-2012, Michael S. Klishin, Ward Bekker # Copyright 2015, Travis CI GmbH # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. include_recipe "libreadline" include_recipe "libssl" include_recipe "libncurses" package %w(curl unixodbc-dev) installation_root = "/home/#{node.travis_build_environment.user}/otp" directory(installation_root) do owner node.travis_build_environment.user group node.travis_build_environment.group mode "0755" action :create end remote_file(node.kerl.path) do source "https://raw.githubusercontent.com/spawngrid/kerl/master/kerl" mode "0755" end home = "/home/#{node.travis_build_environment.user}" base_dir = "#{home}/.kerl" env = { 'HOME' => home, 'USER' => node.travis_build_environment.user, 'KERL_DISABLE_AGNER' => 'yes', "KERL_BASE_DIR" => base_dir, 'CPPFLAGS' => "#{ENV['CPPFLAGS']} -DEPMD6" } case [node[:platform], node[:platform_version]] when ["ubuntu", "11.04"] then # fixes compilation with Ubuntu 11.04 zlib. MK. env["KERL_CONFIGURE_OPTIONS"] = "--enable-dynamic-ssl-lib --enable-hipe" end # updates list of available releases. Needed for kerl to recognize # R15B, for example. MK. execute "erlang.releases.update" do command "#{node.kerl.path} update releases" user node.travis_build_environment.user group node.travis_build_environment.group environment(env) # run when kerl script is downloaded & installed subscribes :run, resources(:remote_file => node.kerl.path) end cookbook_file "#{node.travis_build_environment.home}/.erlang.cookie" do owner node.travis_build_environment.user group node.travis_build_environment.group mode 0600 source "erlang.cookie" end cookbook_file "#{node.travis_build_environment.home}/.build_plt" do owner node.travis_build_environment.user group node.travis_build_environment.group mode 0700 source "build_plt" end node.kerl.releases.each do |rel| require 'tmpdir' local_archive = File.join(Dir.tmpdir, "erlang-#{rel}-x86_64.tar.bz2") remote_file local_archive do source "https://s3.amazonaws.com/travis-otp-releases/#{node.platform}/#{node.platform_version}/erlang-#{rel}-x86_64.tar.bz2" checksum node.kerl.checksum[rel] end bash "Expand Erlang #{rel} archive" do user node.travis_build_environment.user group node.travis_build_environment.group code <<-EOF tar xjf #{local_archive} --directory #{File.join(node.travis_build_environment.home, 'otp')} echo #{rel} >> #{File.join(base_dir, 'otp_installations')} echo #{rel},#{rel} >> #{File.join(base_dir, 'otp_builds')} EOF not_if "test -f #{File.join(node.travis_build_environment.home, 'otp', rel)}" end end
Distelli/travis-cookbooks
community-cookbooks/kerl/recipes/binary.rb
Ruby
mit
3,274
<?php namespace TYPO3\Flow\Tests\Unit\Persistence\Doctrine; /* * This file is part of the TYPO3.Flow package. * * (c) Contributors of the Neos Project - www.neos.io * * This package is Open Source Software. For the full copyright and license * information, please view the LICENSE file which was distributed with this * source code. */ use TYPO3\Flow\Persistence\Doctrine\QueryResult; use TYPO3\Flow\Persistence\Doctrine\Query; /** * Testcase for \TYPO3\Flow\Persistence\QueryResult * */ class QueryResultTest extends \TYPO3\Flow\Tests\UnitTestCase { /** * @var QueryResult */ protected $queryResult; /** * @var Query|\PHPUnit_Framework_MockObject_MockObject */ protected $query; /** * Sets up this test case * */ public function setUp() { $this->query = $this->getMockBuilder(Query::class)->disableOriginalConstructor()->disableOriginalClone()->getMock(); $this->query->expects($this->any())->method('getResult')->will($this->returnValue(array('First result', 'second result', 'third result'))); $this->queryResult = new QueryResult($this->query); } /** * @test */ public function getQueryReturnsQueryObject() { $this->assertInstanceOf(\TYPO3\Flow\Persistence\QueryInterface::class, $this->queryResult->getQuery()); } /** * @test */ public function getQueryReturnsAClone() { $this->assertNotSame($this->query, $this->queryResult->getQuery()); } /** * @test */ public function offsetGetReturnsNullIfOffsetDoesNotExist() { $this->assertNull($this->queryResult->offsetGet('foo')); } /** * @test */ public function countCallsCountOnTheQuery() { $this->query->expects($this->once())->method('count')->will($this->returnValue(123)); $this->assertEquals(123, $this->queryResult->count()); } /** * @test */ public function countCountsQueryResultDirectlyIfAlreadyInitialized() { $this->query->expects($this->never())->method('count'); $this->queryResult->toArray(); $this->assertEquals(3, $this->queryResult->count()); } /** * @test */ public function countCallsCountOnTheQueryOnlyOnce() { $this->query->expects($this->once())->method('count')->will($this->returnValue(321)); $this->queryResult->count(); $this->assertEquals(321, $this->queryResult->count()); } }
chewbakartik/flow-development-collection
TYPO3.Flow/Tests/Unit/Persistence/Doctrine/QueryResultTest.php
PHP
mit
2,513
// Need to fork xhr to support environments with full object freezing; namely, // SalesForce's Aura and Locker environment. // See https://github.com/naugtur/xhr for license information // Maintain the original code style of https://github.com/naugtur/xhr since // we're trying to diverge as little as possible. /* eslint-disable */ "use strict"; var window = require("global/window") var isFunction = require("is-function") var parseHeaders = require("parse-headers") var xtend = require("xtend") module.exports = createXHR createXHR.XMLHttpRequest = window.XMLHttpRequest || noop createXHR.XDomainRequest = "withCredentials" in (new createXHR.XMLHttpRequest()) ? createXHR.XMLHttpRequest : window.XDomainRequest forEachArray(["get", "put", "post", "patch", "head", "delete"], function(method) { createXHR[method === "delete" ? "del" : method] = function(uri, options, callback) { options = initParams(uri, options, callback) options.method = method.toUpperCase() return _createXHR(options) } }) function forEachArray(array, iterator) { for (var i = 0; i < array.length; i++) { iterator(array[i]) } } function isEmpty(obj){ for(var i in obj){ if(obj.hasOwnProperty(i)) return false } return true } function initParams(uri, options, callback) { var params = uri if (isFunction(options)) { callback = options if (typeof uri === "string") { params = {uri:uri} } } else { params = xtend(options, {uri: uri}) } params.callback = callback return params } function createXHR(uri, options, callback) { options = initParams(uri, options, callback) return _createXHR(options) } function _createXHR(options) { if(typeof options.callback === "undefined"){ throw new Error("callback argument missing") } var called = false var callback = function cbOnce(err, response, body){ if(!called){ called = true options.callback(err, response, body) } } function readystatechange() { if (xhr.readyState === 4) { setTimeout(loadFunc, 0) } } function getBody() { // Chrome with requestType=blob throws errors arround when even testing access to responseText var body = undefined if (xhr.response) { body = xhr.response } else { body = xhr.responseText || getXml(xhr) } if (isJson) { try { body = JSON.parse(body) } catch (e) {} } return body } function errorFunc(evt) { clearTimeout(timeoutTimer) if(!(evt instanceof Error)){ evt = new Error("" + (evt || "Unknown XMLHttpRequest Error") ) } evt.statusCode = 0 return callback(evt, failureResponse) } // will load the data & process the response in a special response object function loadFunc() { if (aborted) return var status clearTimeout(timeoutTimer) if(options.useXDR && xhr.status===undefined) { //IE8 CORS GET successful response doesn't have a status field, but body is fine status = 200 } else { status = (xhr.status === 1223 ? 204 : xhr.status) } var response = failureResponse var err = null if (status !== 0){ response = { body: getBody(), statusCode: status, method: method, headers: {}, url: uri, rawRequest: xhr } if(xhr.getAllResponseHeaders){ //remember xhr can in fact be XDR for CORS in IE response.headers = parseHeaders(xhr.getAllResponseHeaders()) } } else { err = new Error("Internal XMLHttpRequest Error") } return callback(err, response, response.body) } var xhr = options.xhr || null if (!xhr) { if (options.cors || options.useXDR) { xhr = new createXHR.XDomainRequest() }else{ xhr = new createXHR.XMLHttpRequest() } } var key var aborted var uri = options.uri || options.url var method = options.method || "GET" var body = options.body || options.data var headers = options.headers || {} var sync = !!options.sync var isJson = false var timeoutTimer var failureResponse = { body: undefined, headers: {}, statusCode: 0, method: method, url: uri, rawRequest: xhr } if ("json" in options && options.json !== false) { isJson = true headers["accept"] || headers["Accept"] || (headers["Accept"] = "application/json") //Don't override existing accept header declared by user if (method !== "GET" && method !== "HEAD") { headers["content-type"] || headers["Content-Type"] || (headers["Content-Type"] = "application/json") //Don't override existing accept header declared by user body = JSON.stringify(options.json === true ? body : options.json) } } xhr.onreadystatechange = readystatechange xhr.onload = loadFunc xhr.onerror = errorFunc // IE9 must have onprogress be set to a unique function. xhr.onprogress = function () { // IE must die } xhr.onabort = function(){ aborted = true; } xhr.ontimeout = errorFunc xhr.open(method, uri, !sync, options.username, options.password) //has to be after open if(!sync) { xhr.withCredentials = !!options.withCredentials } // Cannot set timeout with sync request // not setting timeout on the xhr object, because of old webkits etc. not handling that correctly // both npm's request and jquery 1.x use this kind of timeout, so this is being consistent if (!sync && options.timeout > 0 ) { timeoutTimer = setTimeout(function(){ if (aborted) return aborted = true//IE9 may still call readystatechange xhr.abort("timeout") var e = new Error("XMLHttpRequest timeout") e.code = "ETIMEDOUT" errorFunc(e) }, options.timeout ) } if (xhr.setRequestHeader) { for(key in headers){ if(headers.hasOwnProperty(key)){ xhr.setRequestHeader(key, headers[key]) } } } else if (options.headers && !isEmpty(options.headers)) { throw new Error("Headers cannot be set on an XDomainRequest object") } if ("responseType" in options) { xhr.responseType = options.responseType } if ("beforeSend" in options && typeof options.beforeSend === "function" ) { options.beforeSend(xhr) } // Microsoft Edge browser sends "undefined" when send is called with undefined value. // XMLHttpRequest spec says to pass null as body to indicate no body // See https://github.com/naugtur/xhr/issues/100. xhr.send(body || null) return xhr } function getXml(xhr) { if (xhr.responseType === "document") { return xhr.responseXML } var firefoxBugTakenEffect = xhr.responseXML && xhr.responseXML.documentElement.nodeName === "parsererror" if (xhr.responseType === "" && !firefoxBugTakenEffect) { return xhr.responseXML } return null } function noop() {}
nickclar/spark-js-sdk
packages/node_modules/@ciscospark/http-core/src/lib/xhr.js
JavaScript
mit
7,464
import { Connection, Callback } from '../connection'; import { Query } from '../query'; import { Stream } from 'stream'; interface BatchRequestParams extends RequestParams { method: string; url: string; richInput?: string; } interface BatchRequestResult { statusCode: string; result: RequestResult; } interface BatchRequestResults { hasError: boolean; results: BatchRequestResult[]; } interface RequestParams { method: string; url: string; body?: string; } export class RequestResult { } export class Request<T> implements Promise<T> { constructor(chatter: Chatter, params: RequestParams); batchParams(): BatchRequestParams; promise(): Promise<T>; stream(): Stream; catch<TResult>(onrejected?: ((reason: any) => (PromiseLike<TResult> | TResult)) | null | undefined): Promise<T | TResult>; then<TResult1, TResult2>(onfulfilled?: ((value: T) => (PromiseLike<TResult1> | TResult1)) | null | undefined, onrejected?: ((reason: any) => (PromiseLike<TResult2> | TResult2)) | null | undefined): Promise<TResult1 | TResult2>; finally(onfinally?: () => void): Promise<T>; thenCall(callback?: (err: Error, records: T) => void): Query<T>; readonly [Symbol.toStringTag]: 'Promise'; } export class Resource<T> extends Request<T> { constructor(chatter: Chatter, url: string, queryParams?: object); create(data: object | string, callback?: Callback<T>): Request<T>; del(callback?: Callback<T>): Request<T>; delete(callback?: Callback<T>): Request<T>; retrieve(callback?: Callback<T>): Request<T>; update(data: object, callback?: Callback<T>): Request<T>; } export class Chatter { constructor(conn: Connection); batch(callback?: Callback<BatchRequestResults>): Promise<BatchRequestResults>; request(params: RequestParams, callback?: Callback<Request<RequestResult>>): Request<RequestResult>; resource(url: string, queryParams?: object): Resource<RequestResult> }
magny/DefinitelyTyped
types/jsforce/api/chatter.d.ts
TypeScript
mit
2,015
'use strict'; var test = require('tape') var Client = require('../../lib/dialects/sqlite3'); var Pool2 = require('pool2') test('#822, pool config, max: 0 should skip pool construction', function(t) { var client = new Client({connection: {filename: ':memory:'}, pool: {max: 0}}) t.equal(client.pool, undefined) client.destroy() t.end() }) test('#823, should not skip pool construction pool config is not defined', function(t) { var client = new Client({connection: {filename: ':memory:'}}) t.ok(client.pool instanceof Pool2) client.destroy() t.end() })
maxcnunes/knex
test/tape/pool.js
JavaScript
mit
583
/* * Optional (non-Sizzle) selector module for custom builds. * * Note that this DOES NOT SUPPORT many documented jQuery * features in exchange for its smaller size: * * Attribute not equal selector * Positional selectors (:first; :eq(n); :odd; etc.) * Type selectors (:input; :checkbox; :button; etc.) * State-based selectors (:animated; :visible; :hidden; etc.) * :has(selector) * :not(complex selector) * custom selectors via Sizzle extensions * Leading combinators (e.g., $collection.find("> *")) * Reliable functionality on XML fragments * Requiring all parts of a selector to match elements under context * (e.g., $div.find("div > *") now matches children of $div) * Matching against non-elements * Reliable sorting of disconnected nodes * querySelectorAll bug fixes (e.g., unreliable :focus on WebKit) * * If any of these are unacceptable tradeoffs, either use Sizzle or * customize this stub for the project's specific needs. */ var selector_hasDuplicate, matches = docElem.webkitMatchesSelector || docElem.mozMatchesSelector || docElem.oMatchesSelector || docElem.msMatchesSelector, selector_sortOrder = function( a, b ) { // Flag for duplicate removal if ( a === b ) { selector_hasDuplicate = true; return 0; } var compare = b.compareDocumentPosition && a.compareDocumentPosition && a.compareDocumentPosition( b ); if ( compare ) { // Disconnected nodes if ( compare & 1 ) { // Choose the first element that is related to our document if ( a === document || jQuery.contains(document, a) ) { return -1; } if ( b === document || jQuery.contains(document, b) ) { return 1; } // Maintain original order return 0; } return compare & 4 ? -1 : 1; } // Not directly comparable, sort on existence of method return a.compareDocumentPosition ? -1 : 1; }; jQuery.extend({ find: function( selector, context, results, seed ) { var elem, i = 0; results = results || []; context = context || document; if ( seed ) { while ( (elem = seed[i++]) ) { if ( jQuery.find.matchesSelector(elem, selector) ) { results.push( elem ); } } } else { jQuery.merge( results, context.querySelectorAll(selector) ); } return results; }, unique: function( results ) { var elem, duplicates = [], i = 0, j = 0; selector_hasDuplicate = false; results.sort( selector_sortOrder ); if ( selector_hasDuplicate ) { while ( (elem = results[i++]) ) { if ( elem === results[ i ] ) { j = duplicates.push( i ); } } while ( j-- ) { results.splice( duplicates[ j ], 1 ); } } return results; }, text: function( elem ) { var node, ret = "", i = 0, nodeType = elem.nodeType; if ( !nodeType ) { // If no nodeType, this is expected to be an array while ( (node = elem[i++]) ) { // Do not traverse comment nodes ret += jQuery.text( node ); } } else if ( nodeType === 1 || nodeType === 9 || nodeType === 11 ) { // Use textContent for elements return elem.textContent; } else if ( nodeType === 3 || nodeType === 4 ) { return elem.nodeValue; } // Do not include comment or processing instruction nodes return ret; }, contains: function( a, b ) { var adown = a.nodeType === 9 ? a.documentElement : a, bup = b && b.parentNode; return a === bup || !!( bup && bup.nodeType === 1 && adown.contains(bup) ); }, isXMLDoc: function( elem ) { return (elem.ownerDocument || elem).documentElement.nodeName !== "HTML"; }, expr: { attrHandle: {}, match: { boolean: /^(?:checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped)$/i, needsContext: /^[\x20\t\r\n\f]*[>+~]/ } } }); jQuery.extend( jQuery.find, { matches: function( expr, elements ) { return jQuery.find( expr, null, null, elements ); }, matchesSelector: function( elem, expr ) { return matches.call( elem, expr ); }, attr: function( elem, name ) { return elem.getAttribute( name ); } });
demetr84/Jquery
src/selector-native.js
JavaScript
mit
4,057
<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <[email protected]> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Validator\Tests\Mapping\Loader; use Symfony\Component\Validator\Constraints\All; use Symfony\Component\Validator\Constraints\Callback; use Symfony\Component\Validator\Constraints\Collection; use Symfony\Component\Validator\Constraints\NotNull; use Symfony\Component\Validator\Constraints\Range; use Symfony\Component\Validator\Constraints\Choice; use Symfony\Component\Validator\Mapping\ClassMetadata; use Symfony\Component\Validator\Mapping\Loader\YamlFileLoader; use Symfony\Component\Validator\Tests\Fixtures\ConstraintA; use Symfony\Component\Validator\Tests\Fixtures\ConstraintB; class YamlFileLoaderTest extends \PHPUnit_Framework_TestCase { public function testLoadClassMetadataReturnsFalseIfEmpty() { $loader = new YamlFileLoader(__DIR__.'/empty-mapping.yml'); $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); $this->assertFalse($loader->loadClassMetadata($metadata)); } /** * @expectedException \InvalidArgumentException */ public function testLoadClassMetadataThrowsExceptionIfNotAnArray() { $loader = new YamlFileLoader(__DIR__.'/nonvalid-mapping.yml'); $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); $loader->loadClassMetadata($metadata); } public function testLoadClassMetadataReturnsTrueIfSuccessful() { $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); $this->assertTrue($loader->loadClassMetadata($metadata)); } public function testLoadClassMetadataReturnsFalseIfNotSuccessful() { $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); $metadata = new ClassMetadata('\stdClass'); $this->assertFalse($loader->loadClassMetadata($metadata)); } public function testLoadClassMetadata() { $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); $loader->loadClassMetadata($metadata); $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\Entity'); $expected->setGroupSequence(array('Foo', 'Entity')); $expected->addConstraint(new ConstraintA()); $expected->addConstraint(new ConstraintB()); $expected->addConstraint(new Callback('validateMe')); $expected->addConstraint(new Callback('validateMeStatic')); $expected->addConstraint(new Callback(array('Symfony\Component\Validator\Tests\Fixtures\CallbackClass', 'callback'))); $expected->addPropertyConstraint('firstName', new NotNull()); $expected->addPropertyConstraint('firstName', new Range(array('min' => 3))); $expected->addPropertyConstraint('firstName', new Choice(array('A', 'B'))); $expected->addPropertyConstraint('firstName', new All(array(new NotNull(), new Range(array('min' => 3))))); $expected->addPropertyConstraint('firstName', new All(array('constraints' => array(new NotNull(), new Range(array('min' => 3)))))); $expected->addPropertyConstraint('firstName', new Collection(array('fields' => array( 'foo' => array(new NotNull(), new Range(array('min' => 3))), 'bar' => array(new Range(array('min' => 5))), )))); $expected->addPropertyConstraint('firstName', new Choice(array( 'message' => 'Must be one of %choices%', 'choices' => array('A', 'B'), ))); $expected->addGetterConstraint('lastName', new NotNull()); $this->assertEquals($expected, $metadata); } public function testLoadGroupSequenceProvider() { $loader = new YamlFileLoader(__DIR__.'/constraint-mapping.yml'); $metadata = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); $loader->loadClassMetadata($metadata); $expected = new ClassMetadata('Symfony\Component\Validator\Tests\Fixtures\GroupSequenceProviderEntity'); $expected->setGroupSequenceProvider(true); $this->assertEquals($expected, $metadata); } }
javieralfaya/tuitty
vendor/symfony/symfony/src/Symfony/Component/Validator/Tests/Mapping/Loader/YamlFileLoaderTest.php
PHP
mit
4,613
using System; using System.Collections.Generic; using Npgsql; using Xunit; using Xunit.Abstractions; using Xunit.Sdk; namespace Marten.Testing.Harness { /// <summary> /// Allows targeting test at specified minimum and/or maximum version of PG /// </summary> [AttributeUsage(AttributeTargets.Method)] [XunitTestCaseDiscoverer("Marten.Testing.Harness.PgVersionTargetedFactDiscoverer", "Marten.Testing")] public sealed class PgVersionTargetedFact: FactAttribute { public string MinimumVersion { get; set; } public string MaximumVersion { get; set; } } public sealed class PgVersionTargetedFactDiscoverer: FactDiscoverer { private static readonly Version Version; static PgVersionTargetedFactDiscoverer() { // PG version does not change during test run so we can do static ctor using (var c = new NpgsqlConnection(ConnectionSource.ConnectionString)) { c.Open(); Version = c.PostgreSqlVersion; c.Close(); } } public PgVersionTargetedFactDiscoverer(IMessageSink diagnosticMessageSink): base(diagnosticMessageSink) { } public override IEnumerable<IXunitTestCase> Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) { var minimumVersion = factAttribute.GetNamedArgument<string>(nameof(PgVersionTargetedFact.MinimumVersion)); var maximumVersion = factAttribute.GetNamedArgument<string>(nameof(PgVersionTargetedFact.MaximumVersion)); if (minimumVersion != null && Version.TryParse(minimumVersion, out var minVersion) && Version < minVersion) { yield return new TestCaseSkippedDueToVersion($"Minimum required PG version {minimumVersion} is higher than {Version}", DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod); } if (maximumVersion != null && Version.TryParse(maximumVersion, out var maxVersion) && Version > maxVersion) { yield return new TestCaseSkippedDueToVersion($"Maximum allowed PG version {maximumVersion} is higher than {Version}", DiagnosticMessageSink, discoveryOptions.MethodDisplayOrDefault(), discoveryOptions.MethodDisplayOptionsOrDefault(), testMethod); } yield return base.CreateTestCase(discoveryOptions, testMethod, factAttribute); } internal sealed class TestCaseSkippedDueToVersion: XunitTestCase { [Obsolete("Called by the de-serializer", true)] public TestCaseSkippedDueToVersion() { } public TestCaseSkippedDueToVersion(string skipReason, IMessageSink diagnosticMessageSink, TestMethodDisplay defaultMethodDisplay, TestMethodDisplayOptions defaultMethodDisplayOptions, ITestMethod testMethod, object[] testMethodArguments = null) : base(diagnosticMessageSink, defaultMethodDisplay, defaultMethodDisplayOptions, testMethod, testMethodArguments) { SkipReason = skipReason; } } } }
ericgreenmix/marten
src/Marten.Testing/Harness/PgVersionTargetedFact.cs
C#
mit
3,267
//function to change content function changecontent(){ if (index>=fcontent.length) index=0 if (DOM2){ document.getElementById("fscroller").style.color="rgb(255,255,255)" document.getElementById("fscroller").innerHTML=begintag+fcontent[index]+closetag if (document.getElementById("fscroller").style.display="none"){document.getElementById("fscroller").style.display="block"} colorfade() } else if (ie4) document.all.fscroller.innerHTML=begintag+fcontent[index]+closetag else if (ns4){ document.fscrollerns.document.fscrollerns_sub.document.write(begintag+fcontent[index]+closetag) document.fscrollerns.document.fscrollerns_sub.document.close() } index++ setTimeout("changecontent()",delay+faderdelay) } // colorfade() partially by Marcio Galli for Netscape Communications. //////////// function colorfade() { // 20 frames fading process maxcolor=0 step=parseInt((255-maxcolor)/20) if(frame>0) { hex-=step; // increase color value document.getElementById("fscroller").style.color="rgb("+hex+","+hex+","+hex+")"; // Set color value. frame--; setTimeout("colorfade()",20); } else{ document.getElementById("fscroller").style.color="rgb("+maxcolor+","+maxcolor+","+maxcolor+")"; frame=20; hex=255 } }
jorkin/asp-vbscript-cms
public/modules/mod_rss/fscroller.js
JavaScript
mit
1,262