|
package wei.mark.standout;
import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Bundle;
import android.os.IBinder;
import android.util.Log;
import android.view.*;
import android.view.View.OnClickListener;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.*;
import wei.mark.standout.constants.StandOutFlags;
import wei.mark.standout.ui.Window;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
/**
* Extend this class to easily create and manage floating StandOut windows.
*
* @author Mark Wei
*
* Contributors:
* Jason
*
*/
public abstract class StandOutWindow extends Service {
static final String TAG = "StandOutWindow";
/**
* StandOut window id: You may use this sample id for your first window.
*/
public static final int DEFAULT_ID = 0;
/**
* Special StandOut window id: You may NOT use this id for any windows.
*/
public static final int ONGOING_NOTIFICATION_ID = -1;
/**
* StandOut window id: You may use this id when you want it to be
* disregarded. The system makes no distinction for this id; it is only used
* to improve code readability.
*/
public static final int DISREGARD_ID = -2;
/**
* Intent action: Show a new window corresponding to the id.
*/
public static final String ACTION_SHOW = "SHOW";
/**
* Intent action: Restore a previously hidden window corresponding to the
* id. The window should be previously hidden with {@link #ACTION_HIDE}.
*/
public static final String ACTION_RESTORE = "RESTORE";
/**
* Intent action: Close an existing window with an existing id.
*/
public static final String ACTION_CLOSE = "CLOSE";
/**
* Intent action: Close all existing windows.
*/
public static final String ACTION_CLOSE_ALL = "CLOSE_ALL";
/**
* Intent action: Send data to a new or existing window.
*/
public static final String ACTION_SEND_DATA = "SEND_DATA";
/**
* Intent action: Hide an existing window with an existing id. To enable the
* ability to restore this window, make sure you implement
* {@link #getHiddenNotification(int)}.
*/
public static final String ACTION_HIDE = "HIDE";
/**
* Show a new window corresponding to the id, or restore a previously hidden
* window.
*
* @param context
* A Context of the application package implementing this class.
* @param cls
* The Service extending {@link StandOutWindow} that will be used
* to create and manage the window.
* @param id
* The id representing this window. If the id exists, and the
* corresponding window was previously hidden, then that window
* will be restored.
*
* @see #show(int)
*/
public static void show(Context context,
Class extends StandOutWindow> cls, int id) {
context.startService(getShowIntent(context, cls, id));
}
/**
* Hide the existing window corresponding to the id. To enable the ability
* to restore this window, make sure you implement
* {@link #getHiddenNotification(int)}.
*
* @param context
* A Context of the application package implementing this class.
* @param cls
* The Service extending {@link StandOutWindow} that is managing
* the window.
* @param id
* The id representing this window. The window must previously be
* shown.
* @see #hide(int)
*/
public static void hide(Context context,
Class extends StandOutWindow> cls, int id) {
context.startService(getShowIntent(context, cls, id));
}
/**
* Close an existing window with an existing id.
*
* @param context
* A Context of the application package implementing this class.
* @param cls
* The Service extending {@link StandOutWindow} that is managing
* the window.
* @param id
* The id representing this window. The window must previously be
* shown.
* @see #close(int)
*/
public static void close(Context context,
Class extends StandOutWindow> cls, int id) {
context.startService(getCloseIntent(context, cls, id));
}
/**
* Close all existing windows.
*
* @param context
* A Context of the application package implementing this class.
* @param cls
* The Service extending {@link StandOutWindow} that is managing
* the window.
* @see #closeAll()
*/
public static void closeAll(Context context,
Class extends StandOutWindow> cls) {
context.startService(getCloseAllIntent(context, cls));
}
/**
* This allows windows of different applications to communicate with each
* other.
*
*
* Send {@link Parceleable} data in a {@link Bundle} to a new or existing
* windows. The implementation of the recipient window can handle what to do
* with the data. To receive a result, provide the class and id of the
* sender.
*
* @param context
* A Context of the application package implementing the class of
* the sending window.
* @param toCls
* The Service's class extending {@link StandOutWindow} that is
* managing the receiving window.
* @param toId
* The id of the receiving window, or DISREGARD_ID.
* @param requestCode
* Provide a request code to declare what kind of data is being
* sent.
* @param data
* A bundle of parceleable data to be sent to the receiving
* window.
* @param fromCls
* Provide the class of the sending window if you want a result.
* @param fromId
* Provide the id of the sending window if you want a result.
* @see #sendData(int, Class, int, int, Bundle)
*/
public static void sendData(Context context,
Class extends StandOutWindow> toCls, int toId, int requestCode,
Bundle data, Class extends StandOutWindow> fromCls, int fromId) {
context.startService(getSendDataIntent(context, toCls, toId,
requestCode, data, fromCls, fromId));
}
/**
* See {@link #show(Context, Class, int)}.
*
* @param context
* A Context of the application package implementing this class.
* @param cls
* The Service extending {@link StandOutWindow} that will be used
* to create and manage the window.
* @param id
* The id representing this window. If the id exists, and the
* corresponding window was previously hidden, then that window
* will be restored.
* @return An {@link Intent} to use with
* {@link Context#startService(Intent)}.
*/
public static Intent getShowIntent(Context context,
Class extends StandOutWindow> cls, int id) {
boolean cached = sWindowCache.isCached(id, cls);
String action = cached ? ACTION_RESTORE : ACTION_SHOW;
Uri uri = cached ? Uri.parse("standout://" + cls + '/' + id) : null;
return new Intent(context, cls).putExtra("id", id).setAction(action)
.setData(uri);
}
/**
* See {@link #hide(Context, Class, int)}.
*
* @param context
* A Context of the application package implementing this class.
* @param cls
* The Service extending {@link StandOutWindow} that is managing
* the window.
* @param id
* The id representing this window. If the id exists, and the
* corresponding window was previously hidden, then that window
* will be restored.
* @return An {@link Intent} to use with
* {@link Context#startService(Intent)}.
*/
public static Intent getHideIntent(Context context,
Class extends StandOutWindow> cls, int id) {
return new Intent(context, cls).putExtra("id", id).setAction(
ACTION_HIDE);
}
/**
* See {@link #close(Context, Class, int)}.
*
* @param context
* A Context of the application package implementing this class.
* @param cls
* The Service extending {@link StandOutWindow} that is managing
* the window.
* @param id
* The id representing this window. If the id exists, and the
* corresponding window was previously hidden, then that window
* will be restored.
* @return An {@link Intent} to use with
* {@link Context#startService(Intent)}.
*/
public static Intent getCloseIntent(Context context,
Class extends StandOutWindow> cls, int id) {
return new Intent(context, cls).putExtra("id", id).setAction(
ACTION_CLOSE);
}
/**
* See {@link #closeAll(Context, Class, int)}.
*
* @param context
* A Context of the application package implementing this class.
* @param cls
* The Service extending {@link StandOutWindow} that is managing
* the window.
* @return An {@link Intent} to use with
* {@link Context#startService(Intent)}.
*/
public static Intent getCloseAllIntent(Context context,
Class extends StandOutWindow> cls) {
return new Intent(context, cls).setAction(ACTION_CLOSE_ALL);
}
/**
* See {@link #sendData(Context, Class, int, int, Bundle, Class, int)}.
*
* @param context
* A Context of the application package implementing the class of
* the sending window.
* @param toCls
* The Service's class extending {@link StandOutWindow} that is
* managing the receiving window.
* @param toId
* The id of the receiving window.
* @param requestCode
* Provide a request code to declare what kind of data is being
* sent.
* @param data
* A bundle of parceleable data to be sent to the receiving
* window.
* @param fromCls
* If the sending window wants a result, provide the class of the
* sending window.
* @param fromId
* If the sending window wants a result, provide the id of the
* sending window.
* @return An {@link Intnet} to use with
* {@link Context#startService(Intent)}.
*/
public static Intent getSendDataIntent(Context context,
Class extends StandOutWindow> toCls, int toId, int requestCode,
Bundle data, Class extends StandOutWindow> fromCls, int fromId) {
return new Intent(context, toCls).putExtra("id", toId)
.putExtra("requestCode", requestCode)
.putExtra("wei.mark.standout.data", data)
.putExtra("wei.mark.standout.fromCls", fromCls)
.putExtra("fromId", fromId).setAction(ACTION_SEND_DATA);
}
// internal map of ids to shown/hidden views
static WindowCache sWindowCache;
static Window sFocusedWindow;
// static constructors
static {
sWindowCache = new WindowCache();
sFocusedWindow = null;
}
// internal system services
WindowManager mWindowManager;
private NotificationManager mNotificationManager;
LayoutInflater mLayoutInflater;
// internal state variables
private boolean startedForeground;
@Override
public IBinder onBind(Intent intent) {
return null;
}
@Override
public void onCreate() {
super.onCreate();
mWindowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
mLayoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
startedForeground = false;
}
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
super.onStartCommand(intent, flags, startId);
// intent should be created with
// getShowIntent(), getHideIntent(), getCloseIntent()
if (intent != null) {
String action = intent.getAction();
int id = intent.getIntExtra("id", DEFAULT_ID);
// this will interfere with getPersistentNotification()
if (id == ONGOING_NOTIFICATION_ID) {
throw new RuntimeException(
"ID cannot equals StandOutWindow.ONGOING_NOTIFICATION_ID");
}
if (ACTION_SHOW.equals(action) || ACTION_RESTORE.equals(action)) {
show(id);
} else if (ACTION_HIDE.equals(action)) {
hide(id);
} else if (ACTION_CLOSE.equals(action)) {
close(id);
} else if (ACTION_CLOSE_ALL.equals(action)) {
closeAll();
} else if (ACTION_SEND_DATA.equals(action)) {
if (isExistingId(id) || id == DISREGARD_ID) {
Bundle data = intent
.getBundleExtra("wei.mark.standout.data");
int requestCode = intent.getIntExtra("requestCode", 0);
@SuppressWarnings("unchecked")
Class extends StandOutWindow> fromCls = (Class extends StandOutWindow>) intent
.getSerializableExtra("wei.mark.standout.fromCls");
int fromId = intent.getIntExtra("fromId", DEFAULT_ID);
onReceiveData(id, requestCode, data, fromCls, fromId);
} else {
Log.w(TAG,
"Failed to send data to non-existant window. Make sure toId is either an existing window's id, or is DISREGARD_ID.");
}
}
} else {
Log.w(TAG, "Tried to onStartCommand() with a null intent.");
}
// the service is started in foreground in show()
// so we don't expect Android to kill this service
return START_NOT_STICKY;
}
@Override
public void onDestroy() {
super.onDestroy();
// closes all windows
closeAll();
}
/**
* Return the name of every window in this implementation. The name will
* appear in the default implementations of the system window decoration
* title and notification titles.
*
* @return The name.
*/
public abstract String getAppName();
/**
* Return the icon resource for every window in this implementation. The
* icon will appear in the default implementations of the system window
* decoration and notifications.
*
* @return The icon.
*/
public abstract int getAppIcon();
/**
* Create a new {@link View} corresponding to the id, and add it as a child
* to the frame. The view will become the contents of this StandOut window.
* The view MUST be newly created, and you MUST attach it to the frame.
*
*
* If you are inflating your view from XML, make sure you use
* {@link LayoutInflater#inflate(int, ViewGroup, boolean)} to attach your
* view to frame. Set the ViewGroup to be frame, and the boolean to true.
*
*
* If you are creating your view programmatically, make sure you use
* {@link FrameLayout#addView(View)} to add your view to the frame.
*
* @param id
* The id representing the window.
* @param frame
* The {@link FrameLayout} to attach your view as a child to.
*/
public abstract void createAndAttachView(int id, FrameLayout frame);
/**
* Return the {@link StandOutWindow#LayoutParams} for the corresponding id.
* The system will set the layout params on the view for this StandOut
* window. The layout params may be reused.
*
*
* @param id
* The id of the window.
* @param window
* The window corresponding to the id. Given as courtesy, so you
* may get the existing layout params.
* @return The {@link StandOutWindow#LayoutParams} corresponding to the id.
* The layout params will be set on the window. The layout params
* returned will be reused whenever possible, minimizing the number
* of times getParams() will be called.
*/
public abstract StandOutLayoutParams getParams(int id, Window window);
/**
* Implement this method to change modify the behavior and appearance of the
* window corresponding to the id.
*
*
* You may use any of the flags defined in {@link StandOutFlags}. This
* method will be called many times, so keep it fast.
*
*
* Use bitwise OR (|) to set flags, and bitwise XOR (^) to unset flags. To
* test if a flag is set, use {@link Utils#isSet(int, int)}.
*
* @param id
* The id of the window.
* @return A combination of flags.
*/
public int getFlags(int id) {
return 0;
}
/**
* Implement this method to set a custom title for the window corresponding
* to the id.
*
* @param id
* The id of the window.
* @return The title of the window.
*/
public String getTitle(int id) {
return getAppName();
}
/**
* Implement this method to set a custom icon for the window corresponding
* to the id.
*
* @param id
* The id of the window.
* @return The icon of the window.
*/
public int getIcon(int id) {
return getAppIcon();
}
/**
* Return the title for the persistent notification. This is called every
* time {@link #show(int)} is called.
*
* @param id
* The id of the window shown.
* @return The title for the persistent notification.
*/
public String getPersistentNotificationTitle(int id) {
return getAppName() + " Running";
}
/**
* Return the message for the persistent notification. This is called every
* time {@link #show(int)} is called.
*
* @param id
* The id of the window shown.
* @return The message for the persistent notification.
*/
public String getPersistentNotificationMessage(int id) {
return "";
}
/**
* Return the intent for the persistent notification. This is called every
* time {@link #show(int)} is called.
*
*
* The returned intent will be packaged into a {@link PendingIntent} to be
* invoked when the user clicks the notification.
*
* @param id
* The id of the window shown.
* @return The intent for the persistent notification.
*/
public Intent getPersistentNotificationIntent(int id) {
return null;
}
/**
* Return the icon resource for every hidden window in this implementation.
* The icon will appear in the default implementations of the hidden
* notifications.
*
* @return The icon.
*/
public int getHiddenIcon() {
return getAppIcon();
}
/**
* Return the title for the hidden notification corresponding to the window
* being hidden.
*
* @param id
* The id of the hidden window.
* @return The title for the hidden notification.
*/
public String getHiddenNotificationTitle(int id) {
return getAppName() + " Hidden";
}
/**
* Return the message for the hidden notification corresponding to the
* window being hidden.
*
* @param id
* The id of the hidden window.
* @return The message for the hidden notification.
*/
public String getHiddenNotificationMessage(int id) {
return "";
}
/**
* Return the intent for the hidden notification corresponding to the window
* being hidden.
*
*
* The returned intent will be packaged into a {@link PendingIntent} to be
* invoked when the user clicks the notification.
*
* @param id
* The id of the hidden window.
* @return The intent for the hidden notification.
*/
public Intent getHiddenNotificationIntent(int id) {
return null;
}
/**
* Return a persistent {@link Notification} for the corresponding id. You
* must return a notification for AT LEAST the first id to be requested.
* Once the persistent notification is shown, further calls to
* {@link #getPersistentNotification(int)} may return null. This way Android
* can start the StandOut window service in the foreground and will not kill
* the service on low memory.
*
*
* As a courtesy, the system will request a notification for every new id
* shown. Your implementation is encouraged to include the
* {@link PendingIntent#FLAG_UPDATE_CURRENT} flag in the notification so
* that there is only one system-wide persistent notification.
*
*
* See the StandOutExample project for an implementation of
* {@link #getPersistentNotification(int)} that keeps one system-wide
* persistent notification that creates a new window on every click.
*
* @param id
* The id of the window.
* @return The {@link Notification} corresponding to the id, or null if
* you've previously returned a notification.
*/
public Notification getPersistentNotification(int id) {
// basic notification stuff
// http://developer.android.com/guide/topics/ui/notifiers/notifications.html
int icon = getAppIcon();
long when = System.currentTimeMillis();
Context c = getApplicationContext();
String contentTitle = getPersistentNotificationTitle(id);
String contentText = getPersistentNotificationMessage(id);
String tickerText = String.format("%s: %s", contentTitle, contentText);
// getPersistentNotification() is called for every new window
// so we replace the old notification with a new one that has
// a bigger id
Intent notificationIntent = getPersistentNotificationIntent(id);
PendingIntent contentIntent = null;
if (notificationIntent != null) {
contentIntent = PendingIntent.getService(this, 0,
notificationIntent,
// flag updates existing persistent notification
PendingIntent.FLAG_UPDATE_CURRENT);
}
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(c, contentTitle, contentText,
contentIntent);
return notification;
}
/**
* Return a hidden {@link Notification} for the corresponding id. The system
* will request a notification for every id that is hidden.
*
*
* If null is returned, StandOut will assume you do not wish to support
* hiding this window, and will {@link #close(int)} it for you.
*
*
* See the StandOutExample project for an implementation of
* {@link #getHiddenNotification(int)} that for every hidden window keeps a
* notification which restores that window upon user's click.
*
* @param id
* The id of the window.
* @return The {@link Notification} corresponding to the id or null.
*/
public Notification getHiddenNotification(int id) {
// same basics as getPersistentNotification()
int icon = getHiddenIcon();
long when = System.currentTimeMillis();
Context c = getApplicationContext();
String contentTitle = getHiddenNotificationTitle(id);
String contentText = getHiddenNotificationMessage(id);
String tickerText = String.format("%s: %s", contentTitle, contentText);
// the difference here is we are providing the same id
Intent notificationIntent = getHiddenNotificationIntent(id);
PendingIntent contentIntent = null;
if (notificationIntent != null) {
contentIntent = PendingIntent.getService(this, 0,
notificationIntent,
// flag updates existing persistent notification
PendingIntent.FLAG_UPDATE_CURRENT);
}
Notification notification = new Notification(icon, tickerText, when);
notification.setLatestEventInfo(c, contentTitle, contentText,
contentIntent);
return notification;
}
/**
* Return the animation to play when the window corresponding to the id is
* shown.
*
* @param id
* The id of the window.
* @return The animation to play or null.
*/
public Animation getShowAnimation(int id) {
return AnimationUtils.loadAnimation(this, android.R.anim.fade_in);
}
/**
* Return the animation to play when the window corresponding to the id is
* hidden.
*
* @param id
* The id of the window.
* @return The animation to play or null.
*/
public Animation getHideAnimation(int id) {
return AnimationUtils.loadAnimation(this, android.R.anim.fade_out);
}
/**
* Return the animation to play when the window corresponding to the id is
* closed.
*
* @param id
* The id of the window.
* @return The animation to play or null.
*/
public Animation getCloseAnimation(int id) {
return AnimationUtils.loadAnimation(this, android.R.anim.fade_out);
}
/**
* Implement this method to set a custom theme for all windows in this
* implementation.
*
* @return The theme to set on the window, or 0 for device default.
*/
public int getThemeStyle() {
return 0;
}
/**
* You probably want to leave this method alone and implement
* {@link #getDropDownItems(int)} instead. Only implement this method if you
* want more control over the drop down menu.
*
*
* Implement this method to set a custom drop down menu when the user clicks
* on the icon of the window corresponding to the id. The icon is only shown
* when {@link StandOutFlags#FLAG_DECORATION_SYSTEM} is set.
*
* @param id
* The id of the window.
* @return The drop down menu to be anchored to the icon, or null to have no
* dropdown menu.
*/
public PopupWindow getDropDown(final int id) {
final List items;
List dropDownListItems = getDropDownItems(id);
if (dropDownListItems != null) {
items = dropDownListItems;
} else {
items = new ArrayList();
}
// add default drop down items
items.add(new DropDownListItem(
android.R.drawable.ic_menu_close_clear_cancel, "Quit "
+ getAppName(), new Runnable() {
@Override
public void run() {
closeAll();
}
}));
// turn item list into views in PopupWindow
LinearLayout list = new LinearLayout(this);
list.setOrientation(LinearLayout.VERTICAL);
ScrollView scroller = new ScrollView(this);
scroller.addView(list);
final PopupWindow dropDown = new PopupWindow(scroller,
StandOutLayoutParams.WRAP_CONTENT,
StandOutLayoutParams.WRAP_CONTENT, true);
for (final DropDownListItem item : items) {
ViewGroup listItem = (ViewGroup) mLayoutInflater.inflate(
R.layout.drop_down_list_item, null);
list.addView(listItem);
ImageView icon = (ImageView) listItem.findViewById(R.id.icon);
icon.setImageResource(item.icon);
TextView description = (TextView) listItem
.findViewById(R.id.description);
description.setText(item.description);
listItem.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
item.action.run();
dropDown.dismiss();
}
});
}
Drawable background = getResources().getDrawable(
android.R.drawable.editbox_dropdown_dark_frame);
dropDown.setBackgroundDrawable(background);
return dropDown;
}
/**
* Implement this method to populate the drop down menu when the user clicks
* on the icon of the window corresponding to the id. The icon is only shown
* when {@link StandOutFlags#FLAG_DECORATION_SYSTEM} is set.
*
* @param id
* The id of the window.
* @return The list of items to show in the drop down menu, or null or empty
* to have no dropdown menu.
*/
public List getDropDownItems(int id) {
return null;
}
/**
* Implement this method to be alerted to touch events in the body of the
* window corresponding to the id.
*
*
* Note that even if you set {@link #FLAG_DECORATION_SYSTEM}, you will not
* receive touch events from the system window decorations.
*
* @see {@link View.OnTouchListener#onTouch(View, MotionEvent)}
* @param id
* The id of the view, provided as a courtesy.
* @param window
* The window corresponding to the id, provided as a courtesy.
* @param view
* The view where the event originated from.
* @param event
* See linked method.
*/
public boolean onTouchBody(int id, Window window, View view,
MotionEvent event) {
return false;
}
/**
* Implement this method to be alerted to when the window corresponding to
* the id is moved.
*
* @param id
* The id of the view, provided as a courtesy.
* @param window
* The window corresponding to the id, provided as a courtesy.
* @param view
* The view where the event originated from.
* @param event
* See linked method.
* @see {@link #onTouchHandleMove(int, Window, View, MotionEvent)}
*/
public void onMove(int id, Window window, View view, MotionEvent event) {
}
/**
* Implement this method to be alerted to when the window corresponding to
* the id is resized.
*
* @param id
* The id of the view, provided as a courtesy.
* @param window
* The window corresponding to the id, provided as a courtesy.
* @param view
* The view where the event originated from.
* @param event
* See linked method.
* @see {@link #onTouchHandleResize(int, Window, View, MotionEvent)}
*/
public void onResize(int id, Window window, View view, MotionEvent event) {
}
/**
* Implement this callback to be alerted when a window corresponding to the
* id is about to be shown. This callback will occur before the view is
* added to the window manager.
*
* @param id
* The id of the view, provided as a courtesy.
* @param view
* The view about to be shown.
* @return Return true to cancel the view from being shown, or false to
* continue.
* @see #show(int)
*/
public boolean onShow(int id, Window window) {
return false;
}
/**
* Implement this callback to be alerted when a window corresponding to the
* id is about to be hidden. This callback will occur before the view is
* removed from the window manager and {@link #getHiddenNotification(int)}
* is called.
*
* @param id
* The id of the view, provided as a courtesy.
* @param view
* The view about to be hidden.
* @return Return true to cancel the view from being hidden, or false to
* continue.
* @see #hide(int)
*/
public boolean onHide(int id, Window window) {
return false;
}
/**
* Implement this callback to be alerted when a window corresponding to the
* id is about to be closed. This callback will occur before the view is
* removed from the window manager.
*
* @param id
* The id of the view, provided as a courtesy.
* @param view
* The view about to be closed.
* @return Return true to cancel the view from being closed, or false to
* continue.
* @see #close(int)
*/
public boolean onClose(int id, Window window) {
return false;
}
/**
* Implement this callback to be alerted when all windows are about to be
* closed. This callback will occur before any views are removed from the
* window manager.
*
* @return Return true to cancel the views from being closed, or false to
* continue.
* @see #closeAll()
*/
public boolean onCloseAll() {
return false;
}
/**
* Implement this callback to be alerted when a window corresponding to the
* id has received some data. The sender is described by fromCls and fromId
* if the sender wants a result. To send a result, use
* {@link #sendData(int, Class, int, int, Bundle)}.
*
* @param id
* The id of your receiving window.
* @param requestCode
* The sending window provided this request code to declare what
* kind of data is being sent.
* @param data
* A bundle of parceleable data that was sent to your receiving
* window.
* @param fromCls
* The sending window's class. Provided if the sender wants a
* result.
* @param fromId
* The sending window's id. Provided if the sender wants a
* result.
*/
public void onReceiveData(int id, int requestCode, Bundle data,
Class extends StandOutWindow> fromCls, int fromId) {
}
/**
* Implement this callback to be alerted when a window corresponding to the
* id is about to be updated in the layout. This callback will occur before
* the view is updated by the window manager.
*
* @param id
* The id of the window, provided as a courtesy.
* @param view
* The window about to be updated.
* @param params
* The updated layout params.
* @return Return true to cancel the window from being updated, or false to
* continue.
* @see #updateViewLayout(int, Window, StandOutLayoutParams)
*/
public boolean onUpdate(int id, Window window, StandOutLayoutParams params) {
return false;
}
/**
* Implement this callback to be alerted when a window corresponding to the
* id is about to be bought to the front. This callback will occur before
* the window is brought to the front by the window manager.
*
* @param id
* The id of the window, provided as a courtesy.
* @param view
* The window about to be brought to the front.
* @return Return true to cancel the window from being brought to the front,
* or false to continue.
* @see #bringToFront(int)
*/
public boolean onBringToFront(int id, Window window) {
return false;
}
/**
* Implement this callback to be alerted when a window corresponding to the
* id is about to have its focus changed. This callback will occur before
* the window's focus is changed.
*
* @param id
* The id of the window, provided as a courtesy.
* @param view
* The window about to be brought to the front.
* @param focus
* Whether the window is gaining or losing focus.
* @return Return true to cancel the window's focus from being changed, or
* false to continue.
* @see #focus(int)
*/
public boolean onFocusChange(int id, Window window, boolean focus) {
return false;
}
/**
* Implement this callback to be alerted when a window corresponding to the
* id receives a key event. This callback will occur before the window
* handles the event with {@link Window#dispatchKeyEvent(KeyEvent)}.
*
* @param id
* The id of the window, provided as a courtesy.
* @param view
* The window about to receive the key event.
* @param event
* The key event.
* @return Return true to cancel the window from handling the key event, or
* false to let the window handle the key event.
* @see {@link Window#dispatchKeyEvent(KeyEvent)}
*/
public boolean onKeyEvent(int id, Window window, KeyEvent event) {
return false;
}
/**
* Show or restore a window corresponding to the id. Return the window that
* was shown/restored.
*
* @param id
* The id of the window.
* @return The window shown.
*/
public final synchronized Window show(int id) {
// get the window corresponding to the id
Window cachedWindow = getWindow(id);
final Window window;
// check cache first
if (cachedWindow != null) {
window = cachedWindow;
} else {
window = new Window(this, id);
}
if (window.visibility == Window.VISIBILITY_VISIBLE) {
throw new IllegalStateException("Tried to show(" + id
+ ") a window that is already shown.");
}
// alert callbacks and cancel if instructed
if (onShow(id, window)) {
Log.d(TAG, "Window " + id + " show cancelled by implementation.");
return null;
}
window.visibility = Window.VISIBILITY_VISIBLE;
// get animation
Animation animation = getShowAnimation(id);
// get the params corresponding to the id
StandOutLayoutParams params = window.getLayoutParams();
try {
// add the view to the window manager
mWindowManager.addView(window, params);
// animate
if (animation != null) {
window.getChildAt(0).startAnimation(animation);
}
} catch (Exception ex) {
ex.printStackTrace();
}
// add view to internal map
sWindowCache.putCache(id, getClass(), window);
// get the persistent notification
Notification notification = getPersistentNotification(id);
// show the notification
if (notification != null) {
notification.flags = notification.flags
| Notification.FLAG_NO_CLEAR;
// only show notification if not shown before
if (!startedForeground) {
// tell Android system to show notification
startForeground(
getClass().hashCode() + ONGOING_NOTIFICATION_ID,
notification);
startedForeground = true;
} else {
// update notification if shown before
mNotificationManager.notify(getClass().hashCode()
+ ONGOING_NOTIFICATION_ID, notification);
}
} else {
// notification can only be null if it was provided before
if (!startedForeground) {
throw new RuntimeException("Your StandOutWindow service must"
+ "provide a persistent notification."
+ "The notification prevents Android"
+ "from killing your service in low"
+ "memory situations.");
}
}
focus(id);
return window;
}
/**
* Hide a window corresponding to the id. Show a notification for the hidden
* window.
*
* @param id
* The id of the window.
*/
public final synchronized void hide(int id) {
// get the view corresponding to the id
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to hide(" + id
+ ") a null window.");
}
if (window.visibility == Window.VISIBILITY_GONE) {
throw new IllegalStateException("Tried to hide(" + id
+ ") a window that is not shown.");
}
// alert callbacks and cancel if instructed
if (onHide(id, window)) {
Log.w(TAG, "Window " + id + " hide cancelled by implementation.");
return;
}
// check if hide enabled
if (Utils.isSet(window.flags, StandOutFlags.FLAG_WINDOW_HIDE_ENABLE)) {
window.visibility = Window.VISIBILITY_TRANSITION;
// get the hidden notification for this view
Notification notification = getHiddenNotification(id);
// get animation
Animation animation = getHideAnimation(id);
try {
// animate
if (animation != null) {
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// remove the window from the window manager
mWindowManager.removeView(window);
window.visibility = Window.VISIBILITY_GONE;
}
});
window.getChildAt(0).startAnimation(animation);
} else {
// remove the window from the window manager
mWindowManager.removeView(window);
}
} catch (Exception ex) {
ex.printStackTrace();
}
// display the notification
notification.flags = notification.flags
| Notification.FLAG_NO_CLEAR
| Notification.FLAG_AUTO_CANCEL;
mNotificationManager.notify(getClass().hashCode() + id,
notification);
} else {
// if hide not enabled, close window
close(id);
}
}
/**
* Close a window corresponding to the id.
*
* @param id
* The id of the window.
*/
public final synchronized void close(final int id) {
// get the view corresponding to the id
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to close(" + id
+ ") a null window.");
}
if (window.visibility == Window.VISIBILITY_TRANSITION) {
return;
}
// alert callbacks and cancel if instructed
if (onClose(id, window)) {
Log.w(TAG, "Window " + id + " close cancelled by implementation.");
return;
}
// remove hidden notification
mNotificationManager.cancel(getClass().hashCode() + id);
unfocus(window);
window.visibility = Window.VISIBILITY_TRANSITION;
// get animation
Animation animation = getCloseAnimation(id);
// remove window
try {
// animate
if (animation != null) {
animation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// remove the window from the window manager
mWindowManager.removeView(window);
window.visibility = Window.VISIBILITY_GONE;
// remove view from internal map
sWindowCache.removeCache(id,
StandOutWindow.this.getClass());
// if we just released the last window, quit
if (getExistingIds().size() == 0) {
// tell Android to remove the persistent
// notification
// the Service will be shutdown by the system on low
// memory
startedForeground = false;
stopForeground(true);
}
}
});
window.getChildAt(0).startAnimation(animation);
} else {
// remove the window from the window manager
mWindowManager.removeView(window);
// remove view from internal map
sWindowCache.removeCache(id, getClass());
// if we just released the last window, quit
if (sWindowCache.getCacheSize(getClass()) == 0) {
// tell Android to remove the persistent notification
// the Service will be shutdown by the system on low memory
startedForeground = false;
stopForeground(true);
}
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
/**
* Close all existing windows.
*/
public final synchronized void closeAll() {
// alert callbacks and cancel if instructed
if (onCloseAll()) {
Log.w(TAG, "Windows close all cancelled by implementation.");
return;
}
// add ids to temporary set to avoid concurrent modification
LinkedList ids = new LinkedList();
for (int id : getExistingIds()) {
ids.add(id);
}
// close each window
for (int id : ids) {
close(id);
}
}
/**
* Send {@link Parceleable} data in a {@link Bundle} to a new or existing
* windows. The implementation of the recipient window can handle what to do
* with the data. To receive a result, provide the id of the sender.
*
* @param fromId
* Provide the id of the sending window if you want a result.
* @param toCls
* The Service's class extending {@link StandOutWindow} that is
* managing the receiving window.
* @param toId
* The id of the receiving window.
* @param requestCode
* Provide a request code to declare what kind of data is being
* sent.
* @param data
* A bundle of parceleable data to be sent to the receiving
* window.
*/
public final void sendData(int fromId,
Class extends StandOutWindow> toCls, int toId, int requestCode,
Bundle data) {
StandOutWindow.sendData(this, toCls, toId, requestCode, data,
getClass(), fromId);
}
/**
* Bring the window corresponding to this id in front of all other windows.
* The window may flicker as it is removed and restored by the system.
*
* @param id
* The id of the window to bring to the front.
*/
public final synchronized void bringToFront(int id) {
Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to bringToFront(" + id
+ ") a null window.");
}
if (window.visibility == Window.VISIBILITY_GONE) {
throw new IllegalStateException("Tried to bringToFront(" + id
+ ") a window that is not shown.");
}
if (window.visibility == Window.VISIBILITY_TRANSITION) {
return;
}
// alert callbacks and cancel if instructed
if (onBringToFront(id, window)) {
Log.w(TAG, "Window " + id
+ " bring to front cancelled by implementation.");
return;
}
StandOutLayoutParams params = window.getLayoutParams();
// remove from window manager then add back
try {
mWindowManager.removeView(window);
} catch (Exception ex) {
ex.printStackTrace();
}
try {
mWindowManager.addView(window, params);
} catch (Exception ex) {
ex.printStackTrace();
}
}
/**
* Request focus for the window corresponding to this id. A maximum of one
* window can have focus, and that window will receive all key events,
* including Back and Menu.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean focus(int id) {
// check if that window is focusable
final Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to focus(" + id
+ ") a null window.");
}
if (!Utils.isSet(window.flags,
StandOutFlags.FLAG_WINDOW_FOCUSABLE_DISABLE)) {
// remove focus from previously focused window
if (sFocusedWindow != null) {
unfocus(sFocusedWindow);
}
return window.onFocus(true);
}
return false;
}
/**
* Remove focus for the window corresponding to this id. Once a window is
* unfocused, it will stop receiving key events.
*
* @param id
* The id of the window.
* @return True if focus changed successfully, false if it failed.
*/
public final synchronized boolean unfocus(int id) {
Window window = getWindow(id);
return unfocus(window);
}
/**
* Courtesy method for your implementation to use if you want to. Gets a
* unique id to assign to a new window.
*
* @return The unique id.
*/
public final int getUniqueId() {
int unique = DEFAULT_ID;
for (int id : getExistingIds()) {
unique = Math.max(unique, id + 1);
}
return unique;
}
/**
* Return whether the window corresponding to the id exists. This is useful
* for testing if the id is being restored (return true) or shown for the
* first time (return false).
*
* @param id
* The id of the window.
* @return True if the window corresponding to the id is either shown or
* hidden, or false if it has never been shown or was previously
* closed.
*/
public final boolean isExistingId(int id) {
return sWindowCache.isCached(id, getClass());
}
/**
* Return the ids of all shown or hidden windows.
*
* @return A set of ids, or an empty set.
*/
public final Set getExistingIds() {
return sWindowCache.getCacheIds(getClass());
}
/**
* Return the window corresponding to the id, if it exists in cache. The
* window will not be created with
* {@link #createAndAttachView(int, ViewGroup)}. This means the returned
* value will be null if the window is not shown or hidden.
*
* @param id
* The id of the window.
* @return The window if it is shown/hidden, or null if it is closed.
*/
public final Window getWindow(int id) {
return sWindowCache.getCache(id, getClass());
}
/**
* Return the window that currently has focus.
*
* @return The window that has focus.
*/
public final Window getFocusedWindow() {
return sFocusedWindow;
}
/**
* Sets the window that currently has focus.
*/
public final void setFocusedWindow(Window window) {
sFocusedWindow = window;
}
/**
* Change the title of the window, if such a title exists. A title exists if
* {@link StandOutFlags#FLAG_DECORATION_SYSTEM} is set, or if your own view
* contains a TextView with id R.id.title.
*
* @param id
* The id of the window.
* @param text
* The new title.
*/
public final void setTitle(int id, String text) {
Window window = getWindow(id);
if (window != null) {
View title = window.findViewById(R.id.title);
if (title instanceof TextView) {
((TextView) title).setText(text);
}
}
}
/**
* Change the icon of the window, if such a icon exists. A icon exists if
* {@link StandOutFlags#FLAG_DECORATION_SYSTEM} is set, or if your own view
* contains a TextView with id R.id.window_icon.
*
* @param id
* The id of the window.
* @param drawableRes
* The new icon.
*/
public final void setIcon(int id, int drawableRes) {
Window window = getWindow(id);
if (window != null) {
View icon = window.findViewById(R.id.window_icon);
if (icon instanceof ImageView) {
((ImageView) icon).setImageResource(drawableRes);
}
}
}
/**
* Internal touch handler for handling moving the window.
*
* @see {@link View#onTouchEvent(MotionEvent)}
*
* @param id
* @param window
* @param view
* @param event
* @return
*/
public boolean onTouchHandleMove(int id, Window window, View view,
MotionEvent event) {
StandOutLayoutParams params = window.getLayoutParams();
// how much you have to move in either direction in order for the
// gesture to be a move and not tap
int totalDeltaX = window.touchInfo.lastX - window.touchInfo.firstX;
int totalDeltaY = window.touchInfo.lastY - window.touchInfo.firstY;
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();
window.touchInfo.firstX = window.touchInfo.lastX;
window.touchInfo.firstY = window.touchInfo.lastY;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
int deltaY = (int) event.getRawY() - window.touchInfo.lastY;
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();
if (window.touchInfo.moving
|| Math.abs(totalDeltaX) >= params.threshold
|| Math.abs(totalDeltaY) >= params.threshold) {
window.touchInfo.moving = true;
// if window is moveable
if (Utils.isSet(window.flags,
StandOutFlags.FLAG_BODY_MOVE_ENABLE)) {
// update the position of the window
if (event.getPointerCount() == 1) {
params.x += deltaX;
params.y += deltaY;
}
window.edit().setPosition(params.x, params.y).commit();
}
}
break;
case MotionEvent.ACTION_UP:
window.touchInfo.moving = false;
if (event.getPointerCount() == 1) {
// bring to front on tap
boolean tap = Math.abs(totalDeltaX) < params.threshold
&& Math.abs(totalDeltaY) < params.threshold;
if (tap
&& Utils.isSet(
window.flags,
StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TAP)) {
StandOutWindow.this.bringToFront(id);
}
}
// bring to front on touch
else if (Utils.isSet(window.flags,
StandOutFlags.FLAG_WINDOW_BRING_TO_FRONT_ON_TOUCH)) {
StandOutWindow.this.bringToFront(id);
}
break;
}
onMove(id, window, view, event);
return true;
}
/**
* Internal touch handler for handling resizing the window.
*
* @see {@link View#onTouchEvent(MotionEvent)}
*
* @param id
* @param window
* @param view
* @param event
* @return
*/
public boolean onTouchHandleResize(int id, Window window, View view,
MotionEvent event) {
StandOutLayoutParams params = (StandOutLayoutParams) window
.getLayoutParams();
switch (event.getAction()) {
case MotionEvent.ACTION_DOWN:
window.touchInfo.lastX = (int) event.getRawX();
window.touchInfo.lastY = (int) event.getRawY();
window.touchInfo.firstX = window.touchInfo.lastX;
window.touchInfo.firstY = window.touchInfo.lastY;
break;
case MotionEvent.ACTION_MOVE:
int deltaX = (int) event.getRawX() - window.touchInfo.lastX;
int deltaY = (int) event.getRawY() - window.touchInfo.lastY;
// update the size of the window
params.width += deltaX;
params.height += deltaY;
// keep window between min/max width/height
if (params.width >= params.minWidth
&& params.width <= params.maxWidth) {
window.touchInfo.lastX = (int) event.getRawX();
}
if (params.height >= params.minHeight
&& params.height <= params.maxHeight) {
window.touchInfo.lastY = (int) event.getRawY();
}
window.edit().setSize(params.width, params.height).commit();
break;
case MotionEvent.ACTION_UP:
break;
}
onResize(id, window, view, event);
return true;
}
/**
* Remove focus for the window, which could belong to another application.
* Since we don't allow windows from different applications to directly
* interact with each other, except for
* {@link #sendData(Context, Class, int, int, Bundle, Class, int)}, this
* method is private.
*
* @param window
* The window to unfocus.
* @return True if focus changed successfully, false if it failed.
*/
public synchronized boolean unfocus(Window window) {
if (window == null) {
throw new IllegalArgumentException(
"Tried to unfocus a null window.");
}
return window.onFocus(false);
}
/**
* Update the window corresponding to this id with the given params.
*
* @param id
* The id of the window.
* @param params
* The updated layout params to apply.
*/
public void updateViewLayout(int id, StandOutLayoutParams params) {
Window window = getWindow(id);
if (window == null) {
throw new IllegalArgumentException("Tried to updateViewLayout("
+ id + ") a null window.");
}
if (window.visibility == Window.VISIBILITY_GONE) {
return;
}
if (window.visibility == Window.VISIBILITY_TRANSITION) {
return;
}
// alert callbacks and cancel if instructed
if (onUpdate(id, window, params)) {
Log.w(TAG, "Window " + id + " update cancelled by implementation.");
return;
}
try {
window.setLayoutParams(params);
mWindowManager.updateViewLayout(window, params);
} catch (Exception ex) {
ex.printStackTrace();
}
}
/**
* LayoutParams specific to floating StandOut windows.
*
* @author Mark Wei
*
*/
public class StandOutLayoutParams extends WindowManager.LayoutParams {
/**
* Special value for x position that represents the left of the screen.
*/
public static final int LEFT = 0;
/**
* Special value for y position that represents the top of the screen.
*/
public static final int TOP = 0;
/**
* Special value for x position that represents the right of the screen.
*/
public static final int RIGHT = Integer.MAX_VALUE;
/**
* Special value for y position that represents the bottom of the
* screen.
*/
public static final int BOTTOM = Integer.MAX_VALUE;
/**
* Special value for x or y position that represents the center of the
* screen.
*/
public static final int CENTER = Integer.MIN_VALUE;
/**
* Special value for x or y position which requests that the system
* determine the position.
*/
public static final int AUTO_POSITION = Integer.MIN_VALUE + 1;
/**
* The distance that distinguishes a tap from a drag.
*/
public int threshold;
/**
* Optional constraints of the window.
*/
public int minWidth, minHeight, maxWidth, maxHeight;
/**
* @param id
* The id of the window.
*/
public StandOutLayoutParams(int id) {
super(200, 200, TYPE_PHONE,
StandOutLayoutParams.FLAG_NOT_TOUCH_MODAL
| StandOutLayoutParams.FLAG_WATCH_OUTSIDE_TOUCH,
PixelFormat.TRANSLUCENT);
int windowFlags = getFlags(id);
setFocusFlag(false);
if (!Utils.isSet(windowFlags,
StandOutFlags.FLAG_WINDOW_EDGE_LIMITS_ENABLE)) {
// windows may be moved beyond edges
flags |= FLAG_LAYOUT_NO_LIMITS;
}
x = getX(id, width);
y = getY(id, height);
gravity = Gravity.TOP | Gravity.LEFT;
threshold = 10;
minWidth = minHeight = 0;
maxWidth = maxHeight = Integer.MAX_VALUE;
}
/**
* @param id
* The id of the window.
* @param w
* The width of the window.
* @param h
* The height of the window.
*/
public StandOutLayoutParams(int id, int w, int h) {
this(id);
width = w;
height = h;
}
/**
* @param id
* The id of the window.
* @param w
* The width of the window.
* @param h
* The height of the window.
* @param xpos
* The x position of the window.
* @param ypos
* The y position of the window.
*/
public StandOutLayoutParams(int id, int w, int h, int xpos, int ypos) {
this(id, w, h);
if (xpos != AUTO_POSITION) {
x = xpos;
}
if (ypos != AUTO_POSITION) {
y = ypos;
}
Display display = mWindowManager.getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
if (x == RIGHT) {
x = width - w;
} else if (x == CENTER) {
x = (width - w) / 2;
}
if (y == BOTTOM) {
y = height - h;
} else if (y == CENTER) {
y = (height - h) / 2;
}
}
/**
* @param id
* The id of the window.
* @param w
* The width of the window.
* @param h
* The height of the window.
* @param xpos
* The x position of the window.
* @param ypos
* The y position of the window.
* @param minWidth
* The minimum width of the window.
* @param minHeight
* The mininum height of the window.
*/
public StandOutLayoutParams(int id, int w, int h, int xpos, int ypos,
int minWidth, int minHeight) {
this(id, w, h, xpos, ypos);
this.minWidth = minWidth;
this.minHeight = minHeight;
}
/**
* @param id
* The id of the window.
* @param w
* The width of the window.
* @param h
* The height of the window.
* @param xpos
* The x position of the window.
* @param ypos
* The y position of the window.
* @param minWidth
* The minimum width of the window.
* @param minHeight
* The mininum height of the window.
* @param threshold
* The touch distance threshold that distinguishes a tap from
* a drag.
*/
public StandOutLayoutParams(int id, int w, int h, int xpos, int ypos,
int minWidth, int minHeight, int threshold) {
this(id, w, h, xpos, ypos, minWidth, minHeight);
this.threshold = threshold;
}
// helper to create cascading windows
private int getX(int id, int width) {
Display display = mWindowManager.getDefaultDisplay();
int displayWidth = display.getWidth();
int types = sWindowCache.size();
int initialX = 100 * types;
int variableX = 100 * id;
int rawX = initialX + variableX;
return rawX % (displayWidth - width);
}
// helper to create cascading windows
private int getY(int id, int height) {
Display display = mWindowManager.getDefaultDisplay();
int displayWidth = display.getWidth();
int displayHeight = display.getHeight();
int types = sWindowCache.size();
int initialY = 100 * types;
int variableY = x + 200 * (100 * id) / (displayWidth - width);
int rawY = initialY + variableY;
return rawY % (displayHeight - height);
}
public void setFocusFlag(boolean focused) {
if (focused) {
flags = flags ^ StandOutLayoutParams.FLAG_NOT_FOCUSABLE;
} else {
flags = flags | StandOutLayoutParams.FLAG_NOT_FOCUSABLE;
}
}
}
protected class DropDownListItem {
public int icon;
public String description;
public Runnable action;
public DropDownListItem(int icon, String description, Runnable action) {
super();
this.icon = icon;
this.description = description;
this.action = action;
}
@Override
|


Welcome!
About Me
Hi there, I'm Alex!
I have been studying in the IT industry for over three years. I am currently in my second year studying IT Management for Business at the University of the West of England.
I have been studying in the IT industry for over three years. I am currently in my second year studying IT Management for Business at the University of the West of England.
Achievements


A simple set of tools for Dungeons & Dragons, geared toward the 5th edition ruleset where applicable.
The code for this project is freely available under the MIT licence over at trwolfe13/dnd-5e-tools over at GitHub. Feel free to check it out, have a play and maybe even contribute! Or, if you find any problems, feel free to log an issue over at the GitHub repo.
This project would not have been possible without input from the below sources.
All backgrounds, classes, races, spells, etc. are the property of Wizards of the Coast. The Character Generator and similar tools just randomly generate references to these materials.
A lot of the names (specifically surnames of the form '[Adjective][noun]', like "Brokenshield") are inspired by fantasynamegenerators.com, and you should definitely check out the site if you get the chance.
The name generation is largely achieved using Markov models, with my own implemention inspired by otac0n/markov and chriscore/MarkovSharp.


A common requirement of workflow applications is to periodically execute certain logic according to a set schedule.
MDW provides the ScheduledJob interface,
which you can implement for this purpose. The run() method in your ScheduledJob implementation is invoked according to a
scheduled spelled out in your MDW properties file. The syntax for scheduling is similar to that of the familiar
mdw.timer.task.ProcessCleanup.TimerClass=com.centurylink.mdw.timer.cleanup.ProcessCleanup # run every day at 2:30 a.m. mdw.timer.task.ProcessCleanup.Schedule=30 2 * * ? *
This example shows the scheduling of the MDW-provided Process Cleanup job to remove old runtime instances. The value for the first property is the fully-qualified scheduled job class name, and the second property defines the schedule.
MDW guarantees that your scheduled job will run exactly once per scheduled interval at the designated time. We take appropriate locking
precautions to prevent multiple server instances in your clustered environment from racing each other to execute the job. By default, it's
undefined which server instance will pick up the job (in practice it's common that the same instance ends up always running the job). MDW provides the
RoundRobinScheduledJob strategy.
If your ScheduledJob implementation extends this base class, then you'll get simple round-robin balancing for free. If you need a more
customized approach, then you can extend LoadBalancedScheduledJob
to implement your own distribution logic. Use of job arguments is illustrated by another MDW built-in ScheduledJob implementation,
ScheduledProcessStart.
Example usage: The argument name/value here is ProcessName=com.centurylink.mypackage.MyWorkflowProcess. Arguments are appended to the scheduled job
registration property in a form like URL request parameters. These arguments are made available to your run() method via its
CallURL parameter. The CallURL class provides
methods such as getParameter() for retrieving the designated values.Job Execution
Job Arguments
# launch MyWorkflowProcess every day at 10:45
mdw.timer.task.MyProcessJob.TimerClass=com.centurylink.mdw.timer.process.ScheduledProcessStart?ProcessName=com.centurylink.mypackage.MyWorkflowProcess
mdw.timer.task.MyProcessJob.Schedule=45 10 * * ? *


{% extends 'projects/project_base.html' %} {% block title %}Project {{ project.name }} : Snapshots{% endblock %} {% block project_content %}
| Number | Tag | Date / time | |
|---|---|---|---|
| {{ snapshot.version_number }} | {{ snapshot.tag|default:'–' }} | {{ snapshot.completed }} | Browse Files Download as Zip |
| No snapshots for this project. |


| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| ValidationUtils |
|
| 4.0;4 |
| 1 | /* | |
| 2 | * @(#)ValidationUtils.java 11 Jun 2009 | |
| 3 | * | |
| 4 | * Copyright © 2009 Andrew Phillips. | |
| 5 | * | |
| 6 | * ==================================================================== | |
| 7 | * Licensed under the Apache License, Version 2.0 (the "License"); | |
| 8 | * you may not use this file except in compliance with the License. | |
| 9 | * You may obtain a copy of the License at | |
| 10 | * | |
| 11 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 12 | * | |
| 13 | * Unless required by applicable law or agreed to in writing, software | |
| 14 | * distributed under the License is distributed on an "AS IS" BASIS, | |
| 15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or | |
| 16 | * implied. | |
| 17 | * See the License for the specific language governing permissions and | |
| 18 | * limitations under the License. | |
| 19 | * ==================================================================== | |
| 20 | */ | |
| 21 | package com.qrmedia.commons.validation; | |
| 22 | ||
| 23 | /** | |
| 24 | * Simple validation methods. See Google's  | |
| 25 | * Preconditions for a more extensive version. | |
| 26 | * | |
| 27 | * @author aphillips | |
| 28 | * @since 11 Jun 2009 | |
| 29 | * | |
| 30 | */ | |
| 31 | 0 | public final class ValidationUtils { |
| 32 | ||
| 33 | /** | |
| 34 | * Checks that objects are not {@code null}. | |
| 35 | * | |
| 36 | * @param errorMessage the message of the {@link IllegalArgumentException} that will be | |
| 37 | * thrown if any of the objects is {@code null} | |
| 38 | * @param objs the objects to be checked | |
| 39 | * @throws IllegalArgumentException if any of the objects is {@code null} | |
| 40 | */ | |
| 41 | public static void checkNotNull(String errorMessage, Object... objs) { | |
| 42 | ||
| 43 | 237 | for (Object obj : objs) { |
| 44 | ||
| 45 | 162 | if (obj == null) { |
| 46 | 16 | throw new IllegalArgumentException(errorMessage); |
| 47 | } | |
| 48 | ||
| 49 | } | |
| 50 | ||
| 51 | 75 | } |
| 52 | ||
| 53 | } |


Changing
:
:
You can change this GAV and all projects linked to it will be updated. By now,
NO CHANGE IS APPLIED
until you go in the Change tab and validate.
Enter the new coordinates for this GAV :
groupId
artifactId
version
Cancel
Ok, store the change


Understanding derivations based on Bezier curves
Name:
Due September 23rd, in lab
This worksheet is intended as a short 30 min exercise to be done in groups of 2-3 people.
Catmull-ROM splines
Consider a cubic Catmull-ROM spline with data points at
-
\(p_0 = (0, 0)^T\)
-
\(p_1 = (1, 1)^T\)
-
\(p_2 = (2, 0)^T\)
1) Draw the data points
2) How many segments does the spline have?
3) To ensure C1 continuity, what equations should we use to compute four control points for each interior segment of the spline? What about the endpoints?
4) Compute the control points for segment 0 (the first segment). Draw the control points above.
5) Compute the control points for segment 1 (the second segment). Draw the control points above.
6) Suppose each data point is uniformly spaced such that p0 is at time 0, p1 is at time 1, and p2 is at time 2. What is the value of the curve at p(1.5)?
Hermite splines
Recall that for Hermite splines, each segment is interpolated using the two endpoints \(p_1\) and \(p_2\) along with the slopes at each point.
We will derive the process for computing slopes which give us C2 continuity at each input key.
Our goal is to have
>Our approach is to derive expressions for \(f^{''}(0)\) and \(f^{''}(1)\) then use these expressions to setup a system of linear equations to solve for \(p_i^{'}\)
Recall that the equation for interpolating with a Hermite spline is
where
-
What is \(f^{''}(t)\)?
-
What is \(f_{i+1}^{''}(0)\)?
-
What is \(f_i^{''}(1)\) ?
-
We want \(f_i^{''}(1) = f_{i+1}^{''}(0)\). Substitute the expressions from the previous two questions into this equation.
-
In the previous question, which variables are unknowns and which are known?
-
Rearrange the terms from question 4 so that the unknown variables are on the right hand side and the known variables are on the left hand side. This equation tells us the relationship between the input keys and the slopes at each key.
-
Suppose we have a Hermite spline with 5 points

p0 = (0,0,0)
p1 = (1,2,0)
p2 = (3,3,0)
p3 = (6,3,0)
p4 = (8,0,0)
Plug in these points into your equation for question 6. You can define three equations that we can use to solve for the slopes.
-
Put the equations from the previous question in matrix form P = A P'.
A is a 3x5 matrix, P' is a 5x3 matrix of the slopes and P is a 3x3 matrix of vectors. What are the values for each row of P? What are the values of each \(a_{ij}\)?
Hermite spline end conditions
We have three equations but 5 unknowns. How can we get two more equations so we can find a unique solution?
We can define two endpoint conditions.
Clamped endpoint conditions
In clamped endpoint conditions, we simple specify slopes for \(p_0^{'} \) and \(p_n^{'}\), e.g.
-
Extend the matrix form from the previous section to include your new clamped endpoints. Now A should be a 5x5 matrix
A should now be a 5x5 matrix. P should be a 5x3 matrix. What are the values for each row of P?

(5 points) Plug in values for our points to define P and A.

 Natural endpoint conditions

In natural endpoint conditions, we let \[ f_0^{''}(0) = f_{n-1}^{''}(1) = 0 \]

(5 points) Compute \(f_0^{''}(0) = 0 \). Solve for an expression where the knowns are on the left hand side and the unknowns are on the right hand side.
(5 points) Compute \(f_{n-1}^{''}(1) = 0 \). Solve for an expression where the knowns are on the left hand side and the unknowns are on the right hand side.
(5 points) Extend the matrix form from the previous section to include your new natural endpoint conditions. \[ P = \left[ \begin{array}{c} f_{start}(p_0,p_1)\\ f_{key}(p_0,p_2)\\ f_{key}(p_1,p_3)\\ f_{key}(p_2,p_4)\\ f_{end}(p_3,p_4) \end{array} \right]
A = \left[ \begin{array}{ccccc} a_{11} & a_{12} & 0 & 0 & 0 \\ a_{21} & a_{22} & a_{23} & 0 & 0 \\ 0 & a_{32} & a_{33} & a_{34} & 0 \\ 0 & 0 & a_{43} & a_{44} & a_{45} \\ 0 & 0 & 0 & a_{45} & a_{55} \\ \end{array} \right] \] A should now be a 5x5 matrix. P should be a 5x3 matrix. What are the expressions for each row of P?
(5 points) Plug in values for our points to define P and A.

Hermite spline example

Now that we have a 5x5 matrix A, we can solve for P' by multiplying the equation P = A P' by A-1 on both sides. This gives us \[ A^{-1} P = P^{'} \]

(5 points) Let’s formulate an example based on the 5 keys given in the previous section. We will use matlab to solve for them. Create matrices for P and A based on the values you found.

Create A using clamped endpoints. Let the values for v0 and v4 be (1,0,0). Construct A and then solve for P' like so
 inv(A) * P

You should get the following values:
 Pslopes = 1.0000 0 0 1.3214 2.0357 0 2.7143 0.8571 0 2.8214 -2.4643 0 1.0000 0 0

Now compute A using natural endpoint conditions
 You should get the following values: Pslopes = 0.8214 2.2500 0 1.3571 1.5000 0 2.7500 0.7500 0 2.6429 -1.5000 0 1.6786 -3.7500 0

 In the next section, you will use the Eigen library to solve the system of equations similar to what you just did in matlab.


sklearn.linear_model
.ridge_regression¶
-
sklearn.linear_model.
ridge_regression
(X, y, alpha, sample_weight=None, solver='auto', max_iter=None, tol=0.001, verbose=0, random_state=None, return_n_iter=False, return_intercept=False, check_input=True)[source]¶ Solve the ridge equation by the method of normal equations.
Read more in the User Guide.
- Parameters
- X{array-like, sparse matrix, LinearOperator},
shape = [n_samples, n_features] Training data
- yarray-like, shape = [n_samples] or [n_samples, n_targets]
Target values
- alpha{float, array-like},
shape = [n_targets] if array-like Regularization strength; must be a positive float. Regularization improves the conditioning of the problem and reduces the variance of the estimates. Larger values specify stronger regularization. Alpha corresponds to
C^-1
in other linear models such as LogisticRegression or LinearSVC. If an array is passed, penalties are assumed to be specific to the targets. Hence they must correspond in number.- sample_weightfloat or numpy array of shape [n_samples]
Individual weights for each sample. If sample_weight is not None and solver=’auto’, the solver will be set to ‘cholesky’.
New in version 0.17.
- solver{‘auto’, ‘svd’, ‘cholesky’, ‘lsqr’, ‘sparse_cg’, ‘sag’, ‘saga’}
Solver to use in the computational routines:
‘auto’ chooses the solver automatically based on the type of data.
‘svd’ uses a Singular Value Decomposition of X to compute the Ridge coefficients. More stable for singular matrices than ‘cholesky’.
‘cholesky’ uses the standard scipy.linalg.solve function to obtain a closed-form solution via a Cholesky decomposition of dot(X.T, X)
‘sparse_cg’ uses the conjugate gradient solver as found in scipy.sparse.linalg.cg. As an iterative algorithm, this solver is more appropriate than ‘cholesky’ for large-scale data (possibility to set
tol
and max_iter).‘lsqr’ uses the dedicated regularized least-squares routine scipy.sparse.linalg.lsqr. It is the fastest and uses an iterative procedure.
‘sag’ uses a Stochastic Average Gradient descent, and ‘saga’ uses its improved, unbiased version named SAGA. Both methods also use an iterative procedure, and are often faster than other solvers when both n_samples and n_features are large. Note that ‘sag’ and ‘saga’ fast convergence is only guaranteed on features with approximately the same scale. You can preprocess the data with a scaler from sklearn.preprocessing.
All last five solvers support both dense and sparse data. However, only ‘sag’ and ‘sparse_cg’ supports sparse input when`fit_intercept` is True.
New in version 0.17: Stochastic Average Gradient descent solver.
New in version 0.19: SAGA solver.
- max_iterint, optional
Maximum number of iterations for conjugate gradient solver. For the ‘sparse_cg’ and ‘lsqr’ solvers, the default value is determined by scipy.sparse.linalg. For ‘sag’ and saga solver, the default value is 1000.
- tolfloat
Precision of the solution.
- verboseint
Verbosity level. Setting verbose > 0 will display additional information depending on the solver used.
- random_stateint, RandomState instance or None, optional, default None
The seed of the pseudo random number generator to use when shuffling the data. If int, random_state is the seed used by the random number generator; If RandomState instance, random_state is the random number generator; If None, the random number generator is the RandomState instance used by
np.random
. Used whensolver
== ‘sag’.- return_n_iterboolean, default False
If True, the method also returns
n_iter
, the actual number of iteration performed by the solver.New in version 0.17.
- return_interceptboolean, default False
If True and if X is sparse, the method also returns the intercept, and the solver is automatically changed to ‘sag’. This is only a temporary fix for fitting the intercept with sparse data. For dense data, use sklearn.linear_model._preprocess_data before your regression.
New in version 0.17.
- check_inputboolean, default True
If False, the input arrays X and y will not be checked.
New in version 0.21.
- Returns
- coefarray, shape = [n_features] or [n_targets, n_features]
Weight vector(s).
- n_iterint, optional
The actual number of iteration performed by the solver. Only returned if
return_n_iter
is True.- interceptfloat or array, shape = [n_targets]
The intercept of the model. Only returned if
return_intercept
is True and if X is a scipy sparse array.
Notes
This function won’t compute the intercept.


Valpineware C++ Style Guide
This guide is is intended to create consistent and robust C++ code.
File Conventions
Formatting
Scoping
Classes
Scoping
Other C++ Features
Testing


Home
Contact
Log in
Sign up
Get In Touch
Let's have a chat
Drop us a line
Full Name
Email
College
Message
Get in touch
Need any help ?? Mail us!
India
IET-DAVV
<EMAIL_ADDRESS>+123 456 7890
Course Type
BTech
BBA
College
Adarsha Institute of Management (AIM-Goa), Fatorda
Agnel Institute of Technology and Design, Assagao
B. S. P. Gomantak Ayurveda Mahavidyalaya, Shiroda
Birla Institute of Technology & Science, Pilani - Goa Campus
C. E. S. College of Arts & Commerce, Cuncolim
Carmel College of Arts, Science & Commerce, Nuvem, Salcete
Devi Shreevani Education Society's Goa Institute of Management Studies
Dnyanprassarak Mandal’s College, Assagao, Goa
Don Bosco College of Engineering
Shri Gopal Govind Poi Raiturkar College of Commerce & Economics
G. V. M.'s College of Education, Ponda
Goa College of Architecture
Goa College of Home Science, Panaji
Goa College of Music, Altinho, Panaji
Goa College of Pharmacy, Panaji
Goa Dental College, Bambolim
Goa Engineering College, Farmagudi
Goa Institute of Management, Sanquelim
Goa Medical College, Bambolim
Goa Salesian Society, Don Bosco, Panaji
Goa University, Bambolim
Government Polytechnic, Panaji
Government College of Arts, Science and Commerce, Khandola
Government College of Arts and Commerce,Pernem
Govt. College of Arts, Science & Commerce, Quepem
Govt. College of Arts, Science & Commerce, Sanquelim
Govind Ramnath Kare College of Law, Margao
Indian Institute of Technology Goa
Institute of Hotel Management, Catering Technology & Applied Nutrition
Institute of Nursing Education, Panjim, Goa
Institute of Psychiatry and Human Behaviour, Bambolim
Institute Shipbuilding Technology, Goa
Marian Institute of Health Sector Management
National Hydrographic School,Vasco-da-Gama, Goa
National Institute of Technology, Goa
Naval Academy, INS Mandovi, Verem
Nirmala Institute of Education, Altinho, Panaji
P. E. S. College of Arts & Science, Farmagudi
P.E.S Rajaram and Tarabai Bandekar College of Pharmacy, Farmagudi
Padre Conceicao College of Engineering, Verna
PES College of Education, Farmagudi
Rosary College of Commerce & Arts,Navelim, Salcete
S. S. Dempo College of Commerce & Economics, Altinho, Panaji
Saraswat Vidyalaya's College of Commerce & Management Studies
Shree Damodar College of Commerce & Economics, Comba
Shree Mallikarjun College of Arts & Commerce, Delem, Canacona
Shree Rayeshwar Institute of Engineering and Information Technology
Shri Kamaxshi Devi Homeopathic Medical College & Hospital
P.E.S.V.P College of Commerce,Education,Computer and Management
Smt Parvatibai Chowgule College, Margao
The One School Goa, Photography,Film making, Ucassaim
Sri Sri Institute of Management Studies, Margao
St. Xavier's College, Mapusa, Goa
V. M. Salgaocar College of Law, Miramar, Panaji
V. V. Mandal's Institute of Management Training and Research
X. E. S. Fr. Agnel College of Arts & Comm, Pilar, Goa
Swami Vivekanand Vidyalaya's college of commerce, Bori, Ponda-Goa
Goa Multi-Faculty College
Our Lady OF Lourdes Higher Secondary Valpoi
DCT's Dhempe College of Arts and Science, Miramar, Panaji Goa


@(election: models.Election, voter: models.Voter, url: String, passCode: String)(implicit messages: Messages)


ZptSharp architecture
The following diagram shows the architecture of a complete application which uses ZptSharp.
The consuming application must add ZptSharp to its IServiceCollection
(dependency injection) during Startup, as well as perform a few one-time configuration/registration tasks.
Once ZptSharp is set up, a project which makes use of it need only take a direct reference to the ZptSharp package. Consuming projects need not reference the other packages, because all of ZptSharp's functionality is available by injecting interfaces.
The ZptSharp.Abstractions package
The NuGet package ZptSharp.Abstractions contains only abstractions, model types and the API. In particular it contains the IRendersZptFile
& IRendersZptDocument
interfaces which are the two primary entry-points to the functionality.
This package's dependencies have been kept to a minimum, so that it is as easy as possible to consume. This package forms one half of "The ZptSharp core".
The ZptSharp package
The ZptSharp NuGet package contains the main logic and implementation classes for almost all of the abstractions declared in the ZptSharp package. This package is the other half of "The ZptSharp core".
ZptSharp includes the following expression evaluators (see below).
path
string
not
pipe
Document providers
In order to have a working ZptSharp implementation, you must install at least one document provider packages. The two core packages alone are not enough.
Document providers are the way in which ZptSharp reads and writes markup documents (HTML and/or XML). The main interface which must be implemented by a document provider is IReadsAndWritesDocument
. They bridge the gap between the ZptSharp core packages and the DOM.
ZptSharp has three document provider packages available:
| Package | Description |
|---|---|
| ZptSharp.Xml | Reads/writes XML documents using the System.Xml.Linq API |
| ZptSharp.HtmlAgilityPack | Reads/writes HTML documents using the HTML Agility Pack |
| ZptSharp.AngleSharp | Reads/writes HTML documents using AngleSharp |
Expression evaluators
An expression evaluator provides support for one or more TALES expression types. Unlike document providers, the core packages include support for a few expression types, which may be sufficient for your application. Installing additional evaluators is optional.
The main interface which an expression evaluator must implement is IEvaluatesExpression
.
The available expression evaluator add-on packages are:
| Package | Description |
|---|---|
| ZptSharp.PythonExpressions | Evaluates expressions written in Python 2 (via IronPython) |
| ZptSharp.CSharpExpressions | Evaluates expressions written in C# (via Roslyn scripting API) |


BIO:
Hi,
I'm Ahmed Bani-Salameh from Irbid, Jordan. I'm 22 years old a fresh graduate B.S. in Computer Science , I was born in Irbid, Jordan grew up in las cruises, New Mexico, USA. I'm a high energetic, enthusiastic, self managed individual that have the ability to adapt real quick in new environments, good communication skills and have the ability to develop and acquire new skills, I'm pretty good when it comes to problem solving, I have a stratigic vision.
I'm kind of a fun guy , I like travilling, swimming, gaming, hanging out with friends, make new relationships.
for now I'm developing my skills and knowledge and looking forward to start a wonderful career.
EDUCATION
- Yarmouk University
- ASAC
Bachelor's Degree in Computer Science , February 2021
Software Development Scholarship , june 2021
EXPERIENCE
- Yarmouk University
- ASAC
Graduation project (securing data using cryptography and steganography)
Software Development
The top 10 cars in my list
- Mercedes SLR mclaren
- Ferrari F40
- Mclaren 720s
- Mercedes AMG GT 63s 4-door coupe
- Audi RS7
- rolls royce wraith black badge
- Bently mulsanne
- Mercedes C63 amg black series
- BMW M4 competition pack
- Toyota supra


|
|---|
| Therefore leaving the principles of the doctrine of Christ, let us go on unto perfection; not laying again the foundation of repentance from dead works, and of faith toward God,
|
|---|
| ᎾᏍᎩ ᎢᏳᏍᏗ ᎢᏗᎯᏯᏍᎬ ᎠᎴᏅᏙᏗ ᎦᎶᏁᏛ ᎤᏤᎵ ᏗᏕᏲᏗ ᎨᏒᎢ, ᏂᎦᎷᎶᎬᎾ ᎨᏒ ᎢᏴᏛ ᏫᏗᏰᎢᎶᎦ; ᏔᎵᏁ ᎦᎫᏍᏛᏗ ᏂᏗᎲᏍᎬᎾ ᎦᏁᏟᏴᏍᏗ ᎨᏒ ᎣᏓᏅᏛ ᎤᎬᏩᎵ, ᎠᏓᎯᎯᏉ ᏗᎦᎸᏫᏍᏓᏁᏗ ᏥᎩ, ᎠᎴ ᎤᏁᎳᏅᎯ ᎪᎯᏳᏗ ᎨᏒᎢ,
|
|---|
Na-s-gi i-yu-s-di i-di-hi-ya-s-gv a-le-nv-do-di Ga-lo-ne-dv u-tse-li di-de-yo-di ge-sv-i, ni-ga-lu-lo-gv-na ge-sv i-yv-dv wi-di-ye-i-lo-ga; ta-li-ne ga-gu-s-dv-di ni-di-hv-s-gv-na ga-ne-tli-yv-s-di ge-sv o-da-nv-dv u-gv-wa-li, a-da-hi-hi-quo di-ga-lv-wi-s-da-ne-di tsi-gi, a-le U-ne-la-nv-hi go-hi-yu-di ge-sv-i,
|
|---|
|
|---|
| Of the doctrine of baptisms, and of laying on of hands, and of resurrection of the dead, and of eternal judgment.
|
|---|
| ᏗᏓᏬᏍᏗ ᎨᏒ ᏗᏕᏲᏅᎯ ᎤᎬᏩᎵ, ᎠᎴ ᏗᏓᏏᏔᏗᏍᏗ ᎨᏒ ᎤᎬᏩᎵ, ᎠᎴ ᏧᏂᏲᎱᏒᎯ ᏧᎾᎴᎯᏐᏗ ᎨᏒ ᎤᎬᏩᎵ, ᎠᎴ ᎤᎵᏍᏆᏗᏍᏗ ᏂᎨᏒᎾ ᏗᎫᎪᏙᏗ ᎨᏒ ᎤᎬᏩᎵ.
|
|---|
Di-da-wo-s-di ge-sv di-de-yo-nv-hi u-gv-wa-li, a-le di-da-si-ta-di-s-di ge-sv u-gv-wa-li, a-le tsu-ni-yo-hu-sv-hi tsu-na-le-hi-so-di ge-sv u-gv-wa-li, a-le u-li-s-qua-di-s-di ni-ge-sv-na di-gu-go-do-di ge-sv u-gv-wa-li.
|
|---|
|
|---|
| And this will we do, if God permit.
|
|---|
| ᎠᎴ ᎾᏍᎩ ᎯᎠ ᏅᏓᏓᏛᏁᎵ ᎢᏳᏃ ᎤᏁᎳᏅᎯ ᏱᎦᎵᏍᎪᎸᏓᏁᎸ.
|
|---|
A-le na-s-gi hi-a nv-da-da-dv-ne-li i-yu-no U-ne-la-nv-hi yi-ga-li-s-go-lv-da-ne-lv.
|
|---|
|
|---|
| For it is impossible for those who were once enlightened, and have tasted of the heavenly gift, and were made partakers of the Holy Ghost,
|
|---|
| ᎬᏩᏟᏍᏗᏰᏃ ᎾᏍᎩ Ꮎ ᎢᎸᎯᏳ ᎢᎦ ᎨᎦᏗᏍᏓᏁᎸᎯ ᎨᏒᎢ, ᎠᎴ ᎤᎾᏁᎶᏔᏅᎯ ᎨᏒ ᎦᎸᎶᎢ ᏅᏓᏳᏓᎴᏅᎯ ᎠᏓᏁᏗ ᎨᏒᎢ, ᎠᎴ ᎦᎸᏉᏗᏳ ᎠᏓᏅᏙ ᎨᎦᏠᏯᏍᏔᏅ ᎨᏥᏁᎸᎯ.
|
|---|
Gv-wa-tli-s-di-ye-no na-s-gi na i-lv-hi-yu i-ga ge-ga-di-s-da-ne-lv-hi ge-sv-i, a-le u-na-ne-lo-ta-nv-hi ge-sv ga-lv-lo-i nv-da-yu-da-le-nv-hi a-da-ne-di ge-sv-i, a-le Ga-lv-quo-di-yu A-da-nv-do ge-ga-tlo-ya-s-ta-nv ge-tsi-ne-lv-hi.
|
|---|
|
|---|
| And have tasted the good word of God, and the powers of the world to come,
|
|---|
| ᎠᎴ ᎤᎾᏁᎶᏔᏅᎯ ᏥᎩ ᎣᏍᏛ ᎧᏃᎮᏛ ᎤᏁᎳᏅᎯ ᎤᏤᎵᎦ, ᎠᎴ ᎤᎵᏂᎩᏛ ᎨᏒ ᎤᎵᏍᏆᎸᏗ ᎨᏒᎢ,
|
|---|
A-le u-na-ne-lo-ta-nv-hi tsi-gi o-s-dv ka-no-he-dv U-ne-la-nv-hi u-tse-li-ga, a-le u-li-ni-gi-dv ge-sv u-li-s-qua-lv-di ge-sv-i,
|
|---|
|
|---|
| If they shall fall away, to renew them again unto repentance; seeing they crucify to themselves the Son of God afresh, and put him to an open shame.
|
|---|
| ᎾᏍᎩ ᏧᏂᏲᏒᎯ ᎨᏒᎢ, ᎬᏩᏟᏍᏗ ᏔᎵᏁ ᎢᏤ ᎢᎨᎬᏁᏗᏱ ᎦᏁᏟᏴᏍᏗ ᎨᏒ ᏚᎾᏓᏅᏛ ᏭᏂᎷᎯᏍᏗᏱ; ᎤᏅᏒᏰᏃ ᏔᎵᏁ ᎤᎾᏓᏛᏁᎸᎯ ᎢᎩ ᎤᏁᎳᏅᎯ ᎤᏪᏥ, ᎠᎴ ᎬᏂᎨᏒ ᎬᏩᏕᎰᎯᏍᏔᏅᎯ ᎢᎩ.
|
|---|
Na-s-gi tsu-ni-yo-sv-hi ge-sv-i, gv-wa-tli-s-di ta-li-ne i-tse i-ge-gv-ne-di-yi ga-ne-tli-yv-s-di ge-sv du-na-da-nv-dv wu-ni-lu-hi-s-di-yi; u-nv-sv-ye-no ta-li-ne u-na-da-dv-ne-lv-hi i-gi U-ne-la-nv-hi U-we-tsi, a-le gv-ni-ge-sv gv-wa-de-ho-hi-s-ta-nv-hi i-gi.
|
|---|
|
|---|
| For the earth which drinketh in the rain that cometh oft upon it, and bringeth forth herbs meet for them by whom it is dressed, receiveth blessing from God:
|
|---|
| ᎦᏙᎯᏰᏃ ᏣᏗᏔᏍᎪ ᎠᎹ ᏯᏃ ᎤᎦᎿᎭᏂᎯᎲᎢ, ᎠᎴ ᏥᎦᎾᏄᎪᏫᏍᎪ ᎠᏛᏒᎥᏍᎩ ᎪᎱᏍᏗ ᎤᏅᏙᏗ ᎾᏍᎩ Ꮎ ᎦᏙᎯ ᎨᏥᎶᎦᏁᎸᎯ, ᎾᏍᎩ ᎤᏁᎳᏅᎯ ᎣᏍᏛ ᎾᏛᏁᎰᎢ.
|
|---|
Ga-do-hi-ye-no tsa-di-ta-s-go a-ma ya-no u-ga-hna-ni-hi-hv-i, a-le tsi-ga-na-nu-go-wi-s-go a-dv-sv-v-s-gi go-hu-s-di u-nv-do-di na-s-gi na ga-do-hi ge-tsi-lo-ga-ne-lv-hi, na-s-gi U-ne-la-nv-hi o-s-dv na-dv-ne-ho-i.
|
|---|
|
|---|
| But that which beareth thorns and briers is rejected, and is nigh unto cursing; whose end is to be burned.
|
|---|
| ᎾᏍᎩᏍᎩᏂ Ꮎ ᏥᏍᏚᏂᎩᏍᏗ ᎠᎴ ᎧᏄᎦᎸ ᎠᏛᏍᎬᎢ ᎠᏗᏅᏗᏉ, ᎠᎴ ᎠᏍᎦᎢᏍᏗᏱ ᎨᏒ ᎾᎥᏂᏳ ᏄᏍᏗᏕᎪᎢ, ᎾᏍᎩ ᎤᎵᏍᏆᎸᏗ ᎨᏒ ᎠᎪᎲᏍᏙᏗ ᏥᎩ.
|
|---|
Na-s-gi-s-gi-ni na tsi-s-du-ni-gi-s-di a-le ka-nu-ga-lv a-dv-s-gv-i a-di-nv-di-quo, a-le a-s-ga-i-s-di-yi ge-sv na-v-ni-yu nu-s-di-de-go-i, na-s-gi u-li-s-qua-lv-di ge-sv a-go-hv-s-do-di tsi-gi.
|
|---|
|
|---|
| But, beloved, we are persuaded better things of you, and things that accompany salvation, though we thus speak.
|
|---|
| ᎠᏎᏃ, ᏂᎯ ᎨᏒ ᎢᏨᎨᏳᎢ, ᏅᏟᎯᏳ ᎣᏍᏛ ᎤᏚᎩ ᎢᏨᏴᎾᏁᎭ, ᎠᎴ ᎠᎵᏍᏕᎸᏙᏗ ᎨᏒ ᎤᎬᏩᎵ ᏔᎵ ᎤᏛᏗᏕᎬᎢ, ᎯᎠᏍᎩᏂᏃᏅ ᏃᏥᏪᎭ.
|
|---|
A-se-no, ni-hi ge-sv i-tsv-ge-yu-i, nv-tli-hi-yu o-s-dv u-du-gi i-tsv-yv-na-ne-ha, a-le a-li-s-de-lv-do-di ge-sv u-gv-wa-li ta-li u-dv-di-de-gv-i, hi-a-s-gi-ni-no-nv no-tsi-we-ha.
|
|---|
|
|---|
| For God is not unrighteous to forget your work and labour of love, which ye have shewed toward his name, in that ye have ministered to the saints, and do minister.
|
|---|
| ᎤᏁᎳᏅᎯᏰᏃ ᎥᏝ ᏂᏚᏳᎪᏛᎾ ᎢᎬᏩᏛᏁᏗ ᏱᎩ ᎾᏍᎩ ᎤᏩᎨᏫᏍᏗᏱ ᏕᏥᎸᏫᏍᏓᏁᎸ ᎠᎴ ᎬᏂᎨᏒ ᏂᏨᏁᎸ ᎢᏥᎨᏳᏒ ᏕᎤᏙᎥᎢ. ᎾᏍᎩ ᏕᏥᏍᏕᎸᎯᏙᎸ ᎤᎾᏓᏅᏘ, ᎠᎴ ᎠᏏᏉ ᏕᏥᏍᏕᎵᏍᎬᎢ.
|
|---|
U-ne-la-nv-hi-ye-no v-tla ni-du-yu-go-dv-na i-gv-wa-dv-ne-di yi-gi na-s-gi u-wa-ge-wi-s-di-yi de-tsi-lv-wi-s-da-ne-lv a-le gv-ni-ge-sv ni-tsv-ne-lv i-tsi-ge-yu-sv de-u-do-v-i. Na-s-gi de-tsi-s-de-lv-hi-do-lv u-na-da-nv-ti, a-le a-si-quo de-tsi-s-de-li-s-gv-i.
|
|---|
|
|---|
| And we desire that every one of you do shew the same diligence to the full assurance of hope unto the end:
|
|---|
| ᎠᎴ ᎣᎦᏚᎵᎭ ᏂᏥᎥ ᎢᏥᏏᏴᏫᎭ ᎨᏒ ᎬᎵᏍᏆᏗᏍᎩ ᎾᏍᎩᏯ ᎢᎦᎢ ᎢᏣᏟᏂᎬᏁᏗᏱ ᎬᏂ ᎤᏣᏘ ᏄᏜᏓᏏᏛᏒᎾ ᎤᏚᎩ ᎬᏗ ᎨᏒ ᏫᏥᏱᎶᎸᎭ;
|
|---|
A-le o-ga-du-li-ha ni-tsi-v i-tsi-si-yv-wi-ha ge-sv gv-li-s-qua-di-s-gi na-s-gi-ya i-ga-i i-tsa-tli-ni-gv-ne-di-yi gv-ni u-tsa-ti nu-dla-si-dv-sv-na u-du-gi gv-di ge-sv wi-tsi-yi-lo-lv-ha;
|
|---|
|
|---|
| That ye be not slothful, but followers of them who through faith and patience inherit the promises.
|
|---|
| ᎾᏍᎩ ᎢᏳᏍᏗ ᏞᏍᏗ ᎢᏣᏓᏄᎸᏗᏉ ᏱᎨᏎᏍᏗ, ᏗᏥᏍᏓᏩᏕᎩᏍᎩᏂ ᎨᏎᏍᏗ ᎾᏍᎩ Ꮎ ᎤᏃᎯᏳᏒ ᎠᎴ ᏗᏅᏂᏗᏳ ᎨᏒ ᎠᏅᏗᏍᎬ ᎤᎾᏤᎵ ᏄᏅᏁᎸ ᎠᏚᎢᏍᏔᏅᎢ.
|
|---|
Na-s-gi i-yu-s-di tle-s-di i-tsa-da-nu-lv-di-quo yi-ge-se-s-di, di-tsi-s-da-wa-de-gi-s-gi-ni ge-se-s-di na-s-gi na u-no-hi-yu-sv a-le di-nv-ni-di-yu ge-sv a-nv-di-s-gv u-na-tse-li nu-nv-ne-lv a-du-i-s-ta-nv-i.
|
|---|
|
|---|
| For when God made promise to Abraham, because he could swear by no greater, he sware by himself,
|
|---|
| ᎤᏁᎳᏅᎯᏰᏃ ᎡᏆᎭᎻ ᎤᏚᎢᏍᏓᏁᎸ, ᎾᏍᎩ ᎩᎶ ᏅᏩᏓᎴ ᎤᏟ ᎢᏯᏥᎸᏉᏗ ᏒᎲ ᎬᏩᏎᎵᏙᏗ ᏂᎨᏒᎾ ᎨᏎᎢ, ᎤᏩᏒ ᎡᎲ ᎤᏎᎵᏙᏔᏁᎢ,
|
|---|
U-ne-la-nv-hi-ye-no E-qua-ha-mi u-du-i-s-da-ne-lv, na-s-gi gi-lo nv-wa-da-le u-tli i-ya-tsi-lv-quo-di sv-hv gv-wa-se-li-do-di ni-ge-sv-na ge-se-i, u-wa-sv e-hv u-se-li-do-ta-ne-i,
|
|---|
|
|---|
| Saying, Surely blessing I will bless thee, and multiplying I will multiply thee.
|
|---|
| ᎯᎠ ᏄᏪᏎᎢ, ᎤᏙᎯᏳᎯᏯ ᎤᏣᏘ ᎣᏍᏛ ᏅᏓᎬᏯᏛᏁᎵ, ᎠᎴ ᎤᏣᏘ ᏓᎬᏁᏉᎢ.
|
|---|
Hi-a nu-we-se-i, U-do-hi-yu-hi-ya u-tsa-ti o-s-dv nv-da-gv-ya-dv-ne-li, a-le u-tsa-ti da-gv-ne-quo-i.
|
|---|
|
|---|
| And so, after he had patiently endured, he obtained the promise.
|
|---|
| ᎰᏩᏃ ᎪᎯᏗᏳ ᎤᎦᏘᏛ ᎠᏥᏁᎴ ᎠᏚᎢᏍᏔᏅᎯ ᎨᏒᎢ.
|
|---|
Ho-wa-no go-hi-di-yu u-ga-ti-dv a-tsi-ne-le a-du-i-s-ta-nv-hi ge-sv-i.
|
|---|
|
|---|
| For men verily swear by the greater: and an oath for confirmation is to them an end of all strife.
|
|---|
| ᏴᏫᏰᏃ ᎤᏙᎯᏳᎯ ᎤᏟ ᎢᏯᏥᎸᏉᏗ ᎡᎲ ᎨᎦᏎᎵᏙᏗᏍᎪᎢ; ᎠᎴ ᎠᏎᎵᏔᏅᎯ ᎨᏒ (ᎪᎱᏍᏗ) ᎠᏍᏓᏱᏗᏍᏙᏗ ᎠᏲᎯᏍᏗᏍᎩ ᎨᏐ ᎠᎾᏗᏒᎯᎲᎢ.
|
|---|
Yv-wi-ye-no u-do-hi-yu-hi u-tli i-ya-tsi-lv-quo-di e-hv ge-ga-se-li-do-di-s-go-i; a-le a-se-li-ta-nv-hi ge-sv (go-hu-s-di) a-s-da-yi-di-s-do-di a-yo-hi-s-di-s-gi ge-so a-na-di-sv-hi-hv-i.
|
|---|
|
|---|
| Wherein God, willing more abundantly to shew unto the heirs of promise the immutability of his counsel, confirmed it by an oath:
|
|---|
| ᎾᏍᎩ ᎢᏳᏍᏗ ᎤᏁᎳᏅᎯ ᎤᏚᎵᏍᎬ ᎤᏟ ᎢᎦᎢ ᎬᏂᎨᏒ ᎢᏧᏩᏁᏗᏱ ᎨᏥᏚᎢᏍᏓᏁᎸᎯ ᎾᏍᎩ ᎬᏩᏓᏁᏟᏴᏍᏗ ᏂᎨᏒᎾ ᎨᏒ ᏄᏍᏛ ᎠᏓᏅᏖᏍᎬᎢ, ᎠᏎᎵᏛᏍᎬ ᎤᏍᏓᏱᏍᏔᏁᎢ.
|
|---|
Na-s-gi i-yu-s-di U-ne-la-nv-hi u-du-li-s-gv u-tli i-ga-i gv-ni-ge-sv i-tsu-wa-ne-di-yi ge-tsi-du-i-s-da-ne-lv-hi na-s-gi gv-wa-da-ne-tli-yv-s-di ni-ge-sv-na ge-sv nu-s-dv a-da-nv-te-s-gv-i, a-se-li-dv-s-gv u-s-da-yi-s-ta-ne-i.
|
|---|
|
|---|
| That by two immutable things, in which it was impossible for God to lie, we might have a strong consolation, who have fled for refuge to lay hold upon the hope set before us:
|
|---|
| ᎠᎴ ᎾᏍᎩ ᏔᎵ ᏄᎵᏁᏨ ᏕᏛᏗᏍᎬ ᎾᏍᎩ ᎬᏩᏓᏁᏟᏴᏍᏗ ᏂᎨᏒᎾ ᎨᏒᎢ, ᎾᎿᎭᎬᏩᏥᎪᏗ ᏂᎨᏒᎾ ᏥᎨᎭ ᎤᏁᎳᏅᎯ, ᎠᏴ ᎢᎩᏲᎸᎯ ᏥᎩ ᎢᎦᏗᏍᎦᎶᏗᏱ, ᎤᎵᏂᎩᏛ ᎢᎩᎦᎵᏍᏓᏗᏍᎩ ᎨᎩᏩᏛᏗ ᎢᏳᎵᏍᏙᏗᏱ, ᎾᏍᎩ ᏗᎩᏂᏴᏗᏱ ᎤᏚᎩ ᎬᏗ ᎡᎩᏩᏌᏓᏁᎲᎢ;
|
|---|
A-le na-s-gi ta-li nu-li-ne-tsv de-dv-di-s-gv na-s-gi gv-wa-da-ne-tli-yv-s-di ni-ge-sv-na ge-sv-i, na-hna gv-wa-tsi-go-di ni-ge-sv-na tsi-ge-ha U-ne-la-nv-hi, a-yv i-gi-yo-lv-hi tsi-gi i-ga-di-s-ga-lo-di-yi, u-li-ni-gi-dv i-gi-ga-li-s-da-di-s-gi ge-gi-wa-dv-di i-yu-li-s-do-di-yi, na-s-gi di-gi-ni-yv-di-yi u-du-gi gv-di e-gi-wa-sa-da-ne-hv-i;
|
|---|
|
|---|
| Which hope we have as an anchor of the soul, both sure and stedfast, and which entereth into that within the veil;
|
|---|
| ᎾᏍᎩ ᎤᏚᎩ ᎬᏗ ᎨᏒ ᎾᏍᎩᏯ ᎠᏓᏅᏙ ᎦᎾᎯᏍᏙᏗ ᏥᎩ, ᎡᏍᎦ ᏂᎦᎵᏍᏗᏍᎬᎾ ᎠᎴ ᎬᏗᏏᏴᏍᏗ ᏂᎨᏒᎾ, ᎠᎴ ᎾᏍᎩ ᏥᏩᏴᎯᎭ ᎾᏍᎩ ᎠᏰᏙᎳᏛ ᎤᏗᏗᏢ;
|
|---|
Na-s-gi u-du-gi gv-di ge-sv na-s-gi-ya a-da-nv-do ga-na-hi-s-do-di tsi-gi, e-s-ga ni-ga-li-s-di-s-gv-na a-le gv-di-si-yv-s-di ni-ge-sv-na, a-le na-s-gi tsi-wa-yv-hi-ha na-s-gi a-ye-do-la-dv u-di-di-tlv;
|
|---|
|
|---|
| Whither the forerunner is for us entered, even Jesus, made an high priest for ever after the order of Melchisedec.
|
|---|
| ᎾᎿᎭᏥᏌ ᎢᎬᏱ ᎡᎩ ᏫᎩᏴᏎᎸᎯ ᏥᎩ, ᎾᏍᎩ ᏄᎬᏫᏳᏒ ᎠᏥᎸ-ᎨᎶᎯ ᏂᎪᎯᎸ ᎠᏥᎧᏅᎯ ᏥᎩ, ᎺᎵᎩᏏᏕᎩ ᏄᏍᏛ ᎾᏍᎩᏯᎢ.
|
|---|
Na-hna Tsi-sa i-gv-yi e-gi wi-gi-yv-se-lv-hi tsi-gi, na-s-gi nu-gv-wi-yu-sv a-tsi-lv--ge-lo-hi ni-go-hi-lv a-tsi-ka-nv-hi tsi-gi, Me-li-gi-si-de-gi nu-s-dv na-s-gi-ya-i.
|
|---|


The basic labeled argument that parses a value. More...
#include <ValueArg.h>
Public Member Functions | |
| ValueArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, const std::string &typeDesc, Visitor *v=NULL) | |
| Labeled ValueArg constructor. | |
| ValueArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, const std::string &typeDesc, CmdLineInterface &parser, Visitor *v=NULL) | |
| Labeled ValueArg constructor. | |
| ValueArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, Constraint< T > *constraint, CmdLineInterface &parser, Visitor *v=NULL) | |
| Labeled ValueArg constructor. | |
| ValueArg (const std::string &flag, const std::string &name, const std::string &desc, bool req, T value, Constraint< T > *constraint, Visitor *v=NULL) | |
| Labeled ValueArg constructor. | |
| virtual bool | processArg (int *i, std::vector< std::string > &args) |
| Handles the processing of the argument. | |
| T & | getValue () |
| Returns the value of the argument. | |
| virtual std::string | shortID (const std::string &val="val") const |
| Specialization of shortID. | |
| virtual std::string | longID (const std::string &val="val") const |
| Specialization of longID. | |
| virtual void | reset () |
| Clears the Arg object and allows it to be reused by new command lines. | |
Protected Member Functions | |
| void | _extractValue (const std::string &val) |
| Extracts the value from the string. | |
Protected Attributes | |
| T | _value |
| The value parsed from the command line. | |
| T | _default |
| Used to support the reset() method so that ValueArg can be reset to their constructed value. | |
| std::string | _typeDesc |
| A human readable description of the type to be parsed. | |
| Constraint< T > * | _constraint |
| A Constraint this Arg must conform to. |
The basic labeled argument that parses a value.
This is a template class, which means the type T defines the type that a given object will attempt to parse when the flag/name is matched on the command line. While there is nothing stopping you from creating an unflagged ValueArg, it is unwise and would cause significant problems. Instead use an UnlabeledValueArg.
Definition at line 43 of file ValueArg.h.
| TCLAP::ValueArg< T >::ValueArg | ( | const std::string & | flag, | |
| const std::string & | name, | |||
| const std::string & | desc, | |||
| bool | req, | |||
| T | value, | |||
| const std::string & | typeDesc, | |||
| Visitor * | v = NULL | |||
| ) | [inline] |
Labeled ValueArg constructor.
Constructor implementation.
You could conceivably call this constructor with a blank flag, but that would make you a bad person. It would also cause an exception to be thrown. If you want an unlabeled argument, use the other constructor.
| flag | - The one character flag that identifies this argument on the command line. | |
| name | - A one word name for the argument. Can be used as a long flag on the command line. | |
| desc | - A description of what the argument is for or does. | |
| req | - Whether the argument is required on the command line. | |
| value | - The default value assigned to this argument if it is not present on the command line. | |
| typeDesc | - A short, human readable description of the type that this object expects. This is used in the generation of the USAGE statement. The goal is to be helpful to the end user of the program. | |
| v | - An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 252 of file ValueArg.h.
| TCLAP::ValueArg< T >::ValueArg | ( | const std::string & | flag, | |
| const std::string & | name, | |||
| const std::string & | desc, | |||
| bool | req, | |||
| T | value, | |||
| const std::string & | typeDesc, | |||
| CmdLineInterface & | parser, | |||
| Visitor * | v = NULL | |||
| ) | [inline] |
Labeled ValueArg constructor.
You could conceivably call this constructor with a blank flag, but that would make you a bad person. It would also cause an exception to be thrown. If you want an unlabeled argument, use the other constructor.
| flag | - The one character flag that identifies this argument on the command line. | |
| name | - A one word name for the argument. Can be used as a long flag on the command line. | |
| desc | - A description of what the argument is for or does. | |
| req | - Whether the argument is required on the command line. | |
| value | - The default value assigned to this argument if it is not present on the command line. | |
| typeDesc | - A short, human readable description of the type that this object expects. This is used in the generation of the USAGE statement. The goal is to be helpful to the end user of the program. | |
| parser | - A CmdLine parser object to add this Arg to | |
| v | - An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 267 of file ValueArg.h.
References TCLAP::CmdLineInterface::add().
| TCLAP::ValueArg< T >::ValueArg | ( | const std::string & | flag, | |
| const std::string & | name, | |||
| const std::string & | desc, | |||
| bool | req, | |||
| T | value, | |||
| Constraint< T > * | constraint, | |||
| CmdLineInterface & | parser, | |||
| Visitor * | v = NULL | |||
| ) | [inline] |
Labeled ValueArg constructor.
You could conceivably call this constructor with a blank flag, but that would make you a bad person. It would also cause an exception to be thrown. If you want an unlabeled argument, use the other constructor.
| flag | - The one character flag that identifies this argument on the command line. | |
| name | - A one word name for the argument. Can be used as a long flag on the command line. | |
| desc | - A description of what the argument is for or does. | |
| req | - Whether the argument is required on the command line. | |
| value | - The default value assigned to this argument if it is not present on the command line. | |
| constraint | - A pointer to a Constraint object used to constrain this Arg. | |
| parser | - A CmdLine parser object to add this Arg to. | |
| v | - An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 300 of file ValueArg.h.
References TCLAP::CmdLineInterface::add().
| TCLAP::ValueArg< T >::ValueArg | ( | const std::string & | flag, | |
| const std::string & | name, | |||
| const std::string & | desc, | |||
| bool | req, | |||
| T | value, | |||
| Constraint< T > * | constraint, | |||
| Visitor * | v = NULL | |||
| ) | [inline] |
Labeled ValueArg constructor.
You could conceivably call this constructor with a blank flag, but that would make you a bad person. It would also cause an exception to be thrown. If you want an unlabeled argument, use the other constructor.
| flag | - The one character flag that identifies this argument on the command line. | |
| name | - A one word name for the argument. Can be used as a long flag on the command line. | |
| desc | - A description of what the argument is for or does. | |
| req | - Whether the argument is required on the command line. | |
| value | - The default value assigned to this argument if it is not present on the command line. | |
| constraint | - A pointer to a Constraint object used to constrain this Arg. | |
| v | - An optional visitor. You probably should not use this unless you have a very good reason. |
Definition at line 285 of file ValueArg.h.
| void TCLAP::ValueArg< T >::_extractValue | ( | const std::string & | val | ) | [inline, protected] |
Extracts the value from the string.
Attempts to parse string as type T, if this fails an exception is thrown.
| val | - value to be parsed. |
Definition at line 400 of file ValueArg.h.
References TCLAP::ValueArg< T >::_constraint, TCLAP::ValueArg< T >::_value, TCLAP::ArgException::error(), TCLAP::ExtractValue(), and TCLAP::Arg::toString().
Referenced by TCLAP::ValueArg< T >::processArg(), and TCLAP::UnlabeledValueArg< T >::processArg().
| T & TCLAP::ValueArg< T >::getValue | ( | ) | [inline] |
Returns the value of the argument.
Implementation of getValue().
Definition at line 322 of file ValueArg.h.
References TCLAP::ValueArg< T >::_value.
| std::string TCLAP::ValueArg< T >::longID | ( | const std::string & | val = "val" |
) | const [inline, virtual] |
Specialization of longID.
Implementation of longID.
| val | - value to be used. |
Reimplemented from TCLAP::Arg.
Reimplemented in TCLAP::UnlabeledValueArg< T >.
Definition at line 393 of file ValueArg.h.
References TCLAP::ValueArg< T >::_typeDesc.
| bool TCLAP::ValueArg< T >::processArg | ( | int * | i, | |
| std::vector< std::string > & | args | |||
| ) | [inline, virtual] |
Handles the processing of the argument.
Implementation of processArg().
This re-implements the Arg version of this method to set the _value of the argument appropriately. It knows the difference between labeled and unlabeled.
| i | - Pointer the the current argument in the list. | |
| args | - Mutable list of strings. Passed in from main(). |
Implements TCLAP::Arg.
Reimplemented in TCLAP::UnlabeledValueArg< T >.
Definition at line 328 of file ValueArg.h.
References TCLAP::Arg::_alreadySet, TCLAP::Arg::_checkWithVisitor(), TCLAP::ValueArg< T >::_extractValue(), TCLAP::Arg::_hasBlanks(), TCLAP::Arg::_ignoreable, TCLAP::Arg::_xorSet, TCLAP::Arg::argMatches(), TCLAP::Arg::delimiter(), TCLAP::Arg::ignoreRest(), TCLAP::Arg::toString(), and TCLAP::Arg::trimFlag().
| void TCLAP::ValueArg< T >::reset | ( | ) | [inline, virtual] |
Clears the Arg object and allows it to be reused by new command lines.
Reimplemented from TCLAP::Arg.
Definition at line 417 of file ValueArg.h.
References TCLAP::ValueArg< T >::_default, and TCLAP::ValueArg< T >::_value.
| std::string TCLAP::ValueArg< T >::shortID | ( | const std::string & | val = "val" |
) | const [inline, virtual] |
Specialization of shortID.
Implementation of shortID.
| val | - value to be used. |
Reimplemented from TCLAP::Arg.
Reimplemented in TCLAP::UnlabeledValueArg< T >.
Definition at line 383 of file ValueArg.h.
References TCLAP::ValueArg< T >::_typeDesc.
Constraint<T>* TCLAP::ValueArg< T >::_constraint [protected] |
A Constraint this Arg must conform to.
Definition at line 72 of file ValueArg.h.
Referenced by TCLAP::ValueArg< T >::_extractValue().
T TCLAP::ValueArg< T >::_default [protected] |
Used to support the reset() method so that ValueArg can be reset to their constructed value.
Definition at line 58 of file ValueArg.h.
Referenced by TCLAP::ValueArg< T >::reset().
std::string TCLAP::ValueArg< T >::_typeDesc [protected] |
A human readable description of the type to be parsed.
This is a hack, plain and simple. Ideally we would use RTTI to return the name of type T, but until there is some sort of consistent support for human readable names, we are left to our own devices.
Definition at line 67 of file ValueArg.h.
Referenced by TCLAP::ValueArg< T >::longID(), TCLAP::UnlabeledValueArg< T >::longID(), TCLAP::ValueArg< T >::shortID(), and TCLAP::UnlabeledValueArg< T >::shortID().
T TCLAP::ValueArg< T >::_value [protected] |
The value parsed from the command line.
Can be of any type, as long as the >> operator for the type is defined.
Definition at line 52 of file ValueArg.h.
Referenced by TCLAP::ValueArg< T >::_extractValue(), TCLAP::ValueArg< T >::getValue(), and TCLAP::ValueArg< T >::reset().


View Highscores
Time:
Coding Quiz Challenge
Try to answer the following code-related questions within the time limit. Keep in mind that incorrect answers will penalize your score/ time by ten seconds
Start Quiz
Enter Initials
Submit
This page is where the scores go!
Re-set the page and it takes you to beginning!


Penwortham groundsman took his own life in cemetery where he had worked for 20 years
by Catherine MusgroveA popular groundsman hung himself in the cemetery where he worked, an inquest has heard.
Father-of-two Paul Fletcher, 46, was found hanging in Penwortham Cemetery in Hill Road, by a dog walker at 7.15am on September 2.
Yesterday, Preston Coroner’s Court heard how Mr Fletcher’s phone rang shortly after police arrived at the scene, and an officer broke the news to his brother Wayne, who had been concerned for his welfare.
Area Coroner Richard Taylor said Mr Fletcher had seen his brother the previous evening and asked him to look after his dog, which was not unusual, but that Wayne “didn’t feel he was quite himself”.
He said: “He (Wayne) asked him if he was alright and he didn’t say anything.”
Mr Fletcher rang Wayne most mornings, and when this didn’t occur, Wayne became worried.
Mr Taylor, reading Wayne’s statement, said: “He rang his number and knew something was wrong. He went to his house and found the front door unlocked. He knew he would be at the Cemetery, he simply knew something would have happened.”
Wayne Fletcher also told police how his brother had attempted to take his own life with an overdose 20 years ago, but since that happened, “seemed to be coping”.
Mr Fletcher’s Will was found on the kitchen table in his house in Leyland Road, Penwortham, and toxicology reports showed alcohol and cocaine in his system.
His cause of death was recorded as asphyxiation by hanging.
Mr Taylor recorded death by suicide. He said: “Given the circumstances this is a deliberate act and there doesn’t seem to be any other realistic explanation of what he’s done.”
>>>Read community tributes to Paul here


Try typing a number out of range (less than 5 or higher than 10), to see the styling disappear.
Note: The :in-range selector is not supported in Internet Explorer.


(For local development/testing of skinny.js components)
To launch a modal dialog that uses the unobtrusive syntax, click here.
To launch a modal dialog that uses the programmatic syntax, click here.
To see a tooltip that uses a selector, click here.
Click here to see a tooltip that uses the "adjacent elements" convention.


CHECK
YO'
SELF
Task Title
item to delete
Task Item
Make Task List
Clear All
Filter by Urgency
Task Title
Don't ever play yourself